5. Robot calibration

1. Program function description

After the program runs, through the dynamic parameter regulator, here to adjust the parameters to calibrate the linear speed and angular speed of the cart. Take X3 model as an example, the intuitive embodiment of calibrating linear speed is to let the cart walk 1 meter straight forward to see how far it actually runs and whether it is within the error range; the intuitive embodiment of calibrating angular speed is to let the cart rotate 360 degrees to see whether the angle of rotation of the cart is within the error range.

2. Program code reference path

After entering the docker container, the source code of this function is located at.

3. Program startup

After entering the docker container, depending on the actual model, take R2 as an example, terminal input, the

image-20230420110942907

Take calibration line speed as an example, click "start_test" to calibrate the line speed of the car in x-direction, and observe whether the car moves the distance of test_distance, the default setting here is 1m, you can customize the distance of the test before calibrating, it must be a decimal number, click the blank space after setting, the program will write it automatically. The program will write it automatically after setting and clicking on the blank. If the trolley moves more than the acceptable error range (value of tolerance variable), then set the value of odom_linear_scale_correction. The following are the meanings of the individual parameters.

parametersmeaning
rateFrequency of publication (can be left unchanged)
test_distanceDistance for testing line speed
speedThe magnitude of the linear velocity
toleranceAcceptable error values
odom_linear_scale_correctionscale factor
start_teststart testing
base_frameListen to the parent coordinates of the TF transformation
odom_frameListening to sub-coordinates of TF transformations

The variable settings for testing angular velocity are more or less the same, but test_distance has been changed to test_angle and speed has been changed to angular velocity.

4. Program core source code analysis

This program mainly uses TF to listen to the transformation of coordinates, by listening to the transformation of coordinates between base_footprint and odom to let the robot know "how far I have gone/how many degrees I have turned".

Take calibrate_linear_R2.py as an example, the core code is as follows.

The core calibrate_angular_R2 code is as follows.

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

This node will receive the data from /vel_raw and publish the odom data through mathematical computation, along with the TF transformation, the core code is as follows.