Skip to content

Commit 71b06d0

Browse files
Fix floating point comparison in JTC (ros-controls#879)
* Fix floating point comparison in JTC * Fix format --------- Co-authored-by: Christoph Fröhlich <[email protected]>
1 parent 038a547 commit 71b06d0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

joint_trajectory_controller/src/joint_trajectory_controller.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,10 +1369,11 @@ bool JointTrajectoryController::validate_trajectory_msg(
13691369
{
13701370
for (size_t i = 0; i < trajectory.points.back().velocities.size(); ++i)
13711371
{
1372-
if (trajectory.points.back().velocities.at(i) != 0.)
1372+
if (fabs(trajectory.points.back().velocities.at(i)) > std::numeric_limits<float>::epsilon())
13731373
{
13741374
RCLCPP_ERROR(
1375-
get_node()->get_logger(), "Velocity of last trajectory point of joint %s is not zero: %f",
1375+
get_node()->get_logger(),
1376+
"Velocity of last trajectory point of joint %s is not zero: %.15f",
13761377
trajectory.joint_names.at(i).c_str(), trajectory.points.back().velocities.at(i));
13771378
return false;
13781379
}

0 commit comments

Comments
 (0)