[JTC]: Abort goal on deactivate (backport #1517) #1521
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, when deactivating the JTC once a trajectory is being executed leads to the following problems:
[ros2_control_node-1] [WARN] [1737719032.541174555] [realtime_tools]: goal_handle attempted invalid transition from state EXECUTING with event CANCELED, at ./src/rcl_action/goal_handle.c:95
(See scaled_joint_trajectory_controller does not behave as expected when stop is pressed on the robot UniversalRobots/Universal_Robots_ROS2_Driver#1250)I narrowed that down to the
RealtimeServerGoalHandle
callinggh_->canceled
which is supposed to be called only, once the goal is already cancelling according to its documentation. The transition doesn't succeed and hence that message gets repeated in every cycle of the non-realtime-thread, and the action never terminates.I've added a test for that event in this PR and a possible solution: Calling
setAborted
instead ofsetCanceled
in the JTC when it is being deactivated does work. I also think, this is a valid feedback to the user, as the goal isn't preempted by the user but it is aborted due to the controller going down.This is an automatic backport of pull request #1517 done by Mergify.