Containerizing OpenVSLAM for Visual SLAM Development on Windows
System Preparation and Docker Installation
To establish a Visual SLAM (VSLAM) development environment on Windows 10, the first step involves enabling hardware virtualization and the Docker engine.
- Navigate to Control Panel > Programs > Turn Windows features on or off and ensure Hyper-V is enabled.
- Install Docker Desktop for Windows. After installation and a system reboot, verify the installation via the terminal:
docker version
To improve download speeds in certain regions, configure a registry mirror in the Docker Desktop settings under "Docker Engine" by adding the desired mirror URL to the registry-mirrors array.
Building the OpenVSLAM Image
Once Docker is operational, clone the OpenVSLAM repository and navigate to its root directory. Use the provided Dockerfile to build the desktop-compatible image. You can pass build arguments to optimize the compilation process:
docker build -t vslam-desktop-env -f Dockerfile.desktop --build-arg NUM_THREADS=8 .
Configuring X11 Forwarding for GUI Applications
Since Docker containers on Windows do not natively support graphical output, an X11 server is required to view the VSLAM visualization. Applications like VcXsrv or Cygwin/X can be used.
Set the dissplay environment variable and allow local connections. If using a terminal like Git Bash or Cygwin, configure the host IP access:
export DISPLAY=192.168.1.100:0.0
xhost +192.168.1.100
Launch the container with the display environment variable and volume mounting for data persistence:
docker run -it --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-v C:/Datasets/vslam_data:/data \
vslam-desktop-env
Executing SLAM Modules
Inside the container, you can run various SLAM tasks such as tracking, mapping, and localization. Ensure you have the ORB vocabulary file (orb_vocab.dbow2) and the necessary dataset configuration files.
Video-based SLAM
./run_video_slam \
-v ./vocab/orb_vocab.dbow2 \
-m ./sample_video/clip.mp4 \
-c ./sample_video/config.yaml \
--frame-skip 2 \
--map-db output_map.msg
Localization Mode
./run_video_localization \
-v ./vocab/orb_vocab.dbow2 \
-m ./sample_video/clip.mp4 \
-c ./sample_video/config.yaml \
--map-db output_map.msg
EuRoC Dataset Processing
./run_euroc_slam \
-v ./vocab/orb_vocab.dbow2 \
-d ./mav0/ \
-c ./configs/euroc_mono.yaml
Using the Web-based SocketViewer
If direct X11 forwarding is unstable, OpenVSLAM supports a web-based viewer using WebSockets. This requires building a specific server and client image.
Build the server and the socket-enabled application:
# Build the viewer server
docker build -t vslam-server -f Dockerfile.server .
# Build the SLAM engine with socket support
docker build -t vslam-socket -f Dockerfile.socket .
Run the server instance first:
docker run --rm -it --name vslam-web-server --net=host vslam-server
Run the SLAM engine in a separate terminal. The visualization will be accessible via http://localhost:3001/.
Essential Docker Management Commands
Manage your environment with these standard operations:
- List active containers:
docker ps - Stop a container:
docker stop [CONTAINER_ID] - Remove an image:
docker rmi [IMAGE_ID] - Interactive shell:
docker run -it [IMAGE_NAME] /bin/bash - Port Mapping:
docker run -p 8080:80 [IMAGE_NAME]
Compiling Pangolin Dependencies
For custom builds outside of the pre-configured Docker environment, Pangolin is a critical dependency for visualization. Install it using the following steps:
# Install dependencies
sudo apt-get update
sudo apt-get install libglew-dev cmake libboost-dev libboost-thread-dev libboost-filesystem-dev
# Build Pangolin
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build && cd build
cmake -DCPP11_NO_BOOST=1 ..
make -j$(nproc)