Demo IMU
Plot raw IMU readings on top of video.
By Laurent Ittiitti@usc.eduhttp://jevois.orgGPL v3
 Language: C++Supports mappings with USB output: YesSupports mappings with NO USB output: Yes 
 Video Mapping:   YUYV 640 512 30.0 YUYV 640 480 30.0 JeVois DemoIMU

Module Documentation

As an optional hardware upgrade, one can install a global shutter sensor into JeVois (an OnSemi AR0135 1.2MP), which also includes on its custom circuit board for JeVois an inertial measurement unit (IMU). The IMU is a 9-degrees-of-freedom (9DOF) TDK InvenSense ICM-20948 (with 3-axis accelerometer, 3-axis gyroscope, and 3-axis magnetometer). This IMU also includes a digital motion processing unit (small programmable processor inside the IMU chip), which allows it to compute and filter Euler angles or quaternions directly inside the IMU chip.

This module only works with optional JeVois sensors that include an IMU! The base JeVois-A33 smart camera does not have an onboard IMU.

This module demonstrates the RAW and FIFO modes of the IMU.

The specifications of this chip are quite impressive:

  • 3-axis 16-bit accelerometer with full-range sensitivity selectable to +/-2g, +/-4g, +/-8g, and +/-16g.
  • Accelerometer data rate from 4 Hz to 1125 Hz.
  • 3-axis 16-bit gyroscope with full-range sensitivity selectable to +/-250dps (degrees/s), +/-500dps, +/-1000dps, and +/-2000dps.
  • Gyroscope data rate from 4 Hz to 1125 Hz.
  • 3-axis 16-bit magnetometer (compass) with wide range of +/-4900uT (micro Tesla).
  • Magnetometer data rates 10 Hz, 20 Hz, 50 Hz, or 100 Hz.
  • 16-bit temperature sensor with readout rate of up to 8 kHz.
  • RAW data mode (get current sensor values at any time), buffered (FIFO) data mode (sensor values accumulate into a FIFO at a fixed rate), and digital motion processing mode (DMP; raw data is processed on-chip).
  • On-chip digital motion processor (DMP) can compute, inside the IMU chip itself:
    • quaternion 6 (uses accel + gyro),
    • quaternion 9 (uses accel + gyro + compass),
    • geomag quaternion (uses accel + compass),
    • flip/pickup detection,
    • step detection and counting,
    • basic activity recognition: drive, walk, run, bike, tilt, still.

With quaternions computed on-chip, with an algorithm that gets sensor data at a highly accurate, fixed rate, and applies various calibrations, drift corrections, and compensations on the fly, one gets highly accurate real-time estimate of the sensor's pose in the 3D world and of how it is moving.

Note that communication with the IMU is over a 400kHz I2C bus, which may limit data readout rate depending on which data is requested from the IMU.

This IMU has 3 basic modes of operation (parameter mode, which can only be set in params.cfg):

  • RAW: One can access the latest raw sensor data at any time using the getRaw() or get() functions. This is the simplest mode of operation. One disadvantage is that if you are not calling get() at a perfectly regular interval, there will be some time jitter in your readouts. The IMU does not provide any time stamps for its data.
  • FIFO: In this mode, data from the sensor is piled up into a 1 kbyte FIFO buffer at a precise, constant rate (when all three of accelerometer, gyroscope, and magnetometer are on, the gyro rate determines the FIFO buffering rate). Main advantage is that you can then read out the data without having to worry about calling getRaw() or get() at a highly precise interval. But you need to be careful that the FIFO can fill up and overflow very quickly when using high sensor data rates.
  • DMP: In this mode, data is captured from the sensor at an accurate, fixed rate, and is fed to the on-chip digital motion processor (DMP). The DMP then computes quaternions, activity recognition, etc and pushes data packets into the FIFO as results from these algorithms become available.
ParameterTypeDescriptionDefaultValid Values
(DemoIMU) afacfloatFactor applied to acceleration values for display, or 0 to not display100.0F-
(DemoIMU) gfacfloatFactor applied to gyroscope values for display, or 0 to not display0.5F-
(DemoIMU) mfacfloatFactor applied to magnetometer values for display, or 0 to not display3.0F-
(ICM20948) modeModeData collection mode. RAW means that the latest available raw data is returned each time get() is called, hence timing may not be very accurate depending on how regularly get() is called. FIFO collects accel and gyro data at the exact rates specified by parameters arate, grate into a 1kb FIFO queue, and get() takes that data back from the FIFO. DMP runs the embedded digital motion processor on raw data, and accumulates resulting output data into the IMU's internal FIFO buffer at a precise, fixed rate. This parameter can only be set in a module's params.cfg file.Mode::RAWMode_Values
(ICM20948) dmpstd::stringRequested DMP data. Only valid when mode is DMP. Use any string of letters including:A=acceleration, G=gyro, M=magnetometer (compass), R=quaternion 6 (uses accel + gyro), Q=quaternion 9 (uses accel + gyro + compass), E=geomag (uses accel + compass), P=flip/pickup detection, S=step detection, T=activity recognition, F=frame sync from video sensor, w=configure activity recognition for wearable, g=gyro calibration (always on when gyro used), m=compass calibration (always on when compass used), b=accel accuracy (always on when accel used), h=gyro accuracy (always on when gyro used), n=compass accuracy (always on when compass used).QSPT-
(ICM20948) pktdbgboolSend raw FIFO or DMP packets to console for debug/hacking purposes.false-
(ICM20948) aratefloatAccelerometer sampling rate (Hz), or 0.0 to disable accelerometer. Actual sample rate may differ because of finite and discrete divider settings. In FIFO mode, grate controls the data rate.30.0Fjevois::Range<float>(0.0F, 1125.0F)
(ICM20948) gratefloatGyroscope sampling rate (Hz), or 0.0 to disable gyroscope. Actual sample rate may differ because of finite and discrete divider settings. In FIFO mode, grate controls the data rate.30.0Fjevois::Range<float>(0.0F, 1125.0F)
(ICM20948) mrateMagRateMagnetometer sampling rate (Hz), or Off to disable magnetometer, or Once to only get one measurement. You can repeatedly set this parameter to Once to obtain repeated measurements at your own pace. In JeVois Inventor, you need to alternate between Off and Once. In FIFO mode, grate controls the data rate.MagRate::M50HzMagRate_Values
params.cfg file
# IMU mode configuration - these config are applied when the DemoIMU module starts
# This is the only time the RAW vs FIFO mode of operation can be selected.

# Default mode is RAW data.  Uncomment the following line to enable the on-board FIFO:
#mode = FIFO

# For Digital motion processing (DMP) mode, see module DemoDMP. DemoIMU does nothing if mode is DMP.
Detailed docs:DemoIMU
Copyright:Copyright (C) 2018 by Laurent Itti, iLab and the University of Southern California
License:GPL v3
Support URL:
Other URL:
Address:University of Southern California, HNB-07A, 3641 Watt Way, Los Angeles, CA 90089-2520, USA