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]>
(cherry picked from commit 71b06d0)
  • Loading branch information
Abishalini authored and mergify[bot] committed Dec 4, 2023
1 parent 29fae61 commit 4a17a4f
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 4a17a4f

Please sign in to comment.