ros2_controllers
ros2_controllers copied to clipboard
[JTC] Make goal_time_tolerance overwrite default value only if explicitly set
Since #716 we process the tolerances set from the action goal. This was done as described in https://github.com/ros-controls/control_msgs/blob/65814d985aa29bed0adfaed5f2ebd8cf26266056/control_msgs/action/FollowJointTrajectory.action#L6-L10 and https://github.com/ros-controls/control_msgs/blob/65814d985aa29bed0adfaed5f2ebd8cf26266056/control_msgs/msg/JointTolerance.msg#L7-L10.
However, the goal_time_tolerance was always overwritten with the value from the action goal. This actually changed the JTC's default behavior if
- a
goal_time_tolerance!= 0 was set in the controller config and - no
goal_time_toleranceor explicitly a0.0was given in the action goal.
In this, case, the controller would wait indefinitely until the robot reached the final target independent of the goal_time_tolerance configured inside the controller's default values.
This PR makes it such as
- If a
goal_time_toleranceof0.0is given in the action (which is the default if left empty), the value from the controller config will be used - If a
goal_time_toleranceof-1.0is given the controller will wait at the end of the trajectory until the error gets lower than thegoal_tolerancefor each joint. - If a
goal_time_tolerance> 0.0 is given, thegoal_time_tolerancefrom the action goal will be used. - Any other negative value for
goal_time_tolerancewill make the controller fall back to its configured tolerances completely.