Skip to content

Commit

Permalink
Rover: ignore set_position_target_local_ned pos-target if acc is not …
Browse files Browse the repository at this point in the history
…masked

Co-authored-by: muramura <[email protected]>

we don't use acceleration if you're trying to move the vehicle, so we shouldn't accept the command it isn't in the "ignore" mask
  • Loading branch information
peterbarker committed Sep 11, 2024
1 parent 2b903d2 commit 8c1aecc
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Rover/GCS_Mavlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,26 +949,34 @@ void GCS_MAVLINK_Rover::handle_set_position_target_local_ned(const mavlink_messa
}
}

if (!acc_ignore) {
// ignore any command where acceleration is not ignored
return;
}

// set guided mode targets
if (!pos_ignore) {
// consume position target
if (!rover.mode_guided.set_desired_location(target_loc)) {
// GCS will need to monitor desired location to
// see if they are having an effect.
}
} else if (!vel_ignore && acc_ignore && yaw_ignore && yaw_rate_ignore) {
return;
}

if (!vel_ignore && yaw_ignore && yaw_rate_ignore) {
// consume velocity
rover.mode_guided.set_desired_heading_and_speed(target_yaw_cd, speed_dir * target_speed);
} else if (!vel_ignore && acc_ignore && yaw_ignore && !yaw_rate_ignore) {
} else if (!vel_ignore && yaw_ignore && !yaw_rate_ignore) {
// consume velocity and turn rate
rover.mode_guided.set_desired_turn_rate_and_speed(target_turn_rate_cds, speed_dir * target_speed);
} else if (!vel_ignore && acc_ignore && !yaw_ignore && yaw_rate_ignore) {
} else if (!vel_ignore && !yaw_ignore && yaw_rate_ignore) {
// consume velocity and heading
rover.mode_guided.set_desired_heading_and_speed(target_yaw_cd, speed_dir * target_speed);
} else if (vel_ignore && acc_ignore && !yaw_ignore && yaw_rate_ignore) {
} else if (vel_ignore && !yaw_ignore && yaw_rate_ignore) {
// consume just target heading (probably only skid steering vehicles can do this)
rover.mode_guided.set_desired_heading_and_speed(target_yaw_cd, 0.0f);
} else if (vel_ignore && acc_ignore && yaw_ignore && !yaw_rate_ignore) {
} else if (vel_ignore && yaw_ignore && !yaw_rate_ignore) {
// consume just turn rate (probably only skid steering vehicles can do this)
rover.mode_guided.set_desired_turn_rate_and_speed(target_turn_rate_cds, 0.0f);
}
Expand Down

0 comments on commit 8c1aecc

Please sign in to comment.