BT4.x, Groot2, BTROS2: orquestación avanzada en ROS2
This repository contains BT.CPP assets to set up the simulation environment and tools stack for the workshop on advanced orchestration in ROS2, integrating BT.CPP 4.x, Groot2, BT.ROS2 for robotics behavior modular and composable orchestration.
The stack combines:
- BehaviorTree.CPP 4.x: Core BT engine for ROS2
- Groot2: Visual editor and monitor for BTs
- BT.ROS2: ROS2 integration for BT prototipation and execution
- Docker with Compose support
- Git
- X11 for GUI applications (Groot2, etc.)
Use the provided build script to create the development environment:
cd Docker
./build_container.sh [OPTIONS]- [Option A] No arguments: Pull image from dockerhub (suggested!!!)
- [Option B]
--clean-rebuild: Force a complete rebuild of the container, removing cached layers
With [Option B] The build process will:
- Base Image: Use the latest
pyrobosim_ros:${ROS_DISTRO}as the foundation - Dependency Management: Import and update dependencies in
deps/using VCS - ROS2 Setup: Install dependencies via rosdep and build the workspace
- Environment: Prepare a full ROS2 workspace with all integrated BT components
Launch the development container:
cd Docker
docker compose -f dev-docker-compose.yaml up [--force-recreate]This starts the main container with:
- Network: Host mode for ROS2 communication
- Display: X11 forwarding for GUI applications (Groot2)
- Volumes: Workspace and world files persistence
Open the project in VSCode with the Dev Container extension installed:
- ctrl+shift+p -> "Dev Containers -> Open Folder in Container..."
- Select folder
Docker/DevContainer
Connect to the running container:
docker exec --user btdev -it <container-name> bashInspect container-name with docker ps -a
The workspace is pre-built and sourced automatically.
Once inside the development environment, quickly test the following cmds:
# Check your user
whoami
# btdev
# Check ros distro and ros_domain_id
env | grep ROS_D
# ROS_DOMAIN_ID=12
# ROS_DISTRO=jazzy
# Check you are in the correct workspace
echo $PWD
# /roscon25_ws
# Compile and source
colcon build --symlink-install && source install/setup.bash
# Summary: 9 packages finished [...s]
#Check presence of this pkg
ros2 pkg list | grep behaviortree_pyrobosim
# behaviortree_pyrobosimBefore launching any graphical application, on a terminal on your host machine (not in your container!!!) give once the following command
xhost +local:dockerLet's go back to the container now....
To start the simulator:
ros2 launch simple_pyrobosim_ros demo.launch.py world_file:=/roscon25_ws/worlds/world12.yamlworld_file can have the following values:
- /roscon25_ws/worlds/world12.yaml for Exercise 1 and Exercise 2
- /roscon25_ws/worlds/world3.yaml for Exercise 3
- /roscon25_ws/worlds/world4.yaml for Exercise 4
To install Groot2 (it is a simple GUI installation):
cd /roscon25_ws
chmod +x Groot2-v1.6.1-linux-installer.run && ./Groot2-v1.6.1-linux-installer.runFollow gui installation and then create an alias (suggested, not mandatory). You can put the alias directly in the .bashrc to easily start it from a new terminal.
# default <groot2-bin-exec-path> might be "/home/btdev/Groot2/bin/groot2"
alias groot2=<groot2-bin-exec-path>
groot2 #should start groot2
# to "save" the alias in the user bash session
echo "alias groot2=/home/btdev/Groot2/bin/groot2" >> /home/btdev/.bashrc
source /home/btdev/.bashrc
groot2 #should start groot2Having launched already the simulator (step 1)...
Start BTROS2 Executor through:
ros2 launch behaviortree_pyrobosim executor.launch.xmlIn another terminal, now you should be able to call:
ros2 action send_goal /pyrobosim_bt_action_server btcpp_ros2_interfaces/action/ExecuteTree "{target_tree: '<your-tree-name>'}"You can replace <your-tree-name> with Exercise0 to test it out.
Please note that the simulator must be started, otherwise the tree will take more time to load (ros2 srv and action will not be found and clients in the tree will timed out).
If you start:
- Simulator
- BTExecutor
- (optional) groot
and you launch the sample tree execution (with Exercise0 tree for instance), the result should look as in the image below.
Pro tip: You can open groot2 in monitor and check out the tree execution real-time by clicking on "Connect".
We thank Sebastian Castro for the amazing work on pyrobosim that we extensively have taken leverage of to prepare the material for this workshop.

