Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/joint_states subscriber to blackboard #50

Open
slyandsmart opened this issue Jun 26, 2024 · 1 comment
Open

/joint_states subscriber to blackboard #50

slyandsmart opened this issue Jun 26, 2024 · 1 comment

Comments

@slyandsmart
Copy link

I try to build up a little BH-Tree for my mobile robot with a small manipulator. I wanted to substribe /joint_states topic within the Tree to write it to the blackboard.

This works quite fine with artificial topic from simulation:
jointstates_to_blackboard = py_trees_ros.subscribers.ToBlackboard( name="jointstates_to_blackboard", topic_type=JointState, topic_name="/joint_simulation/JointState", qos_profile=py_trees_ros.utilities.qos_profile_unlatched(), blackboard_variables={'jointstate': None} )

but it dos not work using standard /joint_states topic
jointstates_to_blackboard = py_trees_ros.subscribers.ToBlackboard( name="jointstates_to_blackboard", topic_type=JointState, topic_name="/joint_states", qos_profile=py_trees_ros.utilities.qos_profile_unlatched(), blackboard_variables={'jointstate': None} )

Brings up the error:

[rcutils|error_handling.c:108] rcutils_set_error_state()
This error state is being overwritten:

'create_subscription() called for existing topic name rt/joint_states with incompatible type sensor_msgs::msg::dds_::JointState_, at ./src/subscription.cpp:146, at ./src/rcl/subscription.c:109'

with this new error message:

'invalid allocator, at ./src/rcl/subscription.c:219'

rcutils_reset_error() should be called after error handling to avoid this.
<<<
invalid allocator, at ./src/rcl/subscription.c:219
Traceback (most recent call last):
File "/workspace/src/emt_acm_do/do_slot_dozing/do_slot_dozing/blade_move_behaviour_tree.py", line 252, in
main()
File "/workspace/src/emt_acm_do/do_slot_dozing/do_slot_dozing/blade_move_behaviour_tree.py", line 225, in main
tree.setup(timeout=15)
File "/opt/ros/humble/lib/python3.10/site-packages/py_trees_ros/trees.py", line 437, in setup
super().setup(
File "/opt/ros/humble/lib/python3.10/site-packages/py_trees/trees.py", line 378, in setup
setup(root=self.root, timeout=timeout, visitor=visitor, **kwargs)
File "/opt/ros/humble/lib/python3.10/site-packages/py_trees/trees.py", line 131, in setup
visited_setup()
File "/opt/ros/humble/lib/python3.10/site-packages/py_trees/trees.py", line 110, in visited_setup
node.setup(**kwargs)
File "/opt/ros/humble/lib/python3.10/site-packages/py_trees_ros/subscribers.py", line 115, in setup
self.subscriber = self.node.create_subscription(
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 1370, in create_subscription
subscription_object = _rclpy.Subscription(
rclpy._rclpy_pybind11.RCLError: Failed to create subscription: invalid allocator, at ./src/rcl/subscription.c:219

With any other topic it works fine.

@slyandsmart
Copy link
Author

I think i found the problem
image

I have also a subscribers.EventToBlackboard set up, but with this implementation it adds the topic type as shown in picture.

I think this will not work as i understand it correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant