Authors: Juan J. Gómez Rodríguez, Víctor M. Batlle
Minimal implementation of a SLAM system for the practical assignment of the SLAM course.
Install Docker using your preferred method. If you are not sure where to start, below are some recommended options depending on your host operating system:
- Windows or macOS: Docker Desktop
- Linux: Docker CE/EE and Docker Compose
Install Visual Studio Code on your host machine.
Windows (using VcXsrv)
- Install an X server like VcXsrv
- Start it with:
- Set display number to
:0; - Uncheck
Native opengl; - Check
Disable access control;
- Set display number to
Windows (using WSL2)
- Open PowerShell as administrator (search for "PowerShell", right-click, and select Run as administrator).
- Run
wsl --install. - In Docker Desktop, go to
Settings>Resources>WSL Integrationand enable it. - Replace
.devcontainer/devcontainer.windows.jsonby.devcontainer/devcontainer.wsl2.jsonbefore opening VS Code.
macOS (using XQuartz)
- Open a Terminal on your macOS host.
- Run
brew install --cask xquartz(if you do not have Homebrew installed, see instructions here). - Run
open -a XQuartz. - Go to
XQuartz>Settings...>Securityand ensure Allow connections from network clients is enabled. - Reboot your computer.
Clone this repository:
git clone https://github.com/universidad-zaragoza/Mini-SLAM.gitLaunch VS Code and go to File > Open Folder..., then select your Mini-SLAM folder.
Click on Yes, I trust the authors when prompted.
On start-up, VS Code will copy the corresponding devcontainer.[windows|linux|darwin].json to .devcontainer/devcontainer.json.
You might need to do that manually if the automatic copy fails.
Click Install to add the recommended VS Code extensions.
If you do not get this prompt, you may have already installed all the recommended extensions.
Click Reopen in Container. The first time you do this, it may take up to an hour to set up the container, depending on your machine.
If you do not get this prompt, you can click the bottom-left corner (Open a Remote Window) and select
Reopen in Container.
From now on, every time you open your Mini-SLAM folder in VS Code, you can immediately choose Reopen in Container from the pop-up or via the connect menu in the bottom-left corner:
You can follow the steps provided in the SLAM course handout for each lab and run everything from the terminal. However, this section explains how to make full use of VS Code’s debugging capabilities for your applications (highly recommended).
In the CMake menu, use Build All Projects and Set the Launch/Debug Target (right-click) for each lab. To define new targets in the future, edit CMakeLists.txt inside the Apps/ folder:
set(PROGRAM_NAME mono_tumrgbd)
add_executable(${PROGRAM_NAME} mono_tumrgbd.cc)
target_link_libraries(${PROGRAM_NAME} ${OpenCV_LIBS} mini_slam)First, download the datasets required for each lab (example fr1_xyz) and place the uncompressed folders inside Datasets/. Then, run the app from VS Code Run > Start Debugging.
If you are unfamiliar with using VS Code for debugging, take a look at the guide Debug code with Visual Studio Code. Skip the video (it is too long) and just read how to start a debug session, set breakpoints, and perform data inspection.
We already provide two example launch configurations in .vscode/launch.json.
You should see two windows similar to the following:
When you are done developing your application, go to the CMake menu and change the Configure setting from Debug to Release. Rebuild and run your target.
-
If you encounter an
error while loading shared libraries, try runningsudo ldconfigbefore executing your application. -
To execute the SLAM system frame by frame, go to
MiniSLAM.ccand uncomment the following lines:// Uncomment for step by step execution (pressing the Esc key) while ((cv::waitKey(10) & 0xEFFFFF) != 27) { mapVisualizer_->update(); }