DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

src/dw/calibration/engine/docs/usecase_imu.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
2 
3 @page calibration_usecase_imu IMU Self-Calibration
4 
5 ## IMU Calibration - Operating Principle
6 
7 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.
8 
9 ### IMU Roll
10 
11 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.
12 
13 ### IMU Pitch and Yaw
14 
15 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).
16 
17 ![Up estimation histograms (left) and forward estimation histograms (right) of an IMU calibration, collected over a period of time](self_calib_imu.png)
18 
19 ## Requirements
20 
21 ### Initialization Requirements
22 
23 - Nominal values on IMU calibration
24  - Orientation(roll/pitch/yaw): roll less than 10 degree error, pitch and yaw less than 5 degree error
25  - Position(x/y/z): not used
26 
27 ### Runtime Calibration Dependencies
28 
29 - None
30 
31 ### Input Requirements
32 
33 - Assumption: Vehicle performs the aforementioned maneuvers until calibration convergence.
34 - Speed measurements: Must be provided as part of dwVehicleIOState, see @ref vehicleio_mainsection for details
35 
36 ### Output Requirements
37 
38 - Corrected roll/pitch/yaw value: less than 0.4 degrees accuracy
39 - Time to correction: 11 minutes
40 
41 ## Cross-validation KPI
42 
43 Several hours of data are used to produce a reference calibration value for cross-validation.
44 Then, short periods of data are evaluated for whether they can recover the same values.
45 For example, the graph below shows precision/recall curves of IMU self-calibration.
46 Precision indicates that an accepted calibration is within a fixed precision threshold
47 from the reference calibration, and recall indicates the ratio of accepted calibrations
48 in the given amount of time.
49 
50 ![](self_calib_imu_kpi.png)
51 
52 ## Workflow
53 
54 The following code snippet shows the general structure of a program that performs IMU self-calibration
55 
56 ```{.cpp}
57  dwCalibrationEngine_initialize(...); // depends on sensor from rig configuration module
58  dwCalibrationEngine_initializeIMU(...); // depends on nominal calibration from rig configuration
59  dwCalibrationEngine_startCalibration(...); // runtime calibration dependencies need to be met
60 
61  while(true) // main loop
62  {
63  // get current IMU frame
64  dwSensorIMU_readFrame(&imuFrame, ...); // requires IMU module
65 
66  // feed IMU frame into self-calibration
67  dwCalibrationEngine_addIMUFrame(&imuFrame, ...);
68 
69  // Update vehicle state from CAN
70  dwSensorCAN_readMessage(&canMsg, ...);
71  dwVehicleIO_consumeCANFrame(&canMsg, ...);
72 
73  // get current vehicle state
74  dwVehicleIO_getVehicleState(&vehicleState, ...);
75 
76  // pass on vehicle state to self-calibration
77  dwCalibrationEngine_addVehicleIOState(&vehicleState, ...);
78 
79  // retrieve calibration status
80  dwCalibrationEngine_getCalibrationStatus(...);
81 
82  // retrieve self-calibration results
83  dwCalibrationEngine_getSensorToRigTransformation(...);
84  }
85 
86  dwCalibrationEngine_stopCalibration(...);
87 ```
88 
89 This workflow is demonstrated in the following sample: @ref dwx_imu_calibration_sample