Skip to content

Commit 4a17a4f

Browse files
Abishalinichristophfroehlich
authored andcommitted
Fix floating point comparison in JTC (#879)
* Fix floating point comparison in JTC * Fix format --------- Co-authored-by: Christoph Fröhlich <[email protected]> (cherry picked from commit 71b06d0)
1 parent 29fae61 commit 4a17a4f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

joint_trajectory_controller/src/joint_trajectory_controller.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,10 +1390,11 @@ bool JointTrajectoryController::validate_trajectory_msg(
13901390
{
13911391
for (size_t i = 0; i < trajectory.points.back().velocities.size(); ++i)
13921392
{
1393-
if (trajectory.points.back().velocities.at(i) != 0.)
1393+
if (fabs(trajectory.points.back().velocities.at(i)) > std::numeric_limits<float>::epsilon())
13941394
{
13951395
RCLCPP_ERROR(
1396-
get_node()->get_logger(), "Velocity of last trajectory point of joint %s is not zero: %f",
1396+
get_node()->get_logger(),
1397+
"Velocity of last trajectory point of joint %s is not zero: %.15f",
13971398
trajectory.joint_names.at(i).c_str(), trajectory.points.back().velocities.at(i));
13981399
return false;
13991400
}

0 commit comments

Comments
 (0)