mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
navigator: refactor publish_vehicle_cmd() -> publish_vehicle_command()
This commit is contained in:
parent
5f34474ecb
commit
f07ddda344
@ -88,8 +88,8 @@ Commands supported in missions, including camera commands, are shown in these me
|
||||
- Mission items are executed when set active.
|
||||
- `issue_command(_mission_item)` is called at the end of this to send the current non-waypoint command
|
||||
- [`MissionBlock::issue_command(const mission_item_s &item)`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/mission_block.cpp#L543-L562)
|
||||
- Creates a vehicle command for the mission item then calls `publish_vehicle_cmd` to publish it (`_navigator->publish_vehicle_cmd(&vcmd);`)
|
||||
- [`void Navigator::publish_vehicle_cmd(vehicle_command_s *vcmd)`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358)
|
||||
- Creates a vehicle command for the mission item then calls `publish_vehicle_command` to publish it (`_navigator->publish_vehicle_command(&vcmd);`)
|
||||
- [`void Navigator::publish_vehicle_command(vehicle_command_s *vcmd)`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358)
|
||||
- For some camera commands it sets the component ID to the camera component id (`vcmd->target_component = 100; // MAV_COMP_ID_CAMERA`)
|
||||
- All others just get published to default component ID.
|
||||
- The `VehicleCommand` UORB topic is published.
|
||||
|
||||
@ -83,10 +83,10 @@ void Mission::setActiveMissionItems() => https://github.com/PX4/PX4-Autopilot/bl
|
||||
Issuing command:
|
||||
MissionBlock::issue_command(const mission_item_s &item) => https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/mission_block.cpp#L543-L562
|
||||
At end this publishes the current vehicle command
|
||||
_navigator->publish_vehicle_cmd(&vcmd);
|
||||
_navigator->publish_vehicle_command(&vcmd);
|
||||
|
||||
Publishing command:
|
||||
void Navigator::publish_vehicle_cmd(vehicle_command_s *vcmd) => https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358
|
||||
void Navigator::publish_vehicle_command(vehicle_command_s *vcmd) => https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358
|
||||
For camera commands set to vcmd->target_component = 100; // MAV_COMP_ID_CAMERA
|
||||
All others just get published as-is
|
||||
-->
|
||||
|
||||
@ -88,8 +88,8 @@ Commands supported in missions, including camera commands, are shown in these me
|
||||
- Mission items are executed when set active.
|
||||
- `issue_command(_mission_item)` is called at the end of this to send the current non-waypoint command
|
||||
- [`MissionBlock::issue_command(const mission_item_s &item)`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/mission_block.cpp#L543-L562)
|
||||
- Creates a vehicle command for the mission item then calls `publish_vehicle_cmd` to publish it (`_navigator->publish_vehicle_cmd(&vcmd);`)
|
||||
- [`void Navigator::publish_vehicle_cmd(vehicle_command_s *vcmd)`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358)
|
||||
- Creates a vehicle command for the mission item then calls `publish_vehicle_command` to publish it (`_navigator->publish_vehicle_command(&vcmd);`)
|
||||
- [`void Navigator::publish_vehicle_command(vehicle_command_s *vcmd)`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358)
|
||||
- For some camera commands it sets the component ID to the camera component id (`vcmd->target_component = 100; // MAV_COMP_ID_CAMERA`)
|
||||
- All others just get published to default component ID.
|
||||
- The `VehicleCommand` UORB topic is published.
|
||||
|
||||
@ -83,10 +83,10 @@ void Mission::setActiveMissionItems() => https://github.com/PX4/PX4-Autopilot/bl
|
||||
Issuing command:
|
||||
MissionBlock::issue_command(const mission_item_s &item) => https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/mission_block.cpp#L543-L562
|
||||
At end this publishes the current vehicle command
|
||||
_navigator->publish_vehicle_cmd(&vcmd);
|
||||
_navigator->publish_vehicle_command(&vcmd);
|
||||
|
||||
Publishing command:
|
||||
void Navigator::publish_vehicle_cmd(vehicle_command_s *vcmd) => https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358
|
||||
void Navigator::publish_vehicle_command(vehicle_command_s *vcmd) => https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358
|
||||
For camera commands set to vcmd->target_component = 100; // MAV_COMP_ID_CAMERA
|
||||
All others just get published as-is
|
||||
-->
|
||||
|
||||
@ -88,8 +88,8 @@ PX4 повторно видає пункти камери, знайдені в
|
||||
- Предмети місії виконуються, коли вони активовані.
|
||||
- `issue_command(_mission_item)` викликається в кінці цього, щоб відправити поточну непунктову команду
|
||||
- [`MissionBlock::видача_команди(const mission_item_s &item)`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/mission_block.cpp#L543-L562)
|
||||
- Створює команду для місії транспортного засобу, а потім викликає `publish_vehicle_cmd` для публікації її (`_navigator->publish_vehicle_cmd(&vcmd);`)
|
||||
- [`void Navigator::publish_vehicle_cmd(vehicle_command_s *vcmd)`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358)
|
||||
- Створює команду для місії транспортного засобу, а потім викликає `publish_vehicle_command` для публікації її (`_navigator->publish_vehicle_command(&vcmd);`)
|
||||
- [`void Navigator::publish_vehicle_command(vehicle_command_s *vcmd)`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358)
|
||||
- Для деяких команд камери це встановлює ідентифікатор компонента на ідентифікатор компонента камери (`vcmd->target_component = 100; // MAV_COMP_ID_CAMERA`)
|
||||
- Усі інші просто публікуються під стандартний компонент ID.
|
||||
- Тема UORB `VehicleCommand` публікується.
|
||||
|
||||
@ -83,10 +83,10 @@ void Mission::setActiveMissionItems() => https://github.com/PX4/PX4-Autopilot/bl
|
||||
Issuing command:
|
||||
MissionBlock::issue_command(const mission_item_s &item) => https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/mission_block.cpp#L543-L562
|
||||
At end this publishes the current vehicle command
|
||||
_navigator->publish_vehicle_cmd(&vcmd);
|
||||
_navigator->publish_vehicle_command(&vcmd);
|
||||
|
||||
Publishing command:
|
||||
void Navigator::publish_vehicle_cmd(vehicle_command_s *vcmd) => https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358
|
||||
void Navigator::publish_vehicle_command(vehicle_command_s *vcmd) => https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358
|
||||
For camera commands set to vcmd->target_component = 100; // MAV_COMP_ID_CAMERA
|
||||
All others just get published as-is
|
||||
-->
|
||||
|
||||
@ -88,8 +88,8 @@ Commands supported in missions, including camera commands, are shown in these me
|
||||
- Mission items are executed when set active.
|
||||
- `issue_command(_mission_item)` is called at the end of this to send the current non-waypoint command
|
||||
- [`MissionBlock::issue_command(const mission_item_s &item)`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/mission_block.cpp#L543-L562)
|
||||
- Creates a vehicle command for the mission item then calls `publish_vehicle_cmd` to publish it (`_navigator->publish_vehicle_cmd(&vcmd);`)
|
||||
- [`void Navigator::publish_vehicle_cmd(vehicle_command_s *vcmd)`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358)
|
||||
- Creates a vehicle command for the mission item then calls `publish_vehicle_command` to publish it (`_navigator->publish_vehicle_command(&vcmd);`)
|
||||
- [`void Navigator::publish_vehicle_command(vehicle_command_s *vcmd)`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358)
|
||||
- For some camera commands it sets the component ID to the camera component id (`vcmd->target_component = 100; // MAV_COMP_ID_CAMERA`)
|
||||
- All others just get published to default component ID.
|
||||
- The `VehicleCommand` UORB topic is published.
|
||||
|
||||
@ -83,10 +83,10 @@ void Mission::setActiveMissionItems() => https://github.com/PX4/PX4-Autopilot/bl
|
||||
Issuing command:
|
||||
MissionBlock::issue_command(const mission_item_s &item) => https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/mission_block.cpp#L543-L562
|
||||
At end this publishes the current vehicle command
|
||||
_navigator->publish_vehicle_cmd(&vcmd);
|
||||
_navigator->publish_vehicle_command(&vcmd);
|
||||
|
||||
Publishing command:
|
||||
void Navigator::publish_vehicle_cmd(vehicle_command_s *vcmd) => https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358
|
||||
void Navigator::publish_vehicle_command(vehicle_command_s *vcmd) => https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/navigator/navigator_main.cpp#L1358
|
||||
For camera commands set to vcmd->target_component = 100; // MAV_COMP_ID_CAMERA
|
||||
All others just get published as-is
|
||||
-->
|
||||
|
||||
@ -120,6 +120,6 @@ Land::on_active()
|
||||
// and thus always climb MIS_LND_ABRT_ALT
|
||||
vcmd.param7 = _navigator->get_global_position()->alt + _navigator->get_landing_abort_min_alt();
|
||||
|
||||
_navigator->publish_vehicle_cmd(&vcmd);
|
||||
_navigator->publish_vehicle_command(&vcmd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -924,7 +924,7 @@ MissionBase::do_abort_landing()
|
||||
vcmd.param6 = _mission_item.lon;
|
||||
vcmd.param7 = alt_sp;
|
||||
|
||||
_navigator->publish_vehicle_cmd(&vcmd);
|
||||
_navigator->publish_vehicle_command(&vcmd);
|
||||
}
|
||||
|
||||
void MissionBase::publish_navigator_mission_item()
|
||||
|
||||
@ -549,7 +549,7 @@ MissionBlock::issue_command(const mission_item_s &item)
|
||||
}
|
||||
}
|
||||
|
||||
_navigator->publish_vehicle_cmd(&vcmd);
|
||||
_navigator->publish_vehicle_command(&vcmd);
|
||||
|
||||
if (item_has_timeout(item)) {
|
||||
_timestamp_command_timeout = hrt_absolute_time();
|
||||
@ -785,7 +785,7 @@ MissionBlock::set_land_item(struct mission_item_s *item)
|
||||
vcmd.command = NAV_CMD_DO_VTOL_TRANSITION;
|
||||
vcmd.param1 = vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC;
|
||||
vcmd.param2 = 0.0f;
|
||||
_navigator->publish_vehicle_cmd(&vcmd);
|
||||
_navigator->publish_vehicle_command(&vcmd);
|
||||
}
|
||||
|
||||
/* set the land item */
|
||||
|
||||
@ -137,7 +137,7 @@ public:
|
||||
*
|
||||
* @param vcmd Vehicle command to execute
|
||||
*/
|
||||
void publish_vehicle_cmd(vehicle_command_s *vcmd);
|
||||
void publish_vehicle_command(vehicle_command_s *vcmd);
|
||||
|
||||
#if CONFIG_NAVIGATOR_ADSB
|
||||
/**
|
||||
|
||||
@ -665,7 +665,7 @@ void Navigator::run()
|
||||
vehicle_command_s vcmd = {};
|
||||
vcmd.command = vehicle_command_s::VEHICLE_CMD_MISSION_START;
|
||||
vcmd.param1 = _mission.get_land_start_index();
|
||||
publish_vehicle_cmd(&vcmd);
|
||||
publish_vehicle_command(&vcmd);
|
||||
|
||||
} else {
|
||||
PX4_WARN("planned mission landing not available");
|
||||
@ -867,7 +867,7 @@ void Navigator::run()
|
||||
vehicle_command_s vcmd = {};
|
||||
vcmd.command = NAV_CMD_DO_VTOL_TRANSITION;
|
||||
vcmd.param1 = vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC;
|
||||
publish_vehicle_cmd(&vcmd);
|
||||
publish_vehicle_command(&vcmd);
|
||||
mavlink_log_info(&_mavlink_log_pub, "Transition to hover mode and descend.\t");
|
||||
events::send(events::ID("navigator_transition_descend"), events::Log::Critical,
|
||||
"Transition to hover mode and descend");
|
||||
@ -1227,13 +1227,13 @@ void Navigator::take_traffic_conflict_action()
|
||||
case 2: {
|
||||
_rtl.set_return_alt_min(true);
|
||||
vcmd.command = vehicle_command_s::VEHICLE_CMD_NAV_RETURN_TO_LAUNCH;
|
||||
publish_vehicle_cmd(&vcmd);
|
||||
publish_vehicle_command(&vcmd);
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: {
|
||||
vcmd.command = vehicle_command_s::VEHICLE_CMD_NAV_LAND;
|
||||
publish_vehicle_cmd(&vcmd);
|
||||
publish_vehicle_command(&vcmd);
|
||||
break;
|
||||
|
||||
}
|
||||
@ -1241,7 +1241,7 @@ void Navigator::take_traffic_conflict_action()
|
||||
case 4: {
|
||||
|
||||
vcmd.command = vehicle_command_s::VEHICLE_CMD_NAV_LOITER_UNLIM;
|
||||
publish_vehicle_cmd(&vcmd);
|
||||
publish_vehicle_command(&vcmd);
|
||||
break;
|
||||
|
||||
}
|
||||
@ -1392,7 +1392,7 @@ void Navigator::publish_navigator_status()
|
||||
}
|
||||
}
|
||||
|
||||
void Navigator::publish_vehicle_cmd(vehicle_command_s *vcmd)
|
||||
void Navigator::publish_vehicle_command(vehicle_command_s *vcmd)
|
||||
{
|
||||
vcmd->timestamp = hrt_absolute_time();
|
||||
vcmd->source_system = _vstatus.system_id;
|
||||
@ -1537,7 +1537,7 @@ void Navigator::acquire_gimbal_control()
|
||||
vcmd.param2 = _vstatus.component_id;
|
||||
vcmd.param3 = -1.0f; // Leave unchanged.
|
||||
vcmd.param4 = -1.0f; // Leave unchanged.
|
||||
publish_vehicle_cmd(&vcmd);
|
||||
publish_vehicle_command(&vcmd);
|
||||
}
|
||||
|
||||
void Navigator::release_gimbal_control()
|
||||
@ -1548,7 +1548,7 @@ void Navigator::release_gimbal_control()
|
||||
vcmd.param2 = -3.0f; // Remove control if it had it.
|
||||
vcmd.param3 = -1.0f; // Leave unchanged.
|
||||
vcmd.param4 = -1.0f; // Leave unchanged.
|
||||
publish_vehicle_cmd(&vcmd);
|
||||
publish_vehicle_command(&vcmd);
|
||||
}
|
||||
|
||||
|
||||
@ -1559,9 +1559,9 @@ Navigator::stop_capturing_images()
|
||||
vehicle_command_s vcmd = {};
|
||||
vcmd.command = NAV_CMD_IMAGE_STOP_CAPTURE;
|
||||
vcmd.param1 = 0.0f;
|
||||
publish_vehicle_cmd(&vcmd);
|
||||
publish_vehicle_command(&vcmd);
|
||||
|
||||
// _is_capturing_images is reset inside publish_vehicle_cmd.
|
||||
// _is_capturing_images is reset inside publish_vehicle_command.
|
||||
}
|
||||
}
|
||||
|
||||
@ -1612,7 +1612,7 @@ void Navigator::disable_camera_trigger()
|
||||
// Pause trigger
|
||||
cmd.param1 = -1.0f;
|
||||
cmd.param3 = 1.0f;
|
||||
publish_vehicle_cmd(&cmd);
|
||||
publish_vehicle_command(&cmd);
|
||||
}
|
||||
|
||||
void Navigator::set_gimbal_neutral()
|
||||
@ -1624,7 +1624,7 @@ void Navigator::set_gimbal_neutral()
|
||||
vcmd.param3 = NAN;
|
||||
vcmd.param4 = NAN;
|
||||
vcmd.param5 = gimbal_manager_set_attitude_s::GIMBAL_MANAGER_FLAGS_NEUTRAL;
|
||||
publish_vehicle_cmd(&vcmd);
|
||||
publish_vehicle_command(&vcmd);
|
||||
}
|
||||
|
||||
void Navigator::sendWarningDescentStoppedDueToTerrain()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user