Jetracer Odometer Kalibration: Unterschied zwischen den Versionen

Aus HSHL Mechatronik
Zur Navigation springen Zur Suche springen
Zeile 57: Zeile 57:
[[Datei:JetRacer_Odom_Angular_Step02.png|Step02]]
[[Datei:JetRacer_Odom_Angular_Step02.png|Step02]]
*Connect the robot by SSH, open the terminal, and enter the following commands to enable the chassis node of the robot.
*Connect the robot by SSH, open the terminal, and enter the following commands to enable the chassis node of the robot.
*Do not enable the chassis node of the robot repeatedly, otherwise it will be in error. If you have not close the chassis node, you do not need to enable it again.
*<span style="color:red">Do not enable the chassis node of the robot repeatedly, otherwise it will be in error. If you have not close the chassis node, you do not need to enable it again.</span>
  roslaunch jetracer jetracer.launch      #Start the robot chassis node
  roslaunch jetracer jetracer.launch      #Start the robot chassis node
*Enable the topic publishing function by the command of "rqt_publisher" in the virtual machine, choose "/cmd_vel" to add more topic information.
*Enable the topic publishing function by the command of "rqt_publisher" in the virtual machine, choose "/cmd_vel" to add more topic information.
  rosrun rqt_publisher rqt_publisher
  rosrun rqt_publisher rqt_publisher
[[Datei:JetRacer_Odom_Angular_Step03.png|Step03]]
[[Datei:JetRacer_Odom_Angular_Step03.png|Step03]]

Version vom 7. Januar 2025, 18:06 Uhr

Falls der Roboter nicht geradeaus fährt wenn man eine gerade Bewegung eingibt, könnte es daran liegen das die Räder beim Aufbau leicht versetzt montiert wurden. Dies kann durch eine Änderung des Fahrtwinkels kompensiert werden. In diesem Tutorial: Robot Odometer Calibration wird beschrieben wie man den Winkel einstellen kann. Außerdem nützlich dafür ist dieser Beitrag: Editing Cfg Files in Linux welcher erklärt wie man eine config Datei in Linux bearbeitet.

Einführung

  • Der Roboter kann Kilometerzählerinformationen ausgeben, um zu erfahren, wie weit der Roboter gefahren ist und wie viel er sich gedreht hat. Es kann jedoch zu Fehlern zwischen dem Kilometerzähler und den vom Standardprogramm ausgegebenen Informationen kommen. Der Kilometerzähler kann aber, durch das anpassen von Parametern, so kalibriert werden, das eine höhere Genauigkeit erreicht wird.

Roboter Orientierung kalibrieren

  • Connect the robot by SSH to open the terminal, and enter the following command to enable the chassis node.
  • The chassis node of the robot should not be enabled repeatedly, otherwise, it will go wrong. If the chassis node has not been closed, you do not need to enable it again.
roslaunch jetracer jetracer.launch        #Enable the robot chassis node

Step01

  • Press "Ctrl + Alt + t" to open the new terminal in the Ubuntu virtual terminal, and enter the following command to enable the keyboard to control the topic nodes.
roslaunch jetracer keyboard.launch

Step02

  • Press the "I" key on the keyboard to control the robot to move forward, and observe whether the robot moves in a straight line. If the robot is biased to one side, it can be calibrated in the following way.
  • Open a new terminal again and run the following command to start the rqt_reconfig tool
rosrun rqt_reconfigure rqt_reconfigure

Step03

  • Adjust the value of servo_bias and modify the initial offset of the servo until the robot can move in a straight line.
  • Dynamic parameter adjustment will only affect the running effect at this time, the parameters will not be saved in the parameter file, and will not affect the next startup. Parameters need to be saved to the jetracer_ros/cfg/jetracer.cfg file.
vi ~/catkin_ws/src/jetracer_ros/cfg/jetracer.cfg
  • Modify the servo_bias line, modify the fifth parameter to the value just set and save it.

Step04

Roboter Distanz & Geschwindigkeit kalibrieren

  • The linear calibration startup program has already started the robot chassis node by default, please close the robot chassis node that was started earlier, and keep the "robot master node" running, otherwise an error will be prompted after running the command.
  • Open a terminal in Jetson Nano and run the following commands to enable the program of linear velocity calibration.
roslaunch jetracer calibrate_linear.launch

Step01

  • Do not close after enabling, otherwise you will not see the calibration option in the virtual machine command box.
  • Run the following commands in the virtual machine and open the dynamic parameter configure interface. If the program of linear velocity calibration runs normally, you can see the "calibrate_linear" option.
rosrun rqt_reconfigure rqt_reconfigure

Step02

  • Among which:
    • Test_distance: the test distance, the default is 1m.
    • Speed is the linear speed of the robot.
    • Tolerance is the error to reach the goal. If the error is too small, it will shake at the target position, otherwise, the error of reaching the target point will be very large.
    • odom_linear_scale_correction is the odometer scaling, and the final corrected value is the linear speed calibration parameter.
    • Start_test starts robot calibration.
  • Put the robot on the ground, mark the robot position, check start_test, the robot starts to move, wait for the robot to stop, and measure the robot movement distance. Record the ratio of the movement distance divided by the target distance, and multiply odom_linear_scale_correction by this ratio as a new parameter. Repeat the test until the actual movement distance is 1m.
  • For example, if the movement is set to 1m and the actual operation is 1.2m, the ratio is 1.2, and the odom_linear_scale_correction is updated to 1x1.2, that is, 1.2 to start the test again. If the effect is satisfactory, the linear calibration parameter is 1.2. If the actual movement is 1.1m, then the odom_linear_scale_correction is updated to 1.2* 1.1 is 1.32. Repeat this until you are satisfied with the effect.

Step03

  • Enter the following command in jetson nano, open the catkin_ws/src/jetracer_ros/launch/jetracer.launch file, and modify the value of linear_correction to the odom_linear_scale_correction calibration parameter obtained from the calibration just now. Start the calibration procedure again to actually walk a distance of 1m.
vi ~/catkin_ws/src/jetracer_ros/launch/jetracer.launch       #Modify calibration parameters

Step04

Kurven Geschwindigkeit kalibrieren

  • Since the rotation angle of the servo is not equal to the steering angle of the tire, we need to collect the steering angle of the tire under different servo angles, and then use a polynomial to fit the relationship between the two.
  • The calibration process of the servos is more complicated. If the requirements are not high, you can skip this step and not re-calibrate.
  • The following trinomial fitting is used in the program, where x represents the steering angle of the tire, y represents the rotation angle of the servo, and servo_bias is the linear calibration parameter. Under normal circumstances, this item should be 0. a,b,c, and d are fitting parameters.
y = a*x^3 + b*x^2 + c*x + d + servo_bias.
  • Before calibrating, you need to unplug the motor wire to keep the motor in a free state. At the same time, it is necessary to modify the parameters so that the servo can directly control its steering, that is, y = x. Therefore, a, b, d, servo_bias are all set to 0, and c is set to 1.
  • Open the jetracer_ros/cfg/jetracer.cfg file and set servo_bias to 0. Modify the servo_bias line, modify the fifth parameter to 0 and save it.
vi ~/catkin_ws/src/jetracer_ros/cfg/jetracer.cfg

Step01

  • Open jetracer_ros/launch/jetracer.launc file and set "coefficient_a, coefficient_b, coefficient_d" to 0, and set coefficient_a to 1.
vi ~/catkin_ws/src/jetracer_ros/launch/jetracer.launch

Step02

  • Connect the robot by SSH, open the terminal, and enter the following commands to enable the chassis node of the robot.
  • Do not enable the chassis node of the robot repeatedly, otherwise it will be in error. If you have not close the chassis node, you do not need to enable it again.
roslaunch jetracer jetracer.launch      #Start the robot chassis node
  • Enable the topic publishing function by the command of "rqt_publisher" in the virtual machine, choose "/cmd_vel" to add more topic information.
rosrun rqt_publisher rqt_publisher

Step03