mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 07:13:34 +08:00
navigator: stop capturing images on mission exit
When a mission starts capturing images using the MAV_CMD_IMAGE_START_CAPTURE command, it should also stop it again, in case it is stopped early, e.g. with RTL.
This commit is contained in:
@@ -1499,7 +1499,20 @@ void Navigator::publish_vehicle_cmd(vehicle_command_s *vcmd)
|
||||
// sent to the mavlink links to other components.
|
||||
switch (vcmd->command) {
|
||||
case NAV_CMD_IMAGE_START_CAPTURE:
|
||||
|
||||
// We are only capturing multiple if param3 is 0 or > 1.
|
||||
if (static_cast<int>(vcmd->param3) != 1) {
|
||||
_is_capturing_images = true;
|
||||
}
|
||||
|
||||
vcmd->target_component = 100; // MAV_COMP_ID_CAMERA
|
||||
break;
|
||||
|
||||
case NAV_CMD_IMAGE_STOP_CAPTURE:
|
||||
_is_capturing_images = false;
|
||||
vcmd->target_component = 100; // MAV_COMP_ID_CAMERA
|
||||
break;
|
||||
|
||||
case NAV_CMD_VIDEO_START_CAPTURE:
|
||||
case NAV_CMD_VIDEO_STOP_CAPTURE:
|
||||
vcmd->target_component = 100; // MAV_COMP_ID_CAMERA
|
||||
@@ -1552,6 +1565,20 @@ void Navigator::release_gimbal_control()
|
||||
publish_vehicle_cmd(&vcmd);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Navigator::stop_capturing_images()
|
||||
{
|
||||
if (_is_capturing_images) {
|
||||
vehicle_command_s vcmd = {};
|
||||
vcmd.command = NAV_CMD_IMAGE_STOP_CAPTURE;
|
||||
vcmd.param1 = 0.0f;
|
||||
publish_vehicle_cmd(&vcmd);
|
||||
|
||||
// _is_capturing_images is reset inside publish_vehicle_cmd.
|
||||
}
|
||||
}
|
||||
|
||||
bool Navigator::geofence_allows_position(const vehicle_global_position_s &pos)
|
||||
{
|
||||
if ((_geofence.getGeofenceAction() != geofence_result_s::GF_ACTION_NONE) &&
|
||||
|
||||
Reference in New Issue
Block a user