Skip to content

Commit

Permalink
Add acc limit consideration to avoid overshoot in RotationShimController
Browse files Browse the repository at this point in the history
Signed-off-by: RBT22 <[email protected]>
  • Loading branch information
RBT22 committed Jan 17, 2025
1 parent a33e8d2 commit 3e9b083
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ RotationShimController::computeRotateToHeadingCommand(
cmd_vel.twist.angular.z =
std::clamp(angular_vel, min_feasible_angular_speed, max_feasible_angular_speed);

// Check if we need to slow down to avoid overshooting
double max_vel_to_stop = std::sqrt(2 * max_angular_accel_ * fabs(angular_distance_to_heading));
if (fabs(cmd_vel.twist.angular.z) > max_vel_to_stop) {
cmd_vel.twist.angular.z = sign * max_vel_to_stop;

Check warning on line 306 in nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp

View check run for this annotation

Codecov / codecov/patch

nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp#L306

Added line #L306 was not covered by tests
}

isCollisionFree(cmd_vel, angular_distance_to_heading, pose);
return cmd_vel;
}
Expand Down

0 comments on commit 3e9b083

Please sign in to comment.