# SLAM Workflow(Beta)

## Basic SLAM workflow

1. Open the Phoenix LiDAR Systems project file (.plp) from the acquired dataset (Click [here](https://docs.phoenixlidar.com/lidarmill-desktop/post-processing/slam-workflow-beta#performing-acquisition) for more details on dataset acquisition).
2. Optionally, if available, load in a .cg file from InertialExplorer with postprocessed GPS positions (if .cp is only available, it can be renamed to .cg).
3. Close the **System Monitor window** (either by pressing **X** in the upper right corner, or by selecting **Windows** -> **System Monitor**).

   <img src="/files/-MVufyG7zHcw-OjfP4Uo" alt="" data-size="original">&#x20;

   Open the **SLAM** processing window (**Windows** -> **SLAM**).\
   &#x20;<img src="/files/-MVugQvApHuNmqfE_UOc" alt="" data-size="original">&#x20;
4. Click the **Manage SLAM...** button on the SLAM processing window,  and select **Start SLAM**.\
   &#x20;<img src="/files/-MVuh0RumUNxOXqhMPEg" alt="" data-size="original">&#x20;
5. The **Edit SLAM tuning** dialog appears. The previously used SLAM processing settings (also referred to as a *SLAM tuning)* processing are loaded by default.\
   Sets of default recommended settings (*presets*) are available to be loaded as using the **Load from preset...** button in the top left.\
   When running SLAM processing for the first time, settings must be loaded from a preset. The recommended preset is called ***LFTB2**.* \ <img src="/files/-MVuhlh541COP9CVQ6vn" alt="" data-size="original">&#x20;
6. Click **Start SLAM** button to continue.\
   &#x20;<img src="/files/-MVui7xRY2gcPFy7wx6M" alt="" data-size="original">&#x20;
7. Select a time in the dataset to begin SLAM processing at by clicking the timeline (usually slightly before the LIDAR session). Alternatively, a start time may be entered using the **Select Time** window, accessible with the **Clock icon** button, next to the **Play** button. <img src="/files/-MVuiR1-b2O4NoZew923" alt="" data-size="original">&#x20;
8. Hit the **Play** button to start SLAM processing from the selected time in the dataset. Note that after playback is started, seeking during SLAM processing is not possible anymore. Processing can however be paused and resumed using the **Play/Pause** button.
9. Wait for SLAM processing to finish (in the **SLAM** window, the first progress bar is drained to zero in queue, while the second progress bar is filled up to 100%, e.g. 5678/5678, and both numbers are not increasing).\ <img src="/files/-MVuivdM3rpXgLiv8uU9" alt="" data-size="original">&#x20;
10. After processing is finished, you may opt to write out the resulting trajectory in a **.pof/.poq** file for further processing using **Manage SLAM....** -> **Write trajectory**, or you may opt to save the entire SLAM session (which inludes the trajectory and the SLAM cloud) using **Manage SLAM.... -> Finalize and save SLAM session...**\
    &#x20;<img src="/files/-MVujQO9zccu-9dV3KGt" alt="" data-size="original"> \
    The question "Recompute the point cloud according to the final optimized trajectory?" should be answered "Yes" if the cloud quality is satisfactory.  Cloud recompute will take some time, and it is recommended that it is performed at the very end of SLAM processing (e.g. after making other adjustments).\ <img src="/files/-MVujaJFNGhB3HI1_Zgn" alt="" data-size="original">&#x20;

The SLAM cloud, saved as part of the SLAM session, can be opened and examined standalone in a new instance of SpatialExplorer. It, however, cannot be recomputed.To recompute it, the entire SLAM session must be restored. To do this, select **Manage SLAM -> Restore SLAM session** in a new instance of SpatialExplorer. The original project does not have to be opened.

## Performing acquisition

### General notes

* At all times, and especially at the starting location, the LiDAR unit should have good visibility of the world around it. Avoid confined spaces. Do not occlude the LiDAR unit's field of vision.
* SLAM requires a multi-laser LiDAR. The reference LiDAR is Velodyne VLP-16 running at 1200 RPM in dual return mode. However, using a 32-laser LiDAR (VLP-32C/HDL-32E), or running the sensor at 600 RPM, or using a different return mode is also expected to work.
* The recommended position for mounting the LiDAR is straight, i.e. such the unit has a horizontal 360° view of the surroundings. If acquisition is performed by carrying, the LiDAR may be gently swung in order to increase coverage.
* Either completely avoid revisiting the same areas, or revisit them thoroughly, making sure there is decent overlap of the same area between the old and the new parts of the trajectory.&#x20;

### Initialization of acquisition

* To enable capturing data from the LiDAR sensor, the unit must achieve a **FineSteering** level of GPS time accuracy.
* To manage recording, connect to the **phoenixXXX** network.
* Visit the web interface at <http://192.168.20.10>
* Start Rover, and wait for **Time** status to become **FineSteering**.<img src="/files/-MW0sGBr-tRQFHmrqpBp" alt="" data-size="original">
* Capture will be enabled after the **Time** status **FineSteering** is achieved. This can be confirmed in **Messages**, where the message "*GNSS determined accurate time, allowing capture to be enabled.*" will appear.\ <img src="/files/-MW0tVn3QG9FJUAQVrqy" alt="" data-size="original"> <br>
* The **Time** status can degrade afterwards (e.g. after entering a building). This will not impact the ability to start capturing data when **FineSteering** has been achieved at least once after Rover has started.

## Things to check

* Make sure that the correct LiDAR, IMU, and GPS antenna (if applicable) mounting calibrations are set up before starting processing. If not, it is a good idea to **Save as...** the project after setting them up, in order to avoid the need to repeat entering them next time.
* Make sure that in the **Manage SLAM...** menu, **Fuse SLAM cloud** and **Automatically refresh poses** are checked (the default settings).

![](/files/-MVr1jVGHSStffw5nOJB)

* At the starting location, SLAM performs 'bootstrapping', i.e. creating the initial map of the surroundings (the first few seconds when the sensor is aligning and creating an understanding of the surroundings to tie to further along the mission.)
* When a trajectory re-visits the same area (*a loop*), the two parts of the trajectory should be correctly registered one against the other. This can be verified at the point cloud-level by coloring the cloud by time or by *submap ID*, and making sure that the old and new points in the cloud are well intermixed, without separation.

![The old and new points are well intermixed without separation (cloud colored by time)](/files/-MVqsjREfdZzxu8g1hC2)

Another helpful way to verify loop closure at trajectory-level is to enable **Manage SLAM... -> Display loop closure constraints**. Different parts of the trajectory which visit the same area should have lines of different colors connecting them.

![Two legs of the trajectory are well constrained ('Display loop closure constraints' setting is enabled, while the SLAM cloud is hidden)](/files/-MVqrXZXCTH0WOQuyRoJ)

* If the accumulated drift gets too large (e.g. in a large loop), loop closures may be missed. This can be countered by increasing the loop closure search windows in the **SLAM tuning** dialog when starting SLAM processing. (Setting the search windows too large may increase the processing time and cause problems in tighter and symmetric environments, e.g. building with similar rooms or similar floors).

![The part of the SLAM tuning dialog containing the loop closure search window settings](/files/-MVr0gr3uS64M3p-G5E_)

## Fine tuning&#x20;

After SLAM processing is finished, using the option **Manage SLAM...** -> **Adjust optimization weights**, some final non-destructive tweaking of the trajectory optimization can be performed. Notably, the strength of georeferencing can be adjusted (if it is too high, it can impact the cloud quality; if it is too low, the cloud may not be accurately georeferenced).

The georeferencing inlier scale specifies the distance from trajectory at which GPS measurement start having diminishing effect. This parameter can be set to a smaller distance at the very end in order to eliminate the effect of outlier measurements.

The gravity alignment weight (1) performs global gravity (i.e. pitch/roll) alignment of the trajectory according to the IMU measurements, while also having a "smoothing" effect on the trajectory positions. Gravity alignment (2) is an alternative implementation of the same (albeit it should not have the "smoothing" effect). In our testing, a moderate (10-200) weight on the gravity alignment 1 has proven to work.

![](/files/-MVr43kc0wKRWLTgNoHF)

To apply changes and see the immediate effect on the trajectory and the cloud, click **Optimize**.

For changing other settings in the SLAM tuning, the dataset must be reprocessed.

## Troubleshooting

* When troubleshooting, the first step is to set the georefencing strength to 0 (zero) and to perform SLAM processing again.

![](/files/-MVrFDZ0rOKpuWBzxkdS)

* If the SLAM trajectory and the cloud look correct, try restoring/adjusting the georeferencing strength at this point using the **Optimization weights** section of the **SLAM** window and then pressing **Optimize**.

![](/files/-MVrGdyDgsbbgEa9BPvl)

* If still problematic, try processing with the "LFTB2 no opt" preset, still making sure that the georeferencing strength is at 0 after loading the preset. Process a portion of the dataset. The trajectory and cloud can have global pitch roll, and drift at this point; however, the local cloud quality  should be acceptable.

![](/files/-MVrFmXnrMtkl8SP5OjT)

* Next, pressing **Optimize** in the SLAM dialog should result in gravity alignment being performed; i.e. the pitch and roll of the trajectory should be optimized correctly.
* Mounting the LiDAR with a noticeable pitch is not recommended for SLAM processing. However, in this scenario, the **Submap size (nr. of sweeps)** parameter can be increased from the default 150 scans to a bigger value (e.g. up to 1000 scans). It is also suggested to increase this parameter slightly (e.g. to 200-300) when data acquisition is performed on foot.

![](/files/-MVrJ8kJk6Sajy5qyBPH)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-6.phoenixlidar.com/lidarmill-desktop/post-processing/slam-workflow-beta.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
