Skip to content

Commit

Permalink
Fix floating point comparison in JTC (#879) (#880)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Dec 5, 2023
1 parent 29fae61 commit fb7397e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1390,10 +1390,11 @@ 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 fb7397e

Please sign in to comment.