Robot Odometer Calibration
Introduction
The robot can output odometer information to track its traveled distance and turning angles. The default program may have inaccuracies, which can be corrected by calibrating the odometer. This guide will help you achieve higher accuracy, although initial operations can proceed without calibration if precision is not crucial.
Step 1: Calibrate the Linear Velocity
1. Enable the Chassis Node
-
Connect to the robot via SSH and open the terminal.
-
Enter the following command to enable the chassis node:
roslaunch jetracer jetracer.launch
Note: Ensure the chassis node is not enabled multiple times, as it may cause errors.
2. Enable Keyboard Control
-
Press
Ctrl + Alt + T
to open a new terminal. -
Enter the following command to enable keyboard control of the topic nodes:
roslaunch jetracer keyboard.launch
3. Control the Robot
- Press the
I
key on the keyboard to move the robot forward. - Observe if the robot moves in a straight line. If it does not, proceed to the next step to calibrate.
4. Use rqt_reconfigure for Calibration
-
Open a new terminal and run:
rosrun rqt_reconfigure rqt_reconfigure
-
Adjust the
servo_bias
parameter until the robot moves straight. -
Save the calibration:
vi ~/catkin_ws/src/jetracer_ros/cfg/jetracer.cfg
Modify the
servo_bias
line with the new value.
Step 2: Linear Velocity Calibration
1. Close Previous Chassis Node
- Ensure the previously started chassis node is closed while keeping the robot master node running.
2. Start Linear Velocity Calibration
-
Open a terminal in Jetson Nano and run:
roslaunch jetracer calibrate_linear.launch
Do not close this terminal to keep the calibration option visible.
3. Open Dynamic Parameter Configuration
-
In the virtual machine, run:
rosrun rqt_reconfigure rqt_reconfigure
-
Set the following parameters:
test_distance
: Default is 1m.speed
: Robot's linear speed.tolerance
: Error margin to reach the goal.odom_linear_scale_correction
: Adjust this based on test results.
4. Perform the Test
- Place the robot on the ground and mark its starting position.
- Check
start_test
to initiate calibration. - Measure the actual distance traveled and calculate the correction ratio.
- Adjust
odom_linear_scale_correction
by multiplying it with the ratio and repeat until the distance is accurate.
5. Save Calibration Parameters
-
Open the file to save the new parameters:
vi ~/catkin_ws/src/jetracer_ros/launch/jetracer.launch
-
Modify the
linear_correction
value.
Step 3: Angular Velocity Calibration
1. Initial Setup
-
Unplug the motor wire to keep the motor in a free state.
-
Modify the parameters to set servo control to
y = x
:vi ~/catkin_ws/src/jetracer_ros/cfg/jetracer.cfg
Set
servo_bias
to 0.vi ~/catkin_ws/src/jetracer_ros/launch/jetracer.launch
Set
coefficient_a
,coefficient_b
,coefficient_d
to 0, andcoefficient_c
to 1.
2. Enable the Chassis Node
-
Connect via SSH and run:
roslaunch jetracer jetracer.launch
3. Enable Topic Publishing
-
Run the following command:
rosrun rqt_publisher rqt_publisher
-
Add
/cmd_vel
topic information.
4. Measure Turning Diameter
- Set
/cmd_vel.angular.z
to-1
and gradually increase to1
, recording the turning diameter at each value.
5. Fit the Polynomial
-
Update the program with actual measurements:
vi ~/catkin_ws/src/jetracer_ros/scripts/servo_calibratin.py
-
Run the calibration script:
python ~/catkin_ws/src/jetracer_ros/scripts/servo_calibratin.py
6. Save Fitting Parameters
-
Open the launch file and save the new parameters:
vi ~/catkin_ws/src/jetracer_ros/launch/jetracer.launch
-
Convert scientific notation to floating-point numbers if necessary.
Conclusion
After successful calibration, the robot should move in a straight line and handle turns accurately. Adjust the servo_bias
or d
parameter if further fine-tuning is required.