├── .colcon
├── build
│ └── .gitkeep
├── log
│ └── .gitkeep
└── install
│ └── .gitkeep
├── tb_autonomy
├── python
│ └── tb_behaviors
│ │ ├── __init__.py
│ │ ├── vision.py
│ │ └── navigation.py
├── package.xml
├── bt_xml
│ ├── nav_tree_naive.xml
│ ├── nav_tree_queue.xml
│ ├── tree_queue.xml
│ └── tree_naive.xml
├── include
│ ├── vision_behaviors.h
│ └── navigation_behaviors.h
├── CMakeLists.txt
├── scripts
│ ├── test_move_base.py
│ ├── test_vision.py
│ └── autonomy_node.py
├── launch
│ ├── tb_demo_behavior_py.launch.py
│ └── tb_demo_behavior_cpp.launch.py
└── src
│ ├── vision_behaviors.cpp
│ ├── autonomy_node.cpp
│ └── navigation_behaviors.cpp
├── .gitignore
├── media
├── demo_screenshot_cpp.png
└── demo_screenshot_python.png
├── tb_worlds
├── maps
│ ├── sim_house_map.pgm
│ ├── sim_house_map.yaml
│ └── sim_house_locations.yaml
├── models
│ ├── red_block
│ │ ├── model.config
│ │ └── model.sdf
│ ├── sim_house
│ │ ├── model.config
│ │ └── model.sdf
│ ├── blue_block
│ │ ├── model.config
│ │ └── model.sdf
│ └── green_block
│ │ ├── model.config
│ │ └── model.sdf
├── CMakeLists.txt
├── package.xml
├── configs
│ ├── turtlebot3_bridge.yaml
│ ├── turtlebot4_bridge.yaml
│ └── nav2_params.yaml
├── launch
│ ├── block_spawner.launch.py
│ ├── turtlebot_spawner.launch.py
│ ├── tb_demo_world.launch.py
│ └── tb_world.launch.py
├── urdf
│ └── gz_waffle.sdf.xacro
└── worlds
│ └── sim_house.sdf.xacro
├── dependencies.repos
├── .env
├── docker
├── entrypoint.sh
├── run_docker.sh
└── Dockerfile
├── .github
└── workflows
│ └── docker.yml
├── LICENSE
├── .pre-commit-config.yaml
├── docker-compose.yaml
└── README.md
/.colcon/build/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.colcon/log/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.colcon/install/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tb_autonomy/python/tb_behaviors/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .colcon/
2 | .vscode/
3 | **/__pycache__/
4 |
--------------------------------------------------------------------------------
/media/demo_screenshot_cpp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sea-bass/turtlebot3_behavior_demos/HEAD/media/demo_screenshot_cpp.png
--------------------------------------------------------------------------------
/media/demo_screenshot_python.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sea-bass/turtlebot3_behavior_demos/HEAD/media/demo_screenshot_python.png
--------------------------------------------------------------------------------
/tb_worlds/maps/sim_house_map.pgm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sea-bass/turtlebot3_behavior_demos/HEAD/tb_worlds/maps/sim_house_map.pgm
--------------------------------------------------------------------------------
/tb_worlds/maps/sim_house_map.yaml:
--------------------------------------------------------------------------------
1 | image: sim_house_map.pgm
2 | mode: trinary
3 | resolution: 0.05
4 | origin: [-2.07, -1.64, 0]
5 | negate: 0
6 | occupied_thresh: 0.65
7 | free_thresh: 0.25
8 |
--------------------------------------------------------------------------------
/tb_worlds/maps/sim_house_locations.yaml:
--------------------------------------------------------------------------------
1 | # Defines object locations as [x, y, theta]
2 | location1: [-1.0, -0.5, -2.25]
3 | location2: [0.5, 4.0, 0.785]
4 | location3: [4.0, 0.5, 1.571]
5 | location4: [2.75, 2.5, -1.571]
6 |
--------------------------------------------------------------------------------
/dependencies.repos:
--------------------------------------------------------------------------------
1 | repositories:
2 | # Simulation and Nav2 support for TurtleBot robots
3 | nav2_minimal_turtlebot_simulation:
4 | type: git
5 | url: https://github.com/ros-navigation/nav2_minimal_turtlebot_simulation.git
6 | version: main
7 |
--------------------------------------------------------------------------------
/tb_worlds/models/red_block/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | red_block
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tb_worlds/models/sim_house/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | sim_house
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tb_worlds/models/blue_block/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | blue_block
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tb_worlds/models/green_block/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 | green_block
4 | 1.0
5 | model.sdf
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.env:
--------------------------------------------------------------------------------
1 | # Default environment variables for Docker Compose file
2 |
3 | # The ROS distribution to use (tested on Jazzy and Rolling)
4 | ROS_DISTRO=jazzy
5 |
6 | # TurtleBot model (3 or 4)
7 | TURTLEBOT_MODEL=3
8 |
9 | # Behavior tree type: Can be naive or queue.
10 | BT_TYPE=queue
11 |
12 | # Set to true to use vision, else false to only do navigation behaviors.
13 | ENABLE_VISION=true
14 |
15 | # Target color for vision: Can be red, green, or blue.
16 | TARGET_COLOR=blue
17 |
--------------------------------------------------------------------------------
/tb_worlds/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.22)
2 | project(tb_worlds)
3 |
4 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5 | add_compile_options(-Wall -Wextra -Wpedantic)
6 | endif()
7 |
8 | # Find dependencies
9 | find_package(ament_cmake REQUIRED)
10 | find_package(rclpy REQUIRED)
11 | find_package(geometry_msgs REQUIRED)
12 | find_package(nav2_minimal_tb3_sim REQUIRED)
13 | find_package(nav2_minimal_tb4_sim REQUIRED)
14 |
15 | # Install directories
16 | install(DIRECTORY
17 | launch maps models worlds urdf configs
18 | DESTINATION share/${PROJECT_NAME}
19 | )
20 |
21 | ament_package()
22 |
--------------------------------------------------------------------------------
/docker/entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Basic entrypoint for ROS Docker containers
3 |
4 | # Source ROS 2
5 | source /opt/ros/${ROS_DISTRO}/setup.bash
6 | echo "Sourced ROS 2 ${ROS_DISTRO}"
7 |
8 | # Source the base workspace, if built
9 | if [ -f /turtlebot_ws/install/setup.bash ]
10 | then
11 | source /turtlebot_ws/install/setup.bash
12 | echo "Sourced TurtleBot base workspace"
13 | fi
14 |
15 | # Source the overlay workspace, if built
16 | if [ -f /overlay_ws/install/setup.bash ]
17 | then
18 | source /overlay_ws/install/setup.bash
19 | echo "Sourced autonomy overlay workspace"
20 | fi
21 |
22 | # Execute the command passed into this entrypoint
23 | exec "$@"
24 |
--------------------------------------------------------------------------------
/tb_worlds/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | tb_worlds
4 | 0.0.0
5 | Simple world examples for TurtleBot simulation.
6 |
7 | Sebastian Castro
8 | MIT
9 |
10 | ament_cmake
11 |
12 | rclpy
13 | geometry_msgs
14 | nav2_bringup
15 | nav2_minimal_tb3_sim
16 | nav2_minimal_tb4_sim
17 | rviz2
18 |
19 |
20 | ament_cmake
21 |
22 |
23 |
--------------------------------------------------------------------------------
/docker/run_docker.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Sample script to run a command in a Docker container
3 | #
4 | # Usage Example:
5 | # ./run_docker.sh turtlebot_behavior:overlay "ros2 launch tb_worlds tb_demo_world.launch.py"
6 |
7 | # Define Docker volumes and environment variables
8 | DOCKER_VOLUMES="
9 | --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
10 | --volume="${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority" \
11 | "
12 | DOCKER_ENV_VARS="
13 | --env="TURTLEBOT_MODEL=3" \
14 | --env="DISPLAY" \
15 | --env="QT_X11_NO_MITSHM=1" \
16 | --env="NVIDIA_DRIVER_CAPABILITIES=all" \
17 | "
18 | DOCKER_ARGS=${DOCKER_VOLUMES}" "${DOCKER_ENV_VARS}
19 |
20 | # Run the command
21 | docker run -it --net=host --ipc=host --privileged ${DOCKER_ARGS} "$1" bash -c "$2"
22 |
--------------------------------------------------------------------------------
/.github/workflows/docker.yml:
--------------------------------------------------------------------------------
1 | name: build_docker
2 |
3 | on:
4 | # Run action on certain pull request events
5 | pull_request:
6 | types: [opened, synchronize, reopened, ready_for_review]
7 |
8 | # Nightly job on default (main) branch
9 | schedule:
10 | - cron: '0 0 * * *'
11 |
12 | # Whenever certain branches are pushed
13 | push:
14 | branches: [main, humble]
15 |
16 | # On demand from github.com for testing
17 | workflow_dispatch:
18 |
19 | jobs:
20 | # Build docker images
21 | docker:
22 | runs-on: ubuntu-latest
23 | steps:
24 | - name: Check out repository
25 | uses: actions/checkout@v4
26 | - name: Set up Docker Buildx
27 | uses: docker/setup-buildx-action@v3
28 | - name: Build and push
29 | uses: docker/build-push-action@v5
30 | with:
31 | file: docker/Dockerfile
32 | push: false
33 |
--------------------------------------------------------------------------------
/tb_autonomy/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | tb_autonomy
4 | 0.0.0
5 | Simple autonomy examples for TurtleBot
6 |
7 | Sebastian Castro
8 | MIT
9 |
10 | ament_cmake
11 | ament_cmake_python
12 |
13 | rclpy
14 | rclcpp
15 | rclcpp_action
16 | ament_index_cpp
17 | behaviortree_cpp
18 | nav2_msgs
19 | py_trees_ros
20 | py_trees_ros_viewer
21 | sensor_msgs
22 | tb_worlds
23 | tf2
24 | tf2_ros
25 | tf2_geometry_msgs
26 | yaml-cpp
27 |
28 |
29 | ament_cmake
30 |
31 |
32 |
--------------------------------------------------------------------------------
/tb_worlds/models/red_block/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0 0 0.05 0 0 0
5 | true
6 |
7 |
8 | 1.0
9 |
10 | 0.01
11 | 0.0
12 | 0.0
13 | 0.01
14 | 0.0
15 | 0.01
16 |
17 |
18 |
19 |
20 |
21 | 0.1 0.1 0.1
22 |
23 |
24 |
25 |
26 |
27 |
28 | 0.1 0.1 0.1
29 |
30 |
31 |
32 | 0.8 0.0 0.1 1
33 | 0.8 0.0 0.2 1
34 | 0 0 0 0
35 | 0 0 0 1
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021-2024 Sebastian Castro
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/tb_worlds/models/blue_block/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0 0 0.05 0 0 0
5 | true
6 |
7 |
8 | 1.0
9 |
10 | 0.01
11 | 0.0
12 | 0.0
13 | 0.01
14 | 0.0
15 | 0.01
16 |
17 |
18 |
19 |
20 |
21 | 0.1 0.1 0.1
22 |
23 |
24 |
25 |
26 |
27 |
28 | 0.1 0.1 0.1
29 |
30 |
31 |
32 | 0.0 0.0 0.8 1
33 | 0.0 0.0 0.8 1
34 | 0 0 0 0
35 | 0 0 0 1
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/tb_worlds/models/green_block/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0 0 0.05 0 0 0
5 | true
6 |
7 |
8 | 1.0
9 |
10 | 0.01
11 | 0.0
12 | 0.0
13 | 0.01
14 | 0.0
15 | 0.01
16 |
17 |
18 |
19 |
20 |
21 | 0.1 0.1 0.1
22 |
23 |
24 |
25 |
26 |
27 |
28 | 0.1 0.1 0.1
29 |
30 |
31 |
32 | 0.0 0.7 0.0 1
33 | 0.0 0.7 0.0 1
34 | 0 0 0 0
35 | 0 0 0 1
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/tb_autonomy/bt_xml/nav_tree_naive.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/tb_autonomy/include/vision_behaviors.h:
--------------------------------------------------------------------------------
1 | // Vision behaviors for TurtleBot
2 |
3 | #include