Warde is a fully-integrated ROS 2-based behavior tree demo that autonomously roams, finds beer cans, picks them up, and places them into a drop-box. It leverages Gazebo simulation, BehaviorTree.CPP, ROS 2 actions/services, and a simple tagging mechanism to avoid revisiting the same target.
- Ubuntu 22.04 LTS
- ROS 2 Humble Hawksbill (desktop)
- Docker & Docker Compose (optional, for containerized runs)
colconbuild tools
# Setup locale
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
# Add ROS 2 repo and keys
sudo apt update && sudo apt install -y curl gnupg2 lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2.list'
sudo apt update
# Install ROS 2 Humble (Desktop)
sudo apt install -y ros-humble-desktop
# Install build tools and dependencies
sudo apt install -y python3-colcon-common-extensions python3-rosdep
# Initialize rosdep
sudo rosdep init
rosdep updateLoad ROS 2 environment in your ~/.bashrc:
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
source ~/.bashrccd ~/Desktop/MCE550/warde
# Ensure 'src/' contains: robot_description, spawn_tools, warde_bt, etc.
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install
source install/setup.bashWe provide a single launch file to start Gazebo + RViz, the nav server, both spawners, and the behavior tree:
ros2 launch warde_bt launch_all.launch.py world:=$(ros2 pkg prefix robot_description)/models/myWorld/boxes_world.sdf use_sim_time:=true rviz_config_file:=$(ros2 pkg prefix robot_description)/rviz/sim.config.rvizBehind the scenes, this does:
ros2 launch robot_description launch_sim.launch.py ...ros2 run robot_nav navigate_noderos2 run spawn_tools spawn_box_noderos2 run spawn_tools spawn_beer_noderos2 run warde_bt warde_bt_main
- Wandering mode: random exploration when no beer is found or after placement.
- Beer detection: TF-listener scans
/tffor frames namedbeer*. - Closest-beer selection: picks the nearest beer frame.
- Tagged beers: once collected, beer frames get “tagged” and ignored on future loops.
- Precise approach: robot stops 1 m from beer or from the front face of the box.
- Behavior Tree: mission sequence built with BehaviorTree.CPP:
ConditionBoxPresent,ConditionBeerPresentActionGetClosestBeer,ActionNavigate,ActionManipulate- Fallback to wandering on any failure, loop indefinitely.
-
Build the Docker image:
docker build -t warde_ws:humble . -
Run it (with X11 forwarding & host networking):
xhost +local:root docker run -it --rm --net=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix warde_ws:humble -
Alternatively, build and start all services with Docker Compose:
xhost +local:root && docker-compose up --build
You can call any ROS 2 service running in the container directly from your host shell or by opening a shell inside the container.
Make sure you have sourced the workspace overlay on your host so ROS 2 recognizes your custom packages:
cd ~/Desktop/MCE550/warde
source install/setup.bash
ros2 service list
ros2 service call /spawn_beer spawn_tools/srv/SpawnBeer "{entity_name: 'beer2', x: 2.0, y: 3.0, z: 0.25}"docker exec -it warde_ws bash
source /ros2_ws/install/setup.bash
ros2 service list
ros2 service call /spawn_box spawn_tools/srv/SpawnBeer "{entity_name: 'box1', x: 0.0, y: 0.0, z: 0.0}"- Keep ROS 2 packages minimal and declare all
<depend>tags - Use
--symlink-installfor faster dev cycles - Lock Gazebo/ROS versions in Docker for reproducibility
- Write small, single-purpose Behavior Tree nodes
- Handle service timeouts and failures gracefully
- Version-control all your launch and config files
Enjoy building and wandering with WARDE!

