Open Infraviored opened 3 weeks ago
Thanks for posting issue.
To be sure, I would want to see the complete application but guessing like below.
So i am expecting that modify_collision_checking
is called as ActionServer.execute_callback
, and modify_collision_checking
calls service request get_planning_scene.call_async(req)
and waiting on the result via rclpy.spin_until_future_complete
in the execute_callback in the executer.
This is not recommended design, that calling the blocking call in the callback of executor.
What happens here is after rclpy.spin_until_future_complete
completed, self.node
is removed from the executor.
That said, modify_collision_checking
function can be completed as you mentioned, but no more executable entity cannot be taken or executed in this executor anymore since the node has been removed from the executer.
This behavior is originally bug, reported https://github.com/ros2/rclpy/issues/1313 and fixed with https://github.com/ros2/rclpy/pull/1316.
downstream distro backports are still under review, so your distribution iron
does not have this fix yet.
besides above issue and bug fix, i would like you to try async & await
design for modify_collision_checking
.
the followings are pseudo code, but i believe it should fix your blocking problem in the application.
async def modify_collision_checking(
self, object_id: str, target_names: list, allow: bool
):
try:
get_planning_scene = self.node.get_planning_scene
while not get_planning_scene.wait_for_service(timeout_sec=1.0):
self.node.logger.info(
"get_planning_scene service not available, waiting..."
)
req = GetPlanningScene.Request()
req.components.components = PlanningSceneComponents.ALLOWED_COLLISION_MATRIX
future = get_planning_scene.call_async(req)
# REMOVE THIS: rclpy.spin_until_future_complete(self.node, future)
result = await future
response = result
I'm working on a ROS2 Iron project and have encountered a perplexing issue with my action servers. I've implemented collision checking modification without using MoveIt Task Constructor (which isn't available for Iron). The core functionality works, but I'm facing a critical problem:
The Issue: After executing a collision checking modification, ALL action servers in my main node become unresponsive. Here's what I've observed:
modify_collision_checking
function executes successfully and completes.[INFO] Completed modify_collision_checking: test_box, ['r1_gripper'], True
, telling me the funciton executed all the way.What I've Tried:
modify_collision_checking
withpass
, it works repeatedly without issues.The Code: Here's a simplified version of my
CollisionObjectHandler
class:And I'm setting up the action server like this in my main node (which imports CollisionObjectHandler:
The Question: What could be causing all action servers to become unresponsive after
modify_collision_checking
executes? Is there something in this function that might be interfering with the ROS2 communication infrastructure?Again, the function itself does not get stuck. It terminates successfully and the ActionServer sends a Success message. Only afterwards, all action servers (also these fully independent of CollistionObjectHandler) of the main script no longer receive.
Any insights or suggestions for debugging this issue would be greatly appreciated. I'm open to alternative approaches or workarounds if necessary.