Servo Node - pause service: check if request is different than current state. #3265
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.
Description
When using the servo_node from moveit_servo, the service call to /servo_node/pause_servo hangs for a while (sometimes even up to a minute on my machine) when requesting pause = false while the pause status was already false. This behavior can be experienced by running the demo:
ros2 launch moveit_servo demo_ros_api.launch.py
And calling the service:
ros2 service call /servo_node/pause_servo std_srvs/srv/SetBool '{data: false}'
After a while, the following error is logged:
[moveit_servo_demo_container.moveit.ros.move_group.collision_monitor]: Collision monitor could not be started
To avoid this behavior, I propose this change to first check whether the requested pause state is different compared to the current pause state. If not, the response will be returned with the message that nothing is changed since the requested pause stated was already active.
Checklist