Skip to content

Commit

Permalink
Plane: use POSITION_TARGET_TYPEMASK enum for bitmasks
Browse files Browse the repository at this point in the history
Signed-off-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
srmainwaring committed Feb 27, 2024
1 parent 74dbb23 commit 75d6c20
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ArduPlane/GCS_Mavlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1360,10 +1360,17 @@ 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)

// bit mask for path following: ignore force_set, yaw, yaw_rate
const uint16_t path_mask = 0b1111111000000000;
// const uint16_t alt_mask = 0b1111111111111011; // (z mask at bit 3)
const uint16_t alt_mask = POSITION_TARGET_TYPEMASK_X_IGNORE | POSITION_TARGET_TYPEMASK_Y_IGNORE | POSITION_TARGET_TYPEMASK_Z_IGNORE
| POSITION_TARGET_TYPEMASK_VX_IGNORE | POSITION_TARGET_TYPEMASK_VY_IGNORE | POSITION_TARGET_TYPEMASK_VZ_IGNORE
| POSITION_TARGET_TYPEMASK_AX_IGNORE | POSITION_TARGET_TYPEMASK_AY_IGNORE | POSITION_TARGET_TYPEMASK_AZ_IGNORE
| POSITION_TARGET_TYPEMASK_FORCE_SET
| POSITION_TARGET_TYPEMASK_YAW_IGNORE | POSITION_TARGET_TYPEMASK_YAW_RATE_IGNORE;

// bit mask for path following: force_set, yaw, yaw_rate
// const uint16_t path_mask = 0b1111110000000000;
const uint16_t path_mask = POSITION_TARGET_TYPEMASK_YAW_IGNORE
| POSITION_TARGET_TYPEMASK_YAW_RATE_IGNORE;

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

0 comments on commit 75d6c20

Please sign in to comment.