1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
3 @page calibration_usecase_imu IMU Self-Calibration
5 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
7 ## IMU Calibration - Operating Principle
9 IMU calibration involves the estimation of the three angles aligning the IMU coordinate frame to the vehicle coordinate frame: roll, pitch, and yaw. All three angles are crucial to correctly estimate and predict the vehicle's pose when egomotion is used in `::DW_EGOMOTION_IMU_ODOMETRY` mode (for more details, see @ref egomotion_mainsection). The three angles are computed by processing the data sensed by the linear accelerometer and the gyroscope sensors embedded in the IMU device. Common driving maneuvers must be performed in order to excite the accelerometer and the gyroscope sensors along their three axes in order to make all three angles to be estimated observable.
13 In order to calibrate the IMU roll, the vehicle must perform several turns. Turns are automatically detected by the magnitude of the gyroscope excitation. In order to mitigate the influence of sensor noise, the gyroscope data is smoothed prior to processing. Roll corresponding to the gyroscope rotation is sampled into a histogram, mode of which, defines the estimated roll angle.
17 The pitch and yaw of the IMU are computed by using the linear accelerometer. In order to identify a forward acceleration, episodes of starts from static conditions, e.g, restarting at a traffic light or in a traffic jam, are automatically detected. In order to mitigate the influence of sensor noise, the accelerometer data is smoothed prior to processing. Employing the same histogram voting scheme as before, the pitch and yaw calibration angles are estimated in a robust way (see histograms below).
19 
23 ### Initialization Requirements
25 - Nominal values on IMU calibration
26 - Orientation(roll/pitch/yaw): roll less than 10 degree error, pitch and yaw less than 5 degree error
27 - Position(x/y/z): not used
29 ### Runtime Calibration Dependencies
33 ### Input Requirements
35 - Assumption: Vehicle performs the aforementioned maneuvers until calibration convergence.
36 - Speed measurements: Must be provided as part of dwVehicleIOState, see @ref vehicleio_mainsection for details
38 ### Output Requirements
40 - Corrected roll/pitch/yaw value: less than 0.4 degrees accuracy
41 - Time to correction: 11 minutes
43 ## Cross-validation KPI
45 Several hours of data are used to produce a reference calibration value for cross-validation.
46 Then, short periods of data are evaluated for whether they can recover the same values.
47 For example, the graph below shows precision/recall curves of IMU self-calibration.
48 Precision indicates that an accepted calibration is within a fixed precision threshold
49 from the reference calibration, and recall indicates the ratio of accepted calibrations
50 in the given amount of time.
52 
56 The following code snippet shows the general structure of a program that performs IMU self-calibration
59 dwCalibrationEngine_initialize(...); // depends on sensor from rig configuration module
60 dwCalibrationEngine_initializeIMU(...); // depends on nominal calibration from rig configuration
61 dwCalibrationEngine_startCalibration(...); // runtime calibration dependencies need to be met
63 while(true) // main loop
65 // get current IMU frame
66 dwSensorIMU_readFrame(&imuFrame, ...); // requires IMU module
68 // feed IMU frame into self-calibration
69 dwCalibrationEngine_addIMUFrame(&imuFrame, ...);
71 // Update vehicle state from CAN
72 dwSensorCAN_readMessage(&canMsg, ...);
73 dwVehicleIO_consumeCANFrame(&canMsg, ...);
75 // get current vehicle state
76 dwVehicleIO_getVehicleState(&vehicleState, ...);
78 // pass on vehicle state to self-calibration
79 dwCalibrationEngine_addVehicleIOState(&vehicleState, ...);
81 // retrieve calibration status
82 dwCalibrationEngine_getCalibrationStatus(...);
84 // retrieve self-calibration results
85 dwCalibrationEngine_getSensorToRigTransformation(...);
88 dwCalibrationEngine_stopCalibration(...);
91 This workflow is demonstrated in the following sample: @ref dwx_imu_calibration_sample