sea-bass / turtlebot3_behavior_demos

Example repository for autonomous behaviors using TurtleBot3, as well as Docker workflows in ROS based projects.
MIT License
270 stars 53 forks source link

Blackboard, complex object instead of single values? #43

Closed PaddyCube closed 3 months ago

PaddyCube commented 7 months ago

Let's say I want to implement a class representing a real robot. This class subscribes to sensor data, communicate with hardware and keeps sensor data, overall status current task and so on as attributes. It also provides methods to set actuators.

Is it possible to share this class across blackboard variable instead of pushing every Attribute as a single variable to blackboard?

Thanks for All your time explain robotic stuff to community. Me as a hobbyists robotics ebgineer, I learned so much about robots.

sea-bass commented 7 months ago

You can use any arbitrary data type in your blackboard, but I wouldn't recommend doing something like a "drivers class" in there.

Instead, I would have that instantiated in your code and pass it in as a pointer/reference to any BT nodes that require your robot interface. Like so!

https://www.behaviortree.dev/docs/tutorial-basics/tutorial_08_additional_args

(If you're using Python, it's even easier because you can just add a public attribute to the node)