5. Robot calibration

1. Program function description

After the program is run, the parameters are adjusted here through the dynamic parameter adjuster to calibrate the linear speed and angular speed of the car. Taking the X3 model as an example, the intuitive expression of the calibrated linear speed is to give the car an instruction to walk straight forward 1 meter to see how far it actually ran and whether it is within the error range; the intuitive expression of the calibrated angular speed is to let the car rotate 360 degrees and see Whether the angle of the car's rotation is within the error range.

2. Program code reference path

Raspberry Pi PI5 master needs to enter the docker container first, Orin motherboard does not need to enter,

the location of the source code of this function is:

3. Program startup

according to the actual car model, taking X3 as an example, enter in the terminal,

image-20230420110942907

Taking the calibration of linear speed as an example, click "start_test" to calibrate the linear speed of the car in the x direction, and observe whether the car has moved the test_distance distance. The default setting here is 1m. You can customize the test distance before calibration. It must be a decimal. After setting, click blank. , the program will automatically write. If the distance the car moves exceeds the acceptable error range (the value of the tolerance variable), then the value of odom_linear_scale_correction is set. The following is the meaning of each parameter,

ParametersMeaning
ratepublishing frequency (no need to modify)
test_distanceDistance to test linear speed
speedlinear speed
toleranceacceptable error value
odom_linear_scale_correctionScale coefficient
start_testStart testing
directiondirection (line speed test X (1) Y (0) direction)
base_frameMonitor the parent coordinates of TF transformation
odom_frameMonitor the sub-coordinates of TF transformation

The variable settings for testing angular velocity are roughly the same, except that test_distance becomes test_angle and speed becomes the angular velocity.

After the test is completed, remember the values of [odom_linear_scale_correction] and [odom_angular_scale_correction], and modify them to the values of the parameters linear_scale_x, linear_scale_y, and angular_scale in yahboomcar_bringup_X3_launch.py.

4. Program core source code analysis

This program is mainly implemented by using TF to monitor the transformation between coordinates. By monitoring the coordinate transformation between base_footprint and odom, the robot can know "how far I have walked now/how many degrees I have turned now."

Taking calibrate_linear_X3.py as an example, the core code is as follows:

calibrate_angular_X3 core code is as follows,

The published TF transformation is published at the base_node node, and the code path is,

This node will receive /vel_raw data, publish odom data through mathematical calculations, and also publish TF transformation. The core code is as follows,