Minimal example ROS2 project to use Navigation2 with (Ignition) Gazebo. Based on the official Gazebo Classic example: tutorial, code
gz-nav2-tb3.webm
- ROS 2 Humble
- Gazebo Fortress
- Navigation 2
# Install Nav2 dependencies
sudo apt install ros-humble-navigation2 ros-humble-nav2-bringup
# Import source dependencies
pip3 install vcstool
vcs import --input deps.repos src
# Install rosrep dependencies
rosdep install -y -r -i --from-paths .
# Make sure ROS2 is sourced (assuming bash, please replace extension as needed)
source /opt/ros/humble/setup.bash
# Build
colcon build
# Make sure the app is sourced (assuming bash, please replace extension as needed)
source install/setup.bash
# Launch Gazebo, RViz, and Navigation2
ros2 launch sam_bot_nav2_gz complete_navigation.launch.py
# Set goal poses in RViz or run a navigation example:
ros2 run sam_bot_nav2_gz follow_waypoints.py
ros2 run sam_bot_nav2_gz reach_goal.py
# Start one of the tests with
launch_test src/sam_bot_nav2_gz/test/test_bringup.launch.py
launch_test src/sam_bot_nav2_gz/test/test_reach_goal.launch.py
launch_test src/sam_bot_nav2_gz/test/test_follow_waypoints.launch.py
- Set up a new Artefacts CI project. Instructions: https://docs.artefacts.com/latest/
- Replace the project name in the
artefacts.yaml
with the name of your project
# Run test locally
artefacts run all
# Run test remotely
artefacts run-remote all --description "Test Navigation2"
# Run test locally with Docker
docker build -t nav2-gz .
# ARTEFACTS_KEY can be generated at the project-settings page of the Artefacts CI dashboard
docker run --rm -e ARTEFACTS_JOB_NAME=all -e ARTEFACTS_KEY=${ARTEFACTS_KEY} nav2-gz
For more info, see: https://www.rerun.io/docs/howto/ros2-nav-turtlebot
cd rerun
# create a virtual env and install dependencies
python3 -m venv rr-venv
source rr-venv/bin/activate
pip install -r requirements
# Run rerun node
python run-rerun.py