Template for Dockerized ROS2 (Humble) (base image: humble-desktop-full, which is on Ubuntu 22.04).
Container runs XFCE lightweight desktop env and can interact from host machine via Xvfb virtual server and x11vnc.
Preinstalled:
- everything in
humble-desktop-full, soros2Gazebois part of this, but it's the "Ignition" version! The command to open isign gazebo(without ROS) orros2 launch ros_gz_sim gz_sim_launch.py(with ROS).- I believe
gazeboorgzclientcommands are for older versions (Gazebo Classic), whilegz simis for newer versions (Gazebo Harmonic +?).
- code (start with
code &, or in Applications > Development)
Inspired(?) by:
- https://medium.com/@oelmofty/ros2-in-docker-why-and-how-b72b3880dc97
- https://github.com/jbnunn/ROSGazeboDesktop
-
docker build -t ros-humble-template . -
docker run --name ros-humble -d -p 5900:5900 ros-humble-template- All servers (Xvfb, x11vnc) will automatically run in the background.
- How to pause:
docker stop ros-humble - How to restart:
docker start ros-humble- you might have to wait a few secs to reconnect
-
View on host machine with one of these methods:
- RealVNC (
localhost:5900) - OR (
vnc://localhost:5900) Mac's Screen Sharing application, as of Ventura 13.5.2 on 2019 Macbook Pro. Any of these methods:- Browser --> redirect to Screen Sharing
- Finder, Go > Connect to server
- Open app directly in
System/Library/CoreServices/Applications/Screen Sharing
- RealVNC (
-
Follow this to set up ROS2 env.
-
Profit 📈
- Restarting container runs
start.shagain, and this will clean up any old X files if server didn't properly end. Then spins up all servers again, and you can reconnect! x11vncwas chosen instead ofTigerVNCbecause TigerVNC starts its own X server (Xtigervnc) by default.x11vnc's-nopwflag means there's no password, so...it's insecure :)- Unsure exactly why port
5900is chosen by default, since I thought having the display to:1would mean default port becomes5901. But it's working fine so far, so I haven't looked into it. - stdout and stderr of Xvfb, x11vnc, and XFCE are redirected to log files in
/tmp. net-toolsinstallation is just there for debugging.xdg-utilsfor VS Code installation, for some reasondbus-x11 x11-xserver-utils libgl1-mesa-glx libgl1-mesa-driare extra utils for the X server and for rendering Gazebo's Qt GUI.- (
libgl1-mesa-glxis replaced withlibgl1for newer Ubuntu versions (24.04))
- (
- GPG Keyring issues?!?!??!! I can't
apt installany packages???- Look here: https://discourse.ros.org/t/ros-signing-key-migration-guide/43937/7
- key expires June 1..........which I found out on June 1...