> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.stereolabs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.stereolabs.com/_mcp/server.

# Positional Tracking Status

The Positional Tracking module provides real-time status information. The overall tracking state is returned by the `getPosition` function as a `sl::POSITIONAL_TRACKING_STATE` value.

Additionally, detailed tracking status can be accessed via the `getPositionalTrackingStatus` function, which returns a `sl::PositionalTrackingStatus` structure containing the following fields:

* `sl::ODOMETRY_STATUS odometry_status`
* `sl::SPATIAL_MEMORY_STATUS spatial_memory_status`
* `sl::POSITIONAL_TRACKING_FUSION_STATUS tracking_fusion_status`

The state of an area map export is returned separately by the `getAreaExportState` function, as a `sl::AREA_EXPORTING_STATE` value.

## POSITIONAL\_TRACKING\_STATE

Positional Tracking State indicates the current status of the positional tracking module. It provides insights into whether the tracking is functioning correctly or if there are any issues affecting its performance.

| Enumerator              | Description                                                                                                                                                                            |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SEARCHING               | **- DEPRECATED -** This state is no longer in use.                                                                                                                                     |
| OK                      | The positional tracking is functioning normally.                                                                                                                                       |
| OFF                     | The positional tracking is currently disabled.                                                                                                                                         |
| FPS\_TOO\_LOW           | The effective FPS is too low to provide accurate motion tracking results. Consider adjusting performance parameters (e.g., depth mode, camera resolution) to improve tracking quality. |
| SEARCHING\_FLOOR\_PLANE | The camera is currently searching for the floor plane to establish its position relative to it. The world reference frame will be set afterward.                                       |
| UNAVAILABLE             | The tracking module was unable to perform tracking from the previous frame to the current frame.                                                                                       |

For more information, refer to the [API documentation](https://www.stereolabs.com/docs/api/group__PositionalTracking__group.html#gae481924a311113375bb3a99748d79e17) page.

### Example: Access the Positional Tracking State information from the API

**`C++`**

```cpp C++
sl::Camera zed;
zed.open();

// Start positional tracking
sl::PositionalTrackingParameters tracking_params;
zed.enablePositionalTracking(tracking_params);

sl::Pose camera_pose;
sl::POSITIONAL_TRACKING_STATE tracking_state;

while (true) {
    if (zed.grab() == sl::ERROR_CODE::SUCCESS) {
        tracking_state = zed.getPosition(camera_pose);

        std::cout << "Tracking state: " << tracking_state << std::endl;

        // Or convert to string:
        std::cout << "Tracking state (string): " 
                  << sl::toString(tracking_state).c_str() << std::endl;
    }
}
```

**`Python`**

```python Python
import pyzed.sl as sl

zed = sl.Camera()
zed.open()

tracking_params = sl.PositionalTrackingParameters()
zed.enable_positional_tracking(tracking_params)

camera_pose = sl.Pose()

while True:
    if zed.grab() == sl.ERROR_CODE.SUCCESS:
        state = zed.get_position(camera_pose)

        print("Tracking state:", state)
        # Or using the string conversion:
        print("Tracking state (string):", state.name)
```

**`C#`**

```csharp C#
using sl;

Camera zed = new Camera(0);
InitParameters initParams = new InitParameters();
zed.Open(ref initParams);

PositionalTrackingParameters trackingParams = new PositionalTrackingParameters();
zed.EnablePositionalTracking(ref trackingParams);

Pose cameraPose = new Pose();
RuntimeParameters runtimeParams = new RuntimeParameters();

while (true)
{
    if (zed.Grab(ref runtimeParams) == ERROR_CODE.SUCCESS)
    {
        POSITIONAL_TRACKING_STATE state = zed.GetPosition(ref cameraPose);

        Console.WriteLine("Tracking state: " + state);
        // Same as string output automatically
    }
}
```

## ODOMETRY\_STATUS

Odometry Status indicates the current state of the Visual Odometry (VO) tracking process. It provides insights into whether the VO is functioning correctly or if there are any issues affecting its performance.

| Enumerator             | Description                                                                                          |
| ---------------------- | ---------------------------------------------------------------------------------------------------- |
| OK                     | The positional tracking module successfully tracked from the previous frame to the current frame.    |
| UNAVAILABLE            | The positional tracking module cannot track the current frame.                                       |
| INSUFFICIENT\_FEATURES | The positional tracking failed to track the current frame because it could not find enough features. |

### Example: Access the Odometry Status from the API

**`C++`**

```cpp C++
sl::Camera zed;
zed.open();

// Enable positional tracking
sl::PositionalTrackingParameters tracking_params;
zed.enablePositionalTracking(tracking_params);

sl::PositionalTrackingStatus tracking_status;

while (true) {
    if (zed.grab() == sl::ERROR_CODE::SUCCESS) {

        tracking_status = zed.getPositionalTrackingStatus();

        sl::ODOMETRY_STATUS odom_status = tracking_status.odometry_status;

        std::cout << "Odometry status: " << odom_status << std::endl;
        std::cout << "Odometry status (string): "
                  << sl::toString(odom_status).c_str() << std::endl;
    }
}
```

**`Python`**

```python Python
import pyzed.sl as sl

zed = sl.Camera()
zed.open()

tracking_params = sl.PositionalTrackingParameters()
zed.enable_positional_tracking(tracking_params)

tracking_status = sl.PositionalTrackingStatus()

while True:
    if zed.grab() == sl.ERROR_CODE.SUCCESS:

        tracking_status = zed.get_positional_tracking_status()

        odom_status = tracking_status.odometry_status

        print("Odometry status:", odom_status)
        print("Odometry status (string):", odom_status.name)
```

**`C#`**

```csharp C#
using sl;

Camera zed = new Camera(0);
InitParameters initParams = new InitParameters();
zed.Open(ref initParams);

PositionalTrackingParameters trackingParams = new PositionalTrackingParameters();
zed.EnablePositionalTracking(ref trackingParams);

PositionalTrackingStatus trackingStatus = new PositionalTrackingStatus();
RuntimeParameters runtimeParams = new RuntimeParameters();

while (true)
{
    if (zed.Grab(ref runtimeParams) == ERROR_CODE.SUCCESS)
    {
        trackingStatus = zed.GetPositionalTrackingStatus();

        ODOMETRY_STATUS odomStatus = trackingStatus.odometryStatus;

        Console.WriteLine("Odometry status: " + odomStatus);
    }
}
```

## SPATIAL\_MEMORY\_STATUS (VSLAM Status)

Spatial Memory Status indicates the current state of the Visual SLAM (VSLAM) tracking process. It provides insights into whether the VSLAM is functioning correctly or if there are any issues affecting its performance.

| Enumerator   | Description                                                                                                                                                                                                                                                                                                                          |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| OK           | **- Deprecated -** This state is no longer in use for GEN\_3.                                                                                                                                                                                                                                                                        |
| LOOP\_CLOSED | Displayed whenever the system has found a loop closure, relocalized within the area map or corrected after a sudden localization loss.                                                                                                                                                                                               |
| SEARCHING    | **- Deprecated -** This state is no longer in use for GEN\_3.                                                                                                                                                                                                                                                                        |
| OFF          | Displayed when the spatial memory is turned off.                                                                                                                                                                                                                                                                                     |
| INITIALIZING | Displayed until the camera has acquired enough memory (Initial Area Mapping) or has found its first loop closure and is localized in the loaded area map (Lifelong Mapping/Localization). Users need to keep moving the camera for it to get updated.                                                                                |
| KNOWN\_MAP   | Displayed when the camera is localized within the loaded area map.                                                                                                                                                                                                                                                                   |
| MAP\_UPDATE  | Displayed when the robot is mapping (Initial Area Mapping) or when the robot is getting out of the area map bounds (Lifelong Mapping). Displayed as `TRACKING` when in exploratory mode with SLAM engaged.                                                                                                                           |
| LOST         | Displayed when localization cannot operate anymore (camera completely obstructed, sudden localization jumps after being localized) in Mapping/Localization modes. It can also include the case where the camera jumps or is located out of map bounds in Localization mode. This should be an indicator for users to stop the robot. |

### Example: Access the Spatial Memory Status from the API

**`C++`**

```cpp C++
#include <sl/Camera.hpp>
#include <iostream>

int main() {
    sl::Camera zed;
    zed.open();

    sl::PositionalTrackingParameters tracking_params;
    zed.enablePositionalTracking(tracking_params);

    sl::PositionalTrackingStatus tracking_status;

    while (true) {
        if (zed.grab() == sl::ERROR_CODE::SUCCESS) {
            
            tracking_status = zed.getPositionalTrackingStatus();

            sl::SPATIAL_MEMORY_STATUS mem_status = tracking_status.spatial_memory_status;

            std::cout << "Spatial Memory Status: " << mem_status << std::endl;
            std::cout << "Spatial Memory Status (string): "
                      << sl::toString(mem_status).c_str() << std::endl;
        }
    }
}

```

**`Python`**

```python Python
import pyzed.sl as sl

zed = sl.Camera()
zed.open()

tracking_params = sl.PositionalTrackingParameters()
zed.enable_positional_tracking(tracking_params)

while True:
    if zed.grab() == sl.ERROR_CODE.SUCCESS:

        tracking_status = zed.get_positional_tracking_status()

        mem_status = tracking_status.spatial_memory_status

        print("Spatial Memory Status:", mem_status)
        print("Spatial Memory Status (string):", mem_status.name)
```

**`C#`**

```csharp C#
using sl;
using System;

class Program {
    static void Main() {

        Camera zed = new Camera(0);
        InitParameters initParams = new InitParameters();
        zed.Open(ref initParams);

        PositionalTrackingParameters trackingParams = new PositionalTrackingParameters();
        zed.EnablePositionalTracking(ref trackingParams);

        PositionalTrackingStatus trackingStatus = new PositionalTrackingStatus();
        RuntimeParameters runtimeParams = new RuntimeParameters();

        while (true)
        {
            if (zed.Grab(ref runtimeParams) == ERROR_CODE.SUCCESS)
            {
                trackingStatus = zed.GetPositionalTrackingStatus();

                SPATIAL_MEMORY_STATUS memStatus = trackingStatus.spatialMemoryStatus;

                Console.WriteLine("Spatial Memory Status: " + memStatus);
            }
        }
    }
}
```

## AREA\_EXPORTING\_STATE

Area Exporting State indicates the current status of the spatial memory exportation process. It provides insights into whether the exportation is functioning correctly or if there are any issues affecting its performance.

| Enumerator                | Description                                                                |
| ------------------------- | -------------------------------------------------------------------------- |
| SUCCESS                   | The spatial memory file has been successfully created.                     |
| RUNNING                   | The spatial memory is currently being written.                             |
| NOT\_STARTED              | The spatial memory file exportation has not been called.                   |
| FILE\_EMPTY               | The spatial memory contains no data, the file is empty.                    |
| FILE\_ERROR               | The spatial memory file has not been written because of a wrong file name. |
| SPATIAL\_MEMORY\_DISABLED | The spatial memory learning is disabled. No file can be created.           |

### Example: Access the Area Exporting State from the API

**`C++`**

```cpp C++
#include <sl/Camera.hpp>
#include <iostream>

int main() {
    sl::Camera zed;
    zed.open();

    sl::PositionalTrackingParameters tracking_params;
    zed.enablePositionalTracking(tracking_params);

    // Export area map
    zed.saveAreaMap("my_scene.area");

    // Query export state until complete
    sl::AREA_EXPORTING_STATE exportState = zed.getAreaExportState();
    while (exportState == sl::AREA_EXPORTING_STATE::RUNNING) {
        std::cout << "Exporting state: " << sl::toString(exportState) << std::endl;
        sl::sleep_ms(10);
        exportState = zed.getAreaExportState();
    }

    std::cout << "Final exporting status: " << sl::toString(exportState) << std::endl;

    return 0;
}
```

**`Python`**

```python Python
import pyzed.sl as sl
import time

zed = sl.Camera()
zed.open()

tracking_params = sl.PositionalTrackingParameters()
zed.enable_positional_tracking(tracking_params)

# Export area map
zed.save_area_map("my_scene.area")

# Query export state until complete
export_state = zed.get_area_export_state()
while export_state == sl.AREA_EXPORTING_STATE.RUNNING:
    print("Area Exporting State:", export_state.name)
    time.sleep(0.01)
    export_state = zed.get_area_export_state()

print("Final exporting status:", export_state.name)
```

**`C#`**

```csharp C#
using sl;
using System;

class Program {
    static void Main() {

        Camera zed = new Camera(0);
        InitParameters initParams = new InitParameters();
        zed.Open(ref initParams);

        PositionalTrackingParameters trackingParams = new PositionalTrackingParameters();
        zed.EnablePositionalTracking(ref trackingParams);

        // Export area map
        zed.SaveAreaMap("my_scene.area");

        // Query export state until complete
        AREA_EXPORT_STATE exportState = zed.GetAreaExportState();
        while (exportState == AREA_EXPORT_STATE.AREA_EXPORT_STATE_RUNNING)
        {
            Console.WriteLine("Area Exporting State: " + exportState);
            System.Threading.Thread.Sleep(10);
            exportState = zed.GetAreaExportState();
        }

        Console.WriteLine("Final exporting status: " + exportState);
    }
}
```