IMU
IMU (inertial measurement unit) node can be used to receive data from the IMU chip on the device. Our OAK devices use either:- BNO085 (datasheet here) 9-axis sensor, combining accelerometer, gyroscope, and magnetometer. It also does sensor fusion on the (IMU) chip itself. We have efficiently integrated this driver into the DepthAI.
- BMI270 6-axis sensor, combining accelerometer and gyroscope.
Please take note, that all OAK-D-Lite cameras backed on Kickstarter do not have IMU on board.
How to place it
Python
C++
Python
Python
1pipeline = dai.Pipeline()
2imu = pipeline.create(dai.node.IMU)
Inputs and Outputs
Limitations
- For BNO086, gyroscope frequency above 400Hz can produce some jitter from time to time due to sensor HW limitation.
IMU sensor frequencies
Below are the discrete stable frequencies available for each (raw) IMU sensor. Some maximum IMU frequencies are higher, eg. for BNO086, maximum frequency for gyroscope is 1000Hz, but up to 400Hz is stable (due to driver limitation).BNO086:Note that BNO IMU "rounds up" the input frequency to the next available frequency. For example, if you set the frequency to 101 it will round it to 200Hz.- Accelerometer: 15Hz, 31Hz, 62Hz, 125Hz, 250Hz 500Hz
- Gyroscope: 25Hz, 33Hz, 50Hz, 100Hz, 200Hz, 400Hz
- Magnetometer: 100Hz
BNO086 Sensor | Max Frequency |
---|---|
ACCELEROMETER_RAW | 512 Hz |
ACCELEROMETER | 512 Hz |
LINEAR_ACCELERATION | 400 Hz |
GRAVITY | 400 Hz |
GYROSCOPE_RAW | 1000 Hz |
GYROSCOPE_CALIBRATED / GYROSCOPE_UNCALIBRATED | 100 Hz |
MAGNETOMETER_RAW | 100 Hz |
MAGNETOMETER_CALIBRATED / MAGNETOMETER_UNCALIBRATED | 100 Hz |
ROTATION_VECTOR | 400 Hz |
GAME_ROTATION_VECTOR | 400 Hz |
GEOMAGNETIC_ROTATION_VECTOR | 100 Hz |
ARVR_STABILIZED_ROTATION_VECTOR | 100 Hz |
ARVR_STABILIZED_GAME_ROTATION_VECTOR | 100 Hz |
- Accelerometer: 25Hz, 50Hz, 100Hz, 200Hz, 250Hz
- Gyroscope: 25Hz, 50Hz, 100Hz, 200Hz, 250Hz
Usage
Python
C++
Python
Python
1pipeline = dai.Pipeline()
2imu = pipeline.create(dai.node.IMU)
3
4# enable ACCELEROMETER_RAW and GYROSCOPE_RAW at 100 hz rate
5imu.enableIMUSensor([dai.IMUSensor.ACCELEROMETER_RAW, dai.IMUSensor.GYROSCOPE_RAW], 100)
6# above this threshold packets will be sent in batch of X, if the host is not blocked and USB bandwidth is available
7imu.setBatchReportThreshold(1)
8# maximum number of IMU packets in a batch, if it's reached device will block sending until host can receive it
9# if lower or equal to batchReportThreshold then the sending is always blocking on device
10# useful to reduce device's CPU load and number of lost packets, if CPU load is high on device side due to multiple nodes
11imu.setMaxBatchReports(10)
IMU sensors
When enabling the IMU sensors (imu.enableIMUSensor()
), you can select between the following sensors:ACCELEROMETER_RAW
ACCELEROMETER
LINEAR_ACCELERATION
GRAVITY
GYROSCOPE_RAW
GYROSCOPE_CALIBRATED
GYROSCOPE_UNCALIBRATED
MAGNETOMETER_RAW
MAGNETOMETER_CALIBRATED
MAGNETOMETER_UNCALIBRATED
ROTATION_VECTOR
GAME_ROTATION_VECTOR
GEOMAGNETIC_ROTATION_VECTOR
ARVR_STABILIZED_ROTATION_VECTOR
ARVR_STABILIZED_GAME_ROTATION_VECTOR
Examples of functionality
Reference
class
dai::node::IMU
variable
variable
function
void enableIMUSensor(IMUSensorConfig sensorConfig)
function
void enableIMUSensor(const std::vector< IMUSensorConfig > & sensorConfigs)
function
void enableIMUSensor(IMUSensor sensor, uint32_t reportRate)
function
void enableIMUSensor(const std::vector< IMUSensor > & sensors, uint32_t reportRate)
function
void setBatchReportThreshold(std::int32_t batchReportThreshold)
Above this packet threshold data will be sent to host, if queue is not blocked
function
std::int32_t getBatchReportThreshold()
Above this packet threshold data will be sent to host, if queue is not blocked
function
void setMaxBatchReports(std::int32_t maxBatchReports)
function
std::int32_t getMaxBatchReports()
function
void enableFirmwareUpdate(bool enable)
inline function
DeviceNodeCRTP()
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.