Wiki
Wheel Odometry Calibration
Existing English translations were reused. 2 current source blocks remain in Simplified Chinese, without triggering paid translation.
Wheel odometry calibration is a method of calibrating the rotation and movement of a robot's wheels to provide accurate position and orientation information during robot motion. Through calibration, errors caused by factors such as wheel size and wheelbase can be corrected, obtaining a more accurate motion trajectory. This section will demonstrate the calibration process using the MyCar navigation robot as an example, and its calibration steps are as follows:
-
Prepare the measurement site;
-
Linear displacement calibration;
-
Angular displacement calibration;
-
Verification and adjustment.
Additionally, this process also requires the use of a ruler as a measuring tool.
1. Prepare the measurement site
Choose an open and flat area, ensuring there are no obstacles or other interference factors.
2. Linear displacement calibration
Linear displacement calibration is used to calibrate the distance traveled by a robot when moving in a straight line. This calibration is closely related to the wheel diameter parameter. When the wheel diameter is measured inaccurately or the tire is worn, it will cause errors in the linear displacement of the wheel odometer. The main steps of linear displacement calibration are as follows:
(1) Actual data collection
Start the robot chassis and keyboard control node, use the keyboard to control the robot to move forward in a straight line for a certain distance, and measure the linear displacement data.
(2) Odometry message collection
After the robot stops, output odometry messages, and obtain the robot's displacement data from the odometry messages.
(3) Parameter calculation and modification
Collect the actual displacement data (w1) and the displacement data from the odometry message (w2), and combine them with the original tire diameter value (d1) in the driver package configuration file to calculate the corrected tire diameter value (d). The calculation formula is as follows:
d = w1 / w2 * d1;
Write the calculated result into the corresponding parameter in the configuration file of the MyCar robot, and rebuild.
To obtain the best results, the above process can be executed multiple times. After each execution, measure and record the new actual displacement data (w1) and the displacement data from the odometry message (w2), and then calculate the corrected tire diameter value (d) again based on the new data. By continuously iterating this process, the estimated tire diameter value can be gradually optimized, reducing the linear displacement error of the odometry.
Tip:
如果使用的是以Arduino为主控的MyCar两轮差速机器人,那么需要修改ros2_arduino_bridge功能包下的params/arduino.yaml文件,该文件中有一个名为wheel_diameter参数即为车轮直径;
如果使用的是以Stm32为主控的MyCar两轮差速机器人,那么需要修改ros2_stm32_bridge功能包下的params/stm32_2w.yaml文件,该文件中有一个名为wheel_diameter参数即为车轮直径;
如果使用的是以Stm32为主控的MyCar四轮差速机器人,那么需要修改ros2_stm32_bridge功能包下的params/stm32_4w.yaml文件,该文件中有一个名为wheel_diameter参数即为车轮直径。
3. Calibration of angular displacement
Corner displacement calibration is used to calibrate the angular change of a robot when turning. This calibration is closely related to the chassis rotation radius parameter; when the rotation radius is set improperly, it will cause measurement errors in corner displacement. In addition, it should be noted that if it is a two-wheel differential robot, then the rotation radius and the wheel spacing are basically the same. This is because a two-wheel differential robot does not cause lateral slipping of the vehicle body when rotating, so the wheel spacing can be used to calculate the rotation angle, and the rotation radius can be approximately equal to the wheel spacing. However, for a four-wheel differential robot, lateral slipping occurs during rotation, and the wheel spacing cannot be directly used to calculate the rotation angle. The rotation radius of a four-wheel differential robot needs to be obtained through experiments, because its rotation radius is affected by lateral slipping motion. In addition, due to reasons such as differences between the left and right tires of the robot or offset in the vehicle's center of gravity, the rotation radius used to calculate the rotation angle during left rotation and right rotation may be different. Therefore, separate experiments need to be carried out to obtain the rotation radius during left and right rotation.
The following are the main steps for rotational angle displacement calibration:
(1) Actual data collection
Start the robot chassis and keyboard control node, use the keyboard to control the robot to rotate in place, and measure the angular displacement data, for example, it can rotate one full turn in place.
(2) Odometry message collection
After the robot stops, open rviz2 and add the TF plugin to display the relative relationship between the robot base coordinate frame (generally base_link or base_footprint) and the odometry coordinate frame (generally odom).
(3) Parameter calculation and modification
When the robot rotates one full turn in place, if the robot base coordinate system coincides with the odometry coordinate system, then the rotation radius parameter does not need to be adjusted; if the robot base coordinate system does not coincide with the odometry coordinate system and the robot's rotation angle in rviz2 is greater than the actual rotation angle, then increase the rotation radius; if the robot base coordinate system does not coincide with the odometry coordinate system and the robot's rotation angle in rviz2 is less than the actual rotation angle, then decrease the rotation radius. Write the calculated result into the corresponding parameter in the MyCar robot configuration file, and rebuild.
To obtain the best results, the above process can be executed multiple times. After each execution, measure and record the new actual angular displacement data and the coordinate system relationship in rviz2, and then correct the rotation radius again based on the new data. By continuously iterating this process, the estimated value of the rotation radius can be gradually optimized, reducing the measurement error of the angular displacement.
Tip:
如果使用的是以Arduino为主控的MyCar两轮差速机器人,那么需要修改ros2_arduino_bridge功能包下的params/arduino.yaml文件,该文件中有一个名为wheel_track参数即为车轮直径,在ros2_arduino_bridge中并未对左旋转和右旋转做区分;
如果使用的是以Stm32为主控的MyCar两轮差速机器人,那么需要修改ros2_stm32_bridge功能包下的params/stm32_2w.yaml文件,在机器人左旋转时,要标定的是名为model_param_acw的参数,在机器人右旋转时,要标定的是名为model_param_cw的参数;
如果使用的是以Stm32为主控的MyCar四轮差速机器人,那么需要修改ros2_stm32_bridge功能包下的params/stm32_4w.yaml文件,和两轮差速类似的,在机器人左旋转时,要标定的是名为model_param_acw的参数,在机器人右旋转时,要标定的是名为model_param_cw的参数。
4. Verification and adjustment
Apply the calibrated wheel odometry to actual scenarios, and perform verification and adjustment. Observe the differences between the vehicle's actual position and motion and the estimated values, and make necessary adjustments and calibrations. In addition, when the vehicle's operating environment changes, or after continuous use for a long period, it is recommended to recalibrate the odometry.