PlanSys2 / ros2_planning_system

This repo contains a PDDL-based planning system for ROS2.
Apache License 2.0
396 stars 87 forks source link

Global Blackboard for Behvaiour Trees #315

Open claudio-dg opened 3 months ago

claudio-dg commented 3 months ago

Hi @fmrico, i have been trying to use a global blackboard so that different nodes of different actions (i.e. of different trees) have access to the same values. To do so, I tried to follow the instructions at behaviorTree.docs, but unfortunately, I did not manage to set it up properly.

Trying to set a value in the ExecutorNode.cpp it seems to be not reachable by any node, while setting it in the BTAction.cpp, every tree presents a local copy of it, as a different blackboard is instantiated for each subtree when creating the BT.

Is there a way to use the plansys2 structure but adding a general blackboard that can be accessed from every Subtree directly?

fmrico commented 2 months ago

Hi @claudio-dg

To have a global blackboard, we should modify plansys2_bt_actions/BTAction.cpp to use a blackboard provided externally, instead of creating its own blackboard. Next, you should instantiate all the actions in the same process in a main() function, providing all classes with the same blackboard object.