# SLAM Lidar Processing

## Basic SLAM workflow

1. If using a RECON system, open one of the DATA files. SpatialExplorer will detect the other associated DATA files, and then will proceed to extract lidar, imagery, and navigation data.
2. Open the PLP file. After opening the PLP file, [select a CRS](https://docs.phoenixlidar.com/spatialexplorer-8-and-9/user-interface/windows/project-setup) for the project.
3. If you have a multi-sensor system (such as the RangerFLEX mobile system), [disable all lidar records](https://docs.phoenixlidar.com/spatialexplorer-8-and-9/user-interface/windows/project/rover/lidars/lidar-acquisition-settings) not associated with the SLAM sensor (Hesai).&#x20;
4. (optional) For the most accurate georeferencing, add a CG file to the project via File->Open. If you do not have a CG file, you can create one via either [InertialExplorer](https://docs.phoenixlidar.com/3rd-party-software-documentation/inertialexplorer-desktop-8.70-8.90-processing), [NavLab embedded](https://docs.phoenixlidar.com/spatialexplorer-8-and-9/user-interface/toolbars/workflow/navlab-embedded), or [NavLab via LiDARMill](https://docs.phoenixlidar.com/lidarmill-cloud/workflow/processing-tools/navlab-pipeline). If using NavLab embedded, select **Differential GNSS** as **Processing type,** and set the **Profile** to **Pedestrian**:

   <figure><img src="https://2222094320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdEevfLZRIk38LUPwDa4V%2Fuploads%2F5eP1S2DBvCjwueTBAmZp%2Fimage.png?alt=media&#x26;token=df8ab3d0-5eb4-4606-a630-fc7ff666f220" alt=""><figcaption><p>Processing type set to Differential GNSS - this will generate a combined GNSS file ONLY, and will disregard the IMU.</p></figcaption></figure>
5. Open the [SLAM window](https://docs.phoenixlidar.com/spatialexplorer-8-and-9/user-interface/windows/slam).
6. From the Manage SLAM menu, select Start SLAM. This will open the [SLAM Processing profile ](https://docs.phoenixlidar.com/spatialexplorer-8-and-9/user-interface/windows/slam/slam-processing-profile)menu.&#x20;
7. At the top of the SLAM Processing profile menu, select either the **Standard** or **On-Foot** movement profile, according to your data acquisition style. Use the Standard profile for vehicle acquisitions, and On-Foot for all pedestrian SLAM applications.&#x20;
8. Configure parameters in the SLAM Processing profile as you see fit, then, click **OK** at the bottom of the menu.&#x20;
9. (optional) Using the [Project Player](https://docs.phoenixlidar.com/spatialexplorer-8-and-9/user-interface/windows/project-player), seek to your desired starting time for SLAM processing.&#x20;
10. Using the [Project Player](https://docs.phoenixlidar.com/spatialexplorer-8-and-9/user-interface/windows/project-player), press Play to begin SLAM processing.&#x20;
11. You can choose to pause the project player whenever you like - it is not necessary to process the entire data set.&#x20;
12. When you are done building the SLAM cloud, finalize and save the SLAM session via the [Manage SLAM menu](https://docs.phoenixlidar.com/spatialexplorer-8-and-9/user-interface/windows/slam).&#x20;
13. Even after the SLAM session is finalized, you can still adjust [optimization weights](#adjusting-optimization-weights), [add corrections](#optimizing-to-gcps) and re-optimize. Optimize by clicking the **Optimize** button next to Manage SLAM dropdown menu.&#x20;
14. If you'd like to resume correcting/optimizing at a later time, use **Finalize and save SLAM session** to save your changes to the SLAM artifacts (PLP, PBSTREAM, CLOUD).&#x20;
15. To resume work on a SLAM project, use **Manage SLAM -> Restore SLAM Session** and point SpatialExplorer to the **PBSTREAM** file. It is not necessary to open the PLP first.&#x20;

Fine tuning and optimization is described below, in the next section.&#x20;

## Fine tuning&#x20;

#### Adjusting Optimization Weights

After the [Project Player](https://docs.phoenixlidar.com/spatialexplorer-8-and-9/user-interface/windows/project-player) has been paused, or after the SLAM session has been finalized and saved, further fine tuning can be performed using the Optimization Weights shown in the [SLAM window](https://docs.phoenixlidar.com/spatialexplorer-8-and-9/user-interface/windows/slam) (see the SLAM window documentation for a description of each optimizable parameter):

<figure><img src="https://2222094320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdEevfLZRIk38LUPwDa4V%2Fuploads%2F1iZHulx0WJjS4YZAouXV%2Fimage.png?alt=media&#x26;token=83c11cab-6dfb-4185-85d0-5c335b7a736d" alt=""><figcaption></figcaption></figure>

#### Optimizing to GCPs

The SLAM trajectory can be optimized to better match ground control points. This is done by creating a correction from a GCP-laser point combination, similar to the [manual GCP adjustment workflow](https://docs.phoenixlidar.com/spatialexplorer-8-and-9/user-interface/toolbars/workflow/ground-control/manual-adjustment-horizontal-and-vertical). Corrections can be vertical, horizontal, or full. In the example below, vertical corrections are used to optimize SLAM.

First, remove any existing measurements from the measurement tab. Then, **select the GCP and the and corresponding laser point** by clicking on them individually in a profile view (for horizontal corrections, select them from the plan view):

{% hint style="info" %}
In the example below, corrections in respect to ground control are introduced into the SLAM optimizer. Corrections can also be created in respect to another pointcloud, such as an aerial-acquired or total station pointcloud. Simply import the pointcloud that you want to use as control, and follow the workflow outlined below - measurements created from the control pointcloud will be interpreted the same as ground control points.&#x20;
{% endhint %}

<figure><img src="https://content.gitbook.com/content/dEevfLZRIk38LUPwDa4V/blobs/c9up2NCejIuNFfO45npK/measurments_tab.jpg" alt=""><figcaption></figcaption></figure>

Once selected, click **Import from Measurements** and select **Vertical** for the correction type:

<figure><img src="https://content.gitbook.com/content/dEevfLZRIk38LUPwDa4V/blobs/ImRciH3IX8dIWQHCfuA5/Screenshot%202023-06-14%20095343.png" alt=""><figcaption></figcaption></figure>

In this example, two vertical corrections are needed for different time intervals along the trajectory. Visualizing the point cloud by **GPS time** may be helpful, and may require **updating attributes from cloud**.&#x20;

<figure><img src="https://content.gitbook.com/content/dEevfLZRIk38LUPwDa4V/blobs/zwz9y5uPB0G1fhKQh0gt/image.png" alt=""><figcaption></figcaption></figure>

Once the correction(s) are imported, click **Optimize**:

<figure><img src="https://content.gitbook.com/content/dEevfLZRIk38LUPwDa4V/blobs/Mq9sKSHnzMUqwjpjWSm7/image.png" alt=""><figcaption></figcaption></figure>
