Skip to content

Commit

Permalink
Fix floating point comparison in JTC (#879)
Browse files Browse the repository at this point in the history
* Fix floating point comparison in JTC

* Fix format

---------

Co-authored-by: Christoph Fröhlich <[email protected]>
  • Loading branch information
Abishalini and christophfroehlich authored Dec 4, 2023
1 parent 038a547 commit 71b06d0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1369,10 +1369,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 71b06d0

Please sign in to comment.