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 22, 2025
1 parent 6ec91c7 commit 9b4b081
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;
}

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

0 comments on commit 9b4b081

Please sign in to comment.