Skip to content

Commit

Permalink
Plane: check SET_POSITION_TARGET_GLOBAL_INT bit mask for path following
Browse files Browse the repository at this point in the history
Signed-off-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
srmainwaring committed Feb 26, 2024
1 parent 80956f6 commit 6bc8930
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ArduPlane/GCS_Mavlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1362,8 +1362,11 @@ void GCS_MAVLINK_Plane::handle_set_position_target_global_int(const mavlink_mess
// Unexpectedly, the mask is expecting "ones" for dimensions that should
// be IGNORNED rather than INCLUDED. See mavlink documentation of the
// SET_POSITION_TARGET_GLOBAL_INT message, type_mask field.
const uint16_t alt_mask = 0b1111111111111011; // (z mask at bit 3)

const uint16_t alt_mask = 0b1111111111111011; // (z mask at bit 3)

// bit mask for path following: ignore force_set, yaw, yaw_rate
const uint16_t path_mask = 0b1111111000000000;

bool msg_valid = true;
AP_Mission::Mission_Command cmd = {0};

Expand Down Expand Up @@ -1395,11 +1398,8 @@ void GCS_MAVLINK_Plane::handle_set_position_target_global_int(const mavlink_mess
}
} // end if alt_mask

// terrain_navigation
//! @todo(srmainwaring) handle mode general control...
//! check the ignore flags
//! check for valid inputs
if (pos_target.type_mask == 0) {
// terrain_navigation / path following
if (pos_target.type_mask & path_mask) {
// switch mode to TERRAIN_NAVIGATION
plane.set_mode(plane.mode_terrain_navigation, ModeReason::GCS_COMMAND);

Expand Down

0 comments on commit 6bc8930

Please sign in to comment.