Running SLAM with a live Ouster sensor or using a pre-recorded dataset is simple and convenient using the Ouster python SDK. Ouster SDK
SLAM is a technique used to create a map of the surroundings while simultaneously determining a position within that map. We use SLAM to determine the Ouster lidar’s movement trajectory, correct for motion distortion and reconstruct a detailed and precise point cloud map.
Q: I have used the SDK to run SLAM on a previously recorded dataset to create a map, but the results are not as accurate as I had expected. Is there a way to improve the resultant map quality?
Yes! There are a few parameters that can be “tuned” to improve the results over the default parameters.
Note: The default settings for the SLAM algorithm have been selected to provide a good balance between accuracy and computational overhead for a broad array of use cases and needs.
The options available to tune the SLAM algorithm include:
1. max-range (default = 150.0 m)
2. min-range (default = 0.0 m)
3. voxel-size (default = auto-calculated using 1st 10 frames)
Of the 3 parameters available, voxel-size
is the most likely to have the largest impact on the SLAM outcome.
Here are some general recommendations for voxel-size
based on the use case.
Outdoor: 1.4 - 2.2
Large indoor: 1.0 - 1.8
Small indoor: 0.4 - 0.8
The above serve as guidelines only. You can adjust the parameter based on your needs.
Note: The performance of the SLAM algorithm depends on your CPU’s processing power and the ‘voxel_size’ parameter.
Below examples using the same data with different voxel-size
values.
If you look closely, you can see the impact on the “straightness” of the trajectory when the voxel-size is smaller:
voxel-size = 1.8
voxel-size = 0.5
The impact on the CPU is also noticeable for a smaller voxel-size
:
voxel-size = 1.8
voxel-size = 0.5
The values provided for maximum range and minimum range are used to limit or filter out measurements above (max-range
) or below (min-range
) the given values. In some scenarios, you may want to eliminate nearby measurements (min-range
) from the map due to portions of the vehicle always in the scene. In other cases, measurements past the max-range
may be unnecessary for the use case, so lowering this value may allow for improved processing times.
Let’s try it out!
To run SLAM, there are a number of approaches, however, for non-power users, the simplest method to get up and running quickly is by using Ouster’s command-line-interface (CLI). [SLAM Command]
Execute the following commands in a terminal (which includes the customized tuning parameters):
- SLAM live sensor or PCAP and save as OSF
ouster-cli source <SENSOR_HOSTNAME> / <FILENAME> slam <SLAM parameters> viz --accum-num 20 save sample.osf
For example:
ouster-cli source ~/Downloads/OS0_128_capture.pcap slam --voxel-size 0.9 viz --accum-num 20 save sample.osf
- Use the generated OSF to visualize the overall map view (with poses)
ouster-cli source sample.osf viz --accum-num 20 \
--accum-every 0 --accum-every-m 10.5 --accum-map -r 1 -e stop
And the results! Extremely rewarding!