Barometer Overview

Open in ClaudeOpen in ChatGPT

The barometer measures the ambient air pressure around the camera in hectopascals (hPa). As the ambient air pressure decreases with the altitude, the barometer can be used to measure the altitude variations of the camera.

However, ambient air pressure is also modified by weather conditions. During sunny days the ambient pressure is higher than during rainy ones. This means that the barometer is affected by outdoor conditions and that it can’t be used to estimate the absolute altitude of the camera from the sea level. Therefore only relative altitude variations are provided by this sensor.

Output Data

The following information is accessible from the camera sensor stack:

Output DataDescriptionUnits
Barometer (25 Hz)
pressureAmbient air pressure.hPa
relative_altitudeRelative altitude (altitude variation) from the initial camera position.meters

Using the API

You can access the barometer data with:

1SensorsData sensors_data;
2SensorsData::BarometerData barometer_data;
3
4// Grab new frames and retrieve sensors data
5while (zed.grab() == ERROR_CODE::SUCCESS) {
6 zed.getSensorsData(sensors_data, TIME_REFERENCE::IMAGE); // Retrieve only frame synchronized data
7
8 // Extract barometer data
9 barometer_data = sensors_data.barometer;
10
11 // Retrieve pressure and relative altitude
12 float pressure = barometer_data.pressure;
13 float relative_altitude = barometer_data.relative_altitude;
14}

Code Example

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