Using the Sensors API
The Sensors API lets you access sensors available on ZED depth cameras and perform a wide variety of sensor-related tasks explained below.
Getting Sensors Data
The data from the different sensors are accessible with the SensorsData class. The class contains raw and calibrated values of each sensor.
To retrieve sensor values synchronized with the image frames, you will need to:
- Open the camera and grab the current image.
- Get sensor data corresponding to this image using
TIME_REFERENCE::IMAGE. - Retrieve data from the different sensors.
Time Reference
The function getSensorsData can be called with a TIME_REFERENCE. For example, you can use TIME_REFERENCE::CURRENT to get the sensor data corresponding to the timestamp of the function call, or TIME_REFERENCE::IMAGE to get the data synchronized with the current camera image.
For more information on sensor time reference, read the Sensors Time Synchronization section.
Retrieve New Sensor Data
To retrieve updated sensor data, getSensorsData must be called at a frequency superior to or equal to the sensor data rate.
Since sensors have different frequencies and their data is stored in the same sensors_data structure, some sensor data might not be updated between two calls to getSensorsData.
To know if a given sensor data has been updated, we compare their timestamps which are used as unique identifiers. If they are the same, then the sensor data has not been updated.
Accessing Raw Sensor Data
The Sensors API lets you read raw data from the depth camera’s built-in motion and position sensors. To retrieve raw data, use the uncalibrated values present in sensors_data structure.
Identifying Sensors Capabilities
Sensors factory parameters can be accessed through the API. They cannot be changed as they are fixed in the microcontroller firmware of the cameras. You can access the following parameters:
- Sensor Type
- Sampling Rate
- Range
- Resolution
- Noise Density
- Random Walk (if applicable)
- Sensor Units
Code Example
For a code example, check out the Getting Sensor Data tutorial.

