Magnetometer Overview

The magnetometer measures the intensity of the magnetic field around the camera in microteslas (μT). The magnetometer determines the orientation of the earth magnetic field which gives the absolute orientation of the camera according to the north magnetic pole.

Output Data

The following information is accessible from the camera sensor stack:

Output Data Description Units
Magnetometer (50 Hz)
magnetic_field_calibrated 3x1 Vector for the magnetic field.
Values are corrected from bias and distortions.
μT
magnetic_field_uncalibrated 3x1 Vector for the magnetic field.
Values are not corrected from bias nor distortions.
μT

Using the API

The magnetometer measures the intensity of the magnetic fields around the camera. By measuring the earth’s magnetic field, the sensor can estimate the camera’s absolute orientation according to the north magnetic pole.

The Magnetometer values are stored in the sl::SensorData::MagnetometerData which can be accessed with:

sl::SensorsData::MagnetometerData magnetometer_data;
magnetometer_data = sensor_data.magnetometer;
magnetometer_data = sl.SensorsData.MagnetometerData()
magnetometer_data = sensor_data.magnetometer

In the magnetometer, the magnetic field data is accessible as a sl::float3:

sl::float3 magnetic_field;
magnetic_field = magnetometer_data.magnetic_field_calibrated;
magnetic_field = sl.float3()
magnetic_field = magnetometer_data.magnetic_field_calibrated

To access the raw (uncalibrated) magnetic field values, use magnetometer_data.magnetic_field_uncalibrated.

Code Example

For code example, check out the Getting Sensor Data tutorial.