Skip to content

Commit

Permalink
ArduPlane: clean up guided heading type initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
timtuxworth committed Oct 25, 2024
1 parent 7d3740f commit 91e33ea
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ArduPlane/GCS_Mavlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -980,16 +980,15 @@ MAV_RESULT GCS_MAVLINK_Plane::handle_command_int_guided_slew_commands(const mavl
// normal vehicle heading
} else if (int(packet.param1) == HEADING_TYPE_HEADING) { // compare as nearest int
plane.guided_state.target_heading_type = GUIDED_HEADING_HEADING;
plane.g2.guidedHeading.reset_I();
plane.guided_state.target_heading = new_target_heading;
plane.guided_state.target_heading_accel_limit = MAX(packet.param3, 0.05f);
} else {
// MAV_RESULT_DENIED means Command is invalid (is supported but has invalid parameters).
return MAV_RESULT_DENIED;
}

plane.g2.guidedHeading.reset_I();

plane.guided_state.target_heading = new_target_heading;
plane.guided_state.target_heading_accel_limit = MAX(packet.param3, 0.05f);
plane.guided_state.target_heading_time_ms = AP_HAL::millis();

return MAV_RESULT_ACCEPTED;
}
}
Expand Down

0 comments on commit 91e33ea

Please sign in to comment.