Skip to content

Commit

Permalink
protect against div by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeferguson committed May 10, 2022
1 parent 84dd27f commit e59619d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion graceful_controller_ros/src/graceful_controller_ros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,11 @@ bool GracefulControllerROS::simulate(const geometry_msgs::PoseStamped& target_po
double footprint_scaling = 1.0;
if (vel_x > scaling_vel_x_)
{
double ratio = (vel_x - scaling_vel_x_) / (max_vel_x_ - scaling_vel_x_);
double ratio = max_vel_x_ - scaling_vel_x_;
if (ratio > 0)
{
ratio = (vel_x - scaling_vel_x_) / ratio;
}
footprint_scaling += ratio * scaling_factor_;
}

Expand Down

0 comments on commit e59619d

Please sign in to comment.