Skip to content

Commit

Permalink
Plane: reject guided destinations outside the fence
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per committed Jul 17, 2024
1 parent 61f462b commit 43566e0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ArduPlane/GCS_Mavlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,14 @@ MAV_RESULT GCS_MAVLINK_Plane::handle_command_int_do_reposition(const mavlink_com
return MAV_RESULT_DENIED;
}

#if AP_FENCE_ENABLED
// reject destination if outside the fence
if (!plane.fence.check_destination_within_fence(requested_position)) {
LOGGER_WRITE_ERROR(LogErrorSubsystem::NAVIGATION, LogErrorCode::DEST_OUTSIDE_FENCE);
return MAV_RESULT_DENIED;
}
#endif

// location is valid load and set
if (((int32_t)packet.param2 & MAV_DO_REPOSITION_FLAGS_CHANGE_MODE) ||
(plane.control_mode == &plane.mode_guided)) {
Expand Down

0 comments on commit 43566e0

Please sign in to comment.