Cartographer - Ros - Docker¶
Abstract
We provide a dockerized cartographer/ros stack for running a SLAM pipeline.
- Use
roverd rosbag
to convert rover data to a rosbag. - Run cartographer using
DATASET=... HEADLESS=true make lidar
.
Setup¶
-
Ensure docker is installed:
-
Install the Nvidia Container Toolkit:
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list sudo apt-get update sudo apt-get install -y nvidia-docker2 sudo systemctl restart docker
-
Test the install (may require a reboot, especially if
nvidia-smi
returns an error):Unable to load
libnvidia-ml
A common error is a failure from the
nvidia-container-cli
noting that it was unable to loadlibnvidia-ml
because ofno such file or directory
. This is caused by NVIDIA hating you, and the best fix seems to be to reinstalldocker.io
(i.e. the docker engine). If that does not work, reinstall everything else as well, which will typically resolve this issue.(Tianshu, 06/2024) - I suspect this may be caused by some kind of time issue affecting certificates, triggering automated invalidations/reinstalls/etc. This behavior was seen in our demo PC, which had CMOS battery issues. The immediate symptom was total failure of the Docker/Nvidia stack; additional indications include the system time being off and docker images being re-pulled each time instead of cached.
Usage¶
Manually Run Docker
These steps are taken care of by make docker-run
in collect
. Follow these steps for manual troubleshooting:
-
Ensure that X11 forwarding is correctly set (if this does not work, you may need to activate non-local X11 forwarding).
-
Run the container with the requisite NVIDIA driver arguments, the desktop env variable, and the link to the unix X11 "file".
sudo docker run -it --privileged --net=host --env=NVIDIA_VISIBLE_DEVICES=all --env=NVIDIA_DRIVER_CAPABILITIES=all --env=DISPLAY --env=QT_X11_NO_MITSHM=1 -v /tmp/.X11-unix:/tmp/.X11-unix qoschatz/cartographer_ros /bin/bash
Mount any desired folders by adding
NOTE: Pipe all processing results to a mounted directory to prevent outputs from being deleted when the docker container stops running.
The provided makefile assumes that there is a data
folder (possibly symlinked) in the red-rover/processing
directory, and that rosbags are already created using roverd rosbag
. We provide the following commands:
make trajectory
: compute poses.make lidar
: compute poses and output globally-aligned point clouds.validate
: alias forcartographer_rosbag_validate
.info
: alias forrosbag info
.
The following arguments are passed via environment variables:
DATASET
: path to dataset, relative to the/data
directory.-
HEADLESS
: whether to run cartographer in headless mode.Tip
Use
HEADLESS=true
for unattended or remote operation.