Summary
Run Nav2 quickstart inside Docker
Why
- Reduce setup steps by getting ROS pre-installed
- Develop navigation applications in the safety of an isolated Docker environment
- Encourage development with ease of use
Specs
- Nav2
- ROS galactic Geochelone [switched from Humble for stability]
- tested on Ubuntu 20.04
Steps
- Get docker image. Test that it’s working with this example
1
docker pull osrf/ros:galactic-desktop
- Connect docker to linux display
1 2
export DISPLAY=:0.0 xhost +local:docker
- Run docker
1
docker run -it --net=host --device /dev/dri/ -e DISPLAY=$DISPLAY -v $HOME/.Xauthority:/root/.Xauthority:ro osrf/ros:galactic-desktop
- Install nav2
1 2 3 4
apt update apt install ros-galactic-navigation2 -y apt install ros-galactic-nav2-bringup -y apt install ros-galactic-turtlebot3* -y
- Load ROS environment variables
1 2 3
source /opt/ros/galactic/setup.bash export TURTLEBOT3_MODEL=waffle export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/galactic/share/turtlebot3_gazebo/models
- Run navigation example
1
ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False
- [Optional] Add workspace tools
1 2
apt install vim -y apt install tmux -y
- Save progress to workspace
1 2 3
# in a separate terminal docker ps docker commit 3204cbea0e30 osrf/ros:galactic-desktop-nav2
Fixes for common errors
[ERROR] [rviz2-5]: process has died [pid 75, exit code -11, cmd '/opt/ros/galactic/lib/rviz2/rviz2 -d /opt/ros/galactic/share/nav2_bringup/rviz/nav2_default_view.rviz --ros-args']
- Run the following:
1 2
export DISPLAY=:0.0 xhost +local:docker
Error: Non-unique names detected in type collision in <link name='camera_link'>
- reinstall turtlebot packages
1 2
apt remove --purge ros-galactic-turtlebot3* apt install ros-galactic-turtlebot3* -y