mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-06 06:43:21 +08:00
Keep initialization of outgoing vehicle_command_s consistent
All others are initialized this way.
This commit is contained in:
committed by
Lorenz Meier
parent
79f49fd851
commit
c200d0e9a4
@@ -483,10 +483,17 @@ CameraTrigger::stop()
|
|||||||
void
|
void
|
||||||
CameraTrigger::test()
|
CameraTrigger::test()
|
||||||
{
|
{
|
||||||
struct vehicle_command_s cmd = {};
|
struct vehicle_command_s cmd = {
|
||||||
cmd.timestamp = hrt_absolute_time(),
|
.timestamp = hrt_absolute_time(),
|
||||||
cmd.param5 = 1.0f;
|
.param5 = 1.0f,
|
||||||
cmd.command = vehicle_command_s::VEHICLE_CMD_DO_DIGICAM_CONTROL;
|
.param6 = 0.0f,
|
||||||
|
.param1 = 0.0f,
|
||||||
|
.param2 = 0.0f,
|
||||||
|
.param3 = 0.0f,
|
||||||
|
.param4 = 0.0f,
|
||||||
|
.param7 = 0.0f,
|
||||||
|
.command = vehicle_command_s::VEHICLE_CMD_DO_DIGICAM_CONTROL
|
||||||
|
};
|
||||||
|
|
||||||
orb_advert_t pub = orb_advertise_queue(ORB_ID(vehicle_command), &cmd, vehicle_command_s::ORB_QUEUE_LENGTH);
|
orb_advert_t pub = orb_advertise_queue(ORB_ID(vehicle_command), &cmd, vehicle_command_s::ORB_QUEUE_LENGTH);
|
||||||
(void)orb_unadvertise(pub);
|
(void)orb_unadvertise(pub);
|
||||||
|
|||||||
@@ -479,22 +479,21 @@ Navigator::task_main()
|
|||||||
int land_start = _mission.find_offboard_land_start();
|
int land_start = _mission.find_offboard_land_start();
|
||||||
|
|
||||||
if (land_start != -1) {
|
if (land_start != -1) {
|
||||||
struct vehicle_command_s vcmd = {};
|
struct vehicle_command_s vcmd = {
|
||||||
vcmd.timestamp = hrt_absolute_time(),
|
.timestamp = hrt_absolute_time(),
|
||||||
vcmd.param1 = (float)land_start,
|
.param5 = 0.0f,
|
||||||
vcmd.param2 = 0.0f,
|
.param6 = 0.0f,
|
||||||
vcmd.param3 = 0.0f,
|
.param1 = (float)land_start,
|
||||||
vcmd.param4 = 0.0f,
|
.param2 = 0.0f,
|
||||||
vcmd.param5 = 0.0,
|
.param3 = 0.0f,
|
||||||
vcmd.param6 = 0.0,
|
.param4 = 0.0f,
|
||||||
vcmd.param7 = 0.0f,
|
.param7 = 0.0f,
|
||||||
vcmd.command = vehicle_command_s::VEHICLE_CMD_MISSION_START;
|
.command = vehicle_command_s::VEHICLE_CMD_MISSION_START,
|
||||||
vcmd.target_system = (uint8_t)get_vstatus()->system_id;
|
.target_system = (uint8_t)get_vstatus()->system_id,
|
||||||
vcmd.target_component = (uint8_t)get_vstatus()->component_id;
|
.target_component = (uint8_t)get_vstatus()->component_id,
|
||||||
vcmd.source_system = (uint8_t)get_vstatus()->system_id;
|
.source_system = (uint8_t)get_vstatus()->system_id,
|
||||||
vcmd.source_component = (uint8_t)get_vstatus()->component_id;
|
.source_component = (uint8_t)get_vstatus()->component_id
|
||||||
vcmd.confirmation = false;
|
};
|
||||||
vcmd.from_external = false;
|
|
||||||
|
|
||||||
publish_vehicle_cmd(vcmd);
|
publish_vehicle_cmd(vcmd);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user