Examples
The Slamcore C++ API provides some examples to illustrate different use cases
and best practices, in addition to a minimal CMakeLists.txt
to show how to
include the library in a project.
Once the Slamcore package is installed, this example source code should be
available at /usr/src/slamcore/examples
by default.
A user can build them as follows:
mkdir /tmp/slamcore_examples
cd /tmp/slamcore_examples
cmake /usr/src/slamcore/examples
make
Find below a list of the included examples.
Example hello_world_all_streams.cpp:
Shows how to create and interact with the SLAM system. How to enable and use data streams, read properties and receive and display data in a loop.
-
Demonstrates how to obtain raw pixels from all image data streams.
-
Demonstrates how to generate a height and occupancy map in the form of raw pixels when the depth stream is provided.
-
Demonstrates how to run SLAM and obtain low-latency poses reported at the IMU rate.
Example measure_slam_performance.cpp:
Demonstrates how to measure system performance metrics such as frame rate, memory and CPU usage.
-
Demonstrates how to set up and run a SLAM system in multisession localisation mode, which means how to perform SLAM with an already saved session file from another execution of the software.
-
Demonstrates how to set up and run a pass-through SLAM system to record and save datasets while SLAM is running.
-
One restriction is that only one SLAM system can exist at any given time. If the user wishes to reset it to start processing a data source cleanly, the common practice is to delete the current system and create a new one.
Example save_load_session.cpp:
Demonstrates how to save a session using an async task and how to load it back.
-
Demonstrates how to run a SLAM system with wheel odometry fusion (visual-inertial-kinematics SLAM). Note that wheel odometry calibration is required, see Wheel Odometry Integration for more information.
-
Demonstrates how to generate a height and occupancy map in a text file (
.txt
) when the depth stream is provided. The file can be plotted for visualisation using the plot_map.py script. -
Demonstrates how to write and export trajectories into a CSV file. See Guide to Trajectories for more information.
The source code can be visited as part of this documentation.
- Example
ascii_image.cpp
- Example
ascii_mapping.cpp
- Example
hello_world_all_streams.cpp
- Example
high_rate_pose.cpp
- Example
measure_slam_performance.cpp
- Example
multisession.cpp
- Example
plot_map.py
- Example
plot_trajectory.py
- Example
record_dataset.cpp
- Example
reset.cpp
- Example
save_load_session.cpp
- Example
wheel_odometry.cpp
- Example
write_map.cpp
- Example
write_trajectory.cpp