Obtain all zeros heading from svo, is this normal?

This is my sample code.

def read_heading(path):
    input_type = sl.InputType()
    if isinstance(path, str):
        input_type.set_from_svo_file(path)
    else:
        input_type.set_from_svo_file(str(path))

    print('reading file:', path)

    init = sl.InitParameters(input_t=input_type, svo_real_time_mode=False, coordinate_units=sl.UNIT.METER)
    cam = sl.Camera()
    status = cam.open(init)
    if status != sl.ERROR_CODE.SUCCESS:
        print(repr(status))
        return None

    n_frame = cam.get_svo_number_of_frames()

    headings = []
    sensors_data = sl.SensorsData()
    
    for idx in tqdm(range(0, 20, 1)):
        # cam.set_svo_position(idx)
        status = cam.grab()
        if status != sl.ERROR_CODE.SUCCESS:
            return

        cam.get_sensors_data(sensors_data, sl.TIME_REFERENCE.IMAGE)
        # imu_data = sensors_data.get_imu_data()
        # pose = imu_data.get_pose()

        magnetometer_data = sensors_data.get_magnetometer_data()
        headings.append(magnetometer_data.magnetic_heading)

    cam.close()

    return headings

I read the API ref. and see that the sensors_data.get_magnetometer_data() is not marked as unreadable from svo file.

however, the return data is all zeros 0.0 .

I don’t remember whether this was answered somewhere. Could someone clarify whether we can save natively the magnetometer?

me too i don’t see the answer anywhere. some issues i did repost in the zed sdk github issue.

reading it directly from the camera is working fine.

I think you have to save it yourself. Maybe look at the geotracking page. There, you can save the GNSS as json. Might be easy to replace GNSS with heading.