-
Notifications
You must be signed in to change notification settings - Fork 278
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
Required Info:
- Operating System:
- Any
- Installation type:
- Any
- Version or commit hash:
- DDS implementation:
- N/A
- Client library (if applicable):
- rclpy
Steps to reproduce issue
Execute the following script:
import rclpy
from rclpy.waitable import Waitable
from rclpy.callback_groups import MutuallyExclusiveCallbackGroup
class MutuallyExclusiveWaitable(Waitable):
def __init__(self):
super().__init__(MutuallyExclusiveCallbackGroup())
def is_ready(self, wait_set):
return False
def take_data(self):
return None
async def execute(self, taken_data):
pass
def get_num_entities(self):
return NumberOfEntities(0, 0, 0, 0, 0)
def add_to_wait_set(self, wait_set):
pass
rclpy.init()
waitable = MutuallyExclusiveWaitable()
node = rclpy.create_node('mynode')
node.add_waitable(waitable)
rclpy.spin(node)
rclpy.shutdown()
Expected behavior
No errors.
Actual behavior
Error:
Traceback (most recent call last):
File "waitable_mux.py", line 30, in <module>
rclpy.spin(node)
File "/home/jacob/ws/ros2_actions_ws/install/rclpy/lib/python3.5/site-packages/rclpy/__init__.py", line 119, in spin
executor.spin_once()
File "/home/jacob/ws/ros2_actions_ws/install/rclpy/lib/python3.5/site-packages/rclpy/executors.py", line 557, in spin_once
handler, entity, node = self.wait_for_ready_callbacks(timeout_sec=timeout_sec)
File "/home/jacob/ws/ros2_actions_ws/install/rclpy/lib/python3.5/site-packages/rclpy/executors.py", line 540, in wait_for_ready_callbacks
return next(self._cb_iter)
File "/home/jacob/ws/ros2_actions_ws/install/rclpy/lib/python3.5/site-packages/rclpy/executors.py", line 388, in _wait_for_ready_callbacks
waitables.extend(filter(self.can_execute, node.waitables))
File "/home/jacob/ws/ros2_actions_ws/install/rclpy/lib/python3.5/site-packages/rclpy/executors.py", line 339, in can_execute
return not entity._executor_event and entity.callback_group.can_execute(entity)
File "/home/jacob/ws/ros2_actions_ws/install/rclpy/lib/python3.5/site-packages/rclpy/callback_groups.py", line 98, in can_execute
assert weakref.ref(entity) in self.entities
AssertionError
Additional information
The fix should be easy. We should make sure the waitable is added to the callback group before spinning.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working