Linear speed calibration

Note: The ROS_DOMAIN_ID of the Raspberry Pi and the microROS control board need to be consistent. You can check [MicroROS Control Board Parameter Configuration] to set the microROS control board ROS_DOMAIN_ID. Check the tutorial [Connect MicroROS Agent] to determine whether the IDs are consistent.

1. Program function description

The car connects to the agent, runs the program, and adjusts the parameters here through the dynamic parameter regulator to calibrate the linear speed of the car. The intuitive reflection of the calibrated linear speed is to give the car an instruction to go straight forward for 1 meter to see how far it actually ran and whether it is within the error range.

2、Start and connect to the agent

After successfully starting the Raspberry Pi, enter the following command in the terminal to start the agent,

Then, turn on the car switch and wait for the car to connect to the agent. The connection is successful, as shown in the figure below.

3. Enter the car docker

Open another terminal and enter the following command to enter docker.

When the following interface appears, you have successfully entered docker. Now you can control the car through commands.

image-20240201102039174

4. Start the program

First, start the car's underlying data processing program. This program will release the TF transformation of odom->base_footprint. With this TF change, you can calculate "how far the car has gone" and input it at the terminal.

image-20240123122033056

Then start the car linear speed calibration program and enter the following command on the terminal.

image-20240123122126389

Finally, enter the following command in the terminal to open the dynamic parameter adjuster.

image-20240123122312611

Note: There may not be the above nodes when you first open it. You can see all the nodes after clicking Refresh. The displayed calibrate_linear node is the node for calibrating linear speed.

5. Start calibration

In the rqt_reconfigure interface, select the calibrate_linear node. There is start_test below and click the box to the right to start calibration. Other parameters in the rqt interface are explained as follows:

Click start_test to start calibration. The car will monitor the TF transformation of base_footprint and odom, calculate the theoretical distance traveled by the car, wait until the error is less than the tolerance, and issue a parking instruction.

image-20240123122435126

If the actual distance the car runs is not 1m, then modify the odom_linear_scale_correction parameter in rqt. After modification, click on the blank space. Click start_test again, reset start_test, and then click start_test again to calibrate. The same goes for modifying other parameters. You need to click on the blank space to write the modified parameters.

6. Code analysis

Source code reference path.

calibrate_linear.py,The core code is as follows,