Positional tracking error

Hi! I bought Zed2i camera and I’m working with positional tracking api. I’d like to use only IMU data, without depending on what camera sees.

Firstly, I disabled area_memory doing tracking_params.enable_area_memory = False because when camera didn’t see anything, it didn’t work at all.
Now it has better performance but still has problem while sensors have no ligth.

Anyway, tracking line is really unstable and data is not truthful.

How can I use only IMU data to track positional movement of the camera??

I’m using code provided by stereolabs on github, anyway here the code:

import sys
import ogl_viewer.tracking_viewer as gl
import pyzed.sl as sl


if __name__ == "__main__":

    init_params = sl.InitParameters(camera_resolution=sl.RESOLUTION.HD720,
                                 coordinate_units=sl.UNIT.METER,
                                 coordinate_system=sl.COORDINATE_SYSTEM.RIGHT_HANDED_Y_UP)
                                 
    # If applicable, use the SVO given as parameter
    # Otherwise use ZED live stream
    if len(sys.argv) == 2:
        filepath = sys.argv[1]
        print("Using SVO file: {0}".format(filepath))
        init_params.set_from_svo_file(filepath)

    zed = sl.Camera()
    status = zed.open(init_params)
    if status != sl.ERROR_CODE.SUCCESS:
        print(repr(status))
        exit()

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

    runtime = sl.RuntimeParameters()
    camera_pose = sl.Pose()

    camera_info = zed.get_camera_information()
    # Create OpenGL viewer
    viewer = gl.GLViewer()
    viewer.init(camera_info.camera_model)

    py_translation = sl.Translation()
    pose_data = sl.Transform()

    text_translation = ""
    text_rotation = ""

    while viewer.is_available():
        if zed.grab(runtime) == sl.ERROR_CODE.SUCCESS:
            tracking_state = zed.get_position(camera_pose)
            if tracking_state == sl.POSITIONAL_TRACKING_STATE.OK:
                rotation = camera_pose.get_rotation_vector()
                translation = camera_pose.get_translation(py_translation)
                text_rotation = str((round(rotation[0], 2), round(rotation[1], 2), round(rotation[2], 2)))
                text_translation = str((round(translation.get()[0], 2), round(translation.get()[1], 2), round(translation.get()[2], 2)))
                pose_data = camera_pose.pose_data(sl.Transform())
            viewer.updateData(pose_data, text_translation, text_rotation, tracking_state)

    viewer.exit()
    zed.close()

Hello and thank you for reaching out to us,

If you just want the positional tracking from the IMU, the best way would be to retrieve the IMU data and compute the Pose yourself. This way, you’ll be sure that no SLAM algorithm is used.

Regards,

Antoine Lassagne
Senior Developer - ZED SDK
Stereolabs Support