Skip to content

Commit

Permalink
AC_WPNav: allow target position on track to stop advancing
Browse files Browse the repository at this point in the history
  • Loading branch information
rmackay9 authored and tridge committed Mar 20, 2024
1 parent d3125fe commit 158f794
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/AC_WPNav/AC_WPNav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ bool AC_WPNav::advance_wp_target_along_track(float dt)
const float track_error = _pos_control.get_pos_error_cm().dot(track_direction);
const float track_velocity = _inav.get_velocity_neu_cms().dot(track_direction);
// set time scaler to be consistent with the achievable aircraft speed with a 5% buffer for short term variation.
track_scaler_dt = constrain_float(0.05f + (track_velocity - _pos_control.get_pos_xy_p().kP() * track_error) / curr_target_vel.length(), 0.1f, 1.0f);
track_scaler_dt = constrain_float(0.05f + (track_velocity - _pos_control.get_pos_xy_p().kP() * track_error) / curr_target_vel.length(), 0.0f, 1.0f);
}

// Use vel_scaler_dt to slow down the trajectory time
Expand Down

0 comments on commit 158f794

Please sign in to comment.