How to SLAM with LidarView ?

This document presents some tips on how to use SLAM algorithm in LidarView, or one of its derived distribution. Even if this SLAM is embedded in a Paraview plugin and is therefore directly usable in Paraview, we will focus on its use in LidarView (as we consider here LiDAR data, LidarView seems a better choice for most use-cases and display).

Since 2020, this SLAM plugin is natively included and available in LidarView.

Installing LidarView or one of its derivative with SLAM support

Pre-built binaries of LidarView with this SLAM plugin are available for download here.

As these binaries may not always be up-to-date with the latest SLAM release, you may want to compile LidarView with SLAM support from source. Follow LidarView's Developer Guide instructions to build LidarView on Windows or Linux.

IMPORTANT: to enable SLAM support, ensure your CMake configuration has these options set to True :

-DENABLE_ceres=True
-DENABLE_nanoflann=True
-DENABLE_pcl=True
-DENABLE_slam=True 

LidarSlamPlugin should be automatically loaded at LidarView's startup. If not, ensure Advanced features are enabled (in Help or Tools > Debugging), then select Advance > Tools > Manage Plugins > Load New. Browse to your LidarView install directory and select the libLidarSlamPlugin.so / LidarSlamPlugin.dll (this file can normally be found under <lv_build>/install/lib/plugins/ on Linux or <lv_build>/install/bin/plugins/ on Windows).

Using SLAM in LidarView

LidarView's SLAM has been tested on .pcap files aquired from several common LiDAR sensors including:

Please note that your default LidarView application may not include all the vendors-specific interpreters to decode all these LiDAR sensors data.

  1. Open LidarView. Make sure Advanced Features are enabled in Help tab.

    Note : In some LidarView applications, this option is available under Tools tab > Debugging.

    Enable advance feature

  2. Under Views tab, enable Pipeline Browser and Properties.

    Enable views panels

  3. Open a previously recorded .pcap file (or set up a stream source) associated with its LiDAR calibration file.

  4. In Pipeline browser, select Frame (the pointcloud source). Then click on Filters tab > Alphabetical > SLAM. Select a SLAM filter: pick SLAM (online) to perform a real-time test with live display, or SLAM (offline) for a full process, displaying only final trajectory and maps.

    Tip : After having selected Frame , you can also hit Ctrl+space and then type slam in filter search bar.

    Create SLAM filter

  5. Depending on the SLAM version being used, a new input dialog may appear:

    Note: In some SLAM versions, this calibration is optional, and is not asked by this dialog.

    Select SLAM filter inputs

  6. Under Properties panel, modify the parameters if needed (see section SLAM parameters tuning), then hit Apply.

  7. You're all done! Now, you can modify the display settings to fit your needs (e.g. color pointclouds using intensity field, modify the points size, hide/show some SLAM outputs, ...).

Saving and exporting SLAM outputs

Once SLAM has completed, it could be useful to save some results for later use.

Saving trajectory

You can export the trajectory (for example as a .csv or .poses file) to avoid running the SLAM again. To save it, select the Trajectory output in the Pipeline Browser panel, then hit Ctrl+s (or Advance tab > File > Save Data), and choose the output format and name in the dialog window.

Later, to load the trajectory back in LidarView, you can drag and drop the .poses file in LidarView, or Advance tab > File > Open.

Saving keypoint maps

Keypoint maps are the local downsampled aggregations of registered keypoints from previous frames. It provides a nice light-weight insight of the reconstructed scene, and helps supervising or interpreting the SLAM behavior and results.

To save SLAM keypoints maps, select the map output you want to save in the Pipeline Browser panel, then hit Ctrl+s (or Advance tab > File > Save Data), and choose the output format and name in the dialog window. Common pointclouds formats are csv, pcd, las, ply or vtp.

Saving aggregated frames

If the visualization of the maps isn't enough for your application, and you need to aggregate all points from all previous frames, this is possible too, but less straightforward.

There are two ways to export aggregated scans:

Aggregate scans then visualize and export them

Note: Be careful, the aggregation of ALL previous points may represent a huge pointcloud! With ~1 000 000 points per second and the associated measurements (intensity, time, laser ID, etc.), each minute of recording represents several GB of data! Depending on your machine specifications, this may not fit into memory and lead to an annoying crash of the application.

To visualize all frames as a single aggregated pointcloud, you need to instanciate several filters to aggregate all scans using the computed trajectory (sensor path estimated by SLAM):

  1. Select the Trailing frame entry and set the desired number of trailing frames (0 meaning only the last frame, and, for example, 10 displaying the current frame and the 10 previous ones). Be careful, a big number of trailing frames may lead to important processing duration and memory consumption. Click on Apply. You should now see all the frames aggregated in a non-sense way (all points being displayed using their coordinates relative to the sensor at the time of acquisition).

  2. Instantiate a Temporal Transform Applier filter using the Trailing Frame as point cloud entry, and the output SLAM Trajectory for trajectory entry. Depending on the number of trailing frames, the transformation and aggregation of pointclouds may be long. When it succeeds, you should now see all points being correctly registered. If the colors look strange, check that you are displaying the intensity array in the main toolbar.

Aggregated frames

These first steps allow you to visualize all the aggregated points in LidarView. If you want to optionally downsample this point cloud and save it on disk, please follow these additional steps:

  1. Instantiate a Merge Blocks filter on the output of the Temporal Transform Applier.

    If you want to subsample the aggregated pointcloud by merging close points, make sure that the advanced properties of the filter are enabled by toggling the little gear wheel in the Properties panel. You can then specify the Tolerance and Tolerance Is Absolute parameters. For example, to aggregate all points but keeping only a single point per 5 cm cube, set Tolerance to 0.05 and enable Tolerance Is Absolute.

    Click on Apply. The process can take some seconds. When it has finished, all points are now merged into a single (optionally downsampled) pointcloud.

  2. Instantiate an Extract Surface filter on the ouput of the Merge Blocks. This will convert the underlying structure of the pointcloud, allowing more available filters or file types for storage.

  3. As usual, save aggregated frames by selecting the desired output Extract Surface, hit Ctrl+s, and choose the output format (CSV, PLY, VTP) and name.

Directly aggregate all points in a LAS file

This method directly appends points to a LAS file on disk, which has the advantage to avoid saturating the RAM.

  1. Save the SLAM trajectory on disk as a .poses CSV file.

  2. Open a new LidarView session, then load your pcap recording. Load the previously exported SLAM trajectory using Advance > File > Open.

  3. Instantiate a Temporal Transform Applier filter using the Frame as point cloud entry, and the output SLAM Trajectory for trajectory entry.

  4. Save the output of the Temporal Transform Applier by hitting Ctrl+s, selecting the LAS point cloud file format, and specifying the output file name before validating. A new dialog will appear to configure the LAS file writer, where you can modify the parameters to your needs. For example, if you want to aggregate points from frame 100 to 500, but using only points from 1 frame out of 3, specify First Frame = 100, Last Frame = 500, Frame Stride = 3. The export can be quite long (from a few seconds to several minutes) as each specified frame needs to be processed.

SLAM parameters tuning

The default SLAM parameters should be a good compromise to run the SLAM for most outdoor urban environments with the LiDAR sensor mounted on top of a vehicle. However, the parameters should be adapted to your specific needs or environment to have an optimal result.

Note: To see all parameters, make sure that the advanced properties of the SLAM filter are enabled by toggling the little gear wheel in the Properties panel.

Here are some hints to help you tune some of the main parameters. These are some typical parameters preset to consider depending on your dataset characteristics.

Environment type

The type of environment influences a lot the number and quality of extracted keypoints. A feature-poor scene will need more and denser keypoints to give nice results. However, we want to keep this number of keypoints as small as possible to reduce memory consumption and problem dimensionality.

Mobile platform carrying the LiDAR sensor

The type of the mobile platform has a great impact on the motion model, or in other words, how we estimate and compensate the motion since the previous scan. Smooth motions will be much easier and lead to more stable results (as it provides continuous and approximately constant speed motion hypothesis to interpolate new pose), whereas high-frequency motions or fast moving platforms will be less robust.

Increasing the processing speed

To increase the processing speed, consider also tweaking these parameters: