Skip to content

Commit

Permalink
Fix floating point comparison in JTC
Browse files Browse the repository at this point in the history
  • Loading branch information
Abishalini committed Dec 4, 2023
1 parent 23f944f commit 3e4c32b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1369,10 +1369,10 @@ bool JointTrajectoryController::validate_trajectory_msg(
{
for (size_t i = 0; i < trajectory.points.back().velocities.size(); ++i)
{
if (trajectory.points.back().velocities.at(i) != 0.)
if (fabs(trajectory.points.back().velocities.at(i)) > std::numeric_limits<float>::epsilon())
{
RCLCPP_ERROR(
get_node()->get_logger(), "Velocity of last trajectory point of joint %s is not zero: %f",
get_node()->get_logger(), "Velocity of last trajectory point of joint %s is not zero: %.15f",
trajectory.joint_names.at(i).c_str(), trajectory.points.back().velocities.at(i));
return false;
}
Expand Down

0 comments on commit 3e4c32b

Please sign in to comment.