Skip to navigation

IMU Overview

Open in ClaudeOpen in ChatGPT

Accelerometer

The accelerometer detects the instantaneous acceleration of the camera. The data provided by the accelerometer determines whether the camera is getting faster or slower, in any direction, with a precise value in meters per second squared (m/s²).

When an accelerometer is static, it is still measuring an acceleration of 9.8 m/s², which corresponds to the reaction to the Earth’s gravity. This measurement is always aligned with the vertical axis, pointing away from the center of the Earth. Gravity allows us to compute the camera’s absolute inclination and detect events like free falls.

Gyroscope

A gyroscope measures the angular velocity of the camera in degrees per second (deg/s). When combined with the accelerometer, both sensors can estimate the orientation of the camera at a high frequency.

Output Data

The following information is accessible from the camera sensor stack:

Output DataDescriptionUnits
Accelerometer
linear_accelerationAcceleration force applied on all three physical axes (x, y, and z), including the force of gravity. Values are corrected from bias, scale and misalignment.m/s²
linear_acceleration_uncalibratedAcceleration force applied on all three physical axes (x, y, and z), including the force of gravity. Values are uncalibrated.m/s²
linear_acceleration_covarianceMeasurement noise of the uncalibrated linear acceleration of the accelerometer. Provided as a 3x3 covariance matrix.(m/s²)²
Gyroscope
angular_velocityRate of rotation around each of the three physical axes (x, y, and z). Values are corrected from bias, scale and misalignment.deg/s
angular_velocity_uncalibratedRate of rotation around each of the three physical axes (x, y, and z). Values are uncalibrated.deg/s
angular_velocity_covarianceMeasurement noise of the uncalibrated angular velocity of the gyroscope. Provided as a 3x3 covariance matrix.(deg/s)²
Orientation
pose_covarianceMeasurement noise of the pose orientation. Provided as a 3x3 covariance matrix.rad²
camera_imu_transformTransform between IMU and Left Camera frames.

IMU Configuration

Since ZED SDK 5.6, the IMU of the ZED X family (ZED X, ZED X Mini, ZED X Nano and the GMSL2 ZED X One models) can be configured when the camera opens, through InitParameters:

ParameterValuesDefault
imu_accelerometer_rangeACCELEROMETER_RANGE::G_3, G_6, G_12, G_24 (±3 g to ±24 g)DEFAULT, ±12 g on ZED X cameras
imu_gyroscope_rangeGYROSCOPE_RANGE::DPS_250, DPS_500, DPS_1000, DPS_2000 (±250 to ±2000 deg/s)DEFAULT, ±1000 deg/s on ZED X cameras
imu_sampling_rateIMU_SAMPLING_RATE::HZ_200, HZ_400, OFFDEFAULT, 200 Hz on ZED X cameras
  • A smaller range gives a finer resolution for slow, precise motion; a larger one avoids saturated readings under strong shocks or fast rotations.
  • HZ_400 doubles the gyroscope rate, and so the rate of the IMU data, for applications that need more motion samples between frames. The accelerometer keeps its own rate.
  • OFF opens the camera without its IMU: no IMU data, the motion sensors are reported unavailable, and positional tracking uses the images only. sensors_required must then be false.
  • getCameraInformation().sensors_configuration reports the ranges and rates in use.

The ranges and the 400 Hz rate require ZED X Driver 1.5.0 or newer. With an older driver, or another camera model, the camera keeps its defaults and a warning is logged.

InitParameters init_parameters;
init_parameters.imu_accelerometer_range = ACCELEROMETER_RANGE::G_6;
init_parameters.imu_gyroscope_range = GYROSCOPE_RANGE::DPS_500;
init_parameters.imu_sampling_rate = IMU_SAMPLING_RATE::HZ_400;

Using the API

Accessing the IMU data can be done through the SensorsData class. Data is stored in the class SensorsData::IMUData which amongst others contains the accelerometer and gyroscope values.

You can retrieve IMU data with the following code:

SensorsData sensors_data;
SensorsData::IMUData imu_data;
// Grab new frames and retrieve sensors data
while (zed.grab() == ERROR_CODE::SUCCESS) {
zed.getSensorsData(sensors_data, TIME_REFERENCE::IMAGE); // Retrieve only frame synchronized data
// Extract IMU data
imu_data = sensors_data.imu;
// Retrieve linear acceleration and angular velocity
float3 linear_acceleration = imu_data.linear_acceleration;
float3 angular_velocity = imu_data.angular_velocity;
}

Pose

One of the key reasons for having an accelerometer and gyroscope in the camera is that their data can be fused to estimate camera orientation. The accelerometer provides gravity orientation, while the gyroscope estimates the rotation applied to the camera. Fused at high frequency, the combination of both sensors provides a robust orientation estimation.

IMU pose can be retrieved in imu_data.pose.

Code Example

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