【 rbx1翻译 第七章、控制移动基座】第四节、校准机器人的里程表

7.4 Calibrating Your Robot’s Odometry (校准机器人的里程表)

如果您没有机器人,则可以完全跳过本节。 如果您有原始的TurtleBot(以iRobot Create为基础),请确保使用自动校准例程来设置机器人的角度校正系数。 您仍然可以使用本节的第一部分来设置线性校正系数。 请注意,在所有情况下,对于不同类型的地板表面,您可能需要使用不同的校准参数。 例如:地毯与硬木。 管理不同参数的最简单方法是为每个地面使用不同的启动文件。
If you don’t have a robot, you can skip this section altogether. If you have an original TurtleBot (using the iRobot Create as a base), be sure use to use the automated calibration routine to set the angular correction factors for your robot. You can still use the first part of this section to set the linear correction factor. Note that in all cases you might have to use different calibration parameters for different types of floor surfaces; e.g. carpet versus hardwood. The easiest way to manage the different parameters is to use different launch files for each surface.

如果您使用自己的定制机器人,则可能已经拥有自己的校准方法。 如果是这样,您可以安全地跳过此部分。 否则,请继续阅读。
If you are using your own custom built robot, you might already have your own calibration method. If so, you can safely skip this section. Otherwise, read on.

在运行校准例程之前,请确保使用以下命令获取Orocos kinematics(运动学) packages:
Before running the calibration routines, be sure to get the Orocos kinematics packages using the command:

sudo apt-get install ros-indigo-orocos-kdl \
ros-indigo-python-orocos-kdl

rbx1_nav软件包包括两个校准脚本:calibrate_linear.py和calibrate_angular.py。 第一次尝试通过监视/ odom话题将机器人向前移动一米,并在报告的距离距目标1厘米以内时停止。 您可以通过编辑脚本或使用rqt_reconfigure来调整目标距离和移动速度。 第二个脚本再次通过监视/ odom主题将机器人旋转360度。 我们将在接下来的两节中介绍如何根据结果调整PID参数。
The rbx1_nav package includes two calibration scripts: calibrate_linear.py and calibrate_angular.py . The first attempts to move the robot 1 meter forward by monitoring the /odom topic and stopping when the reported distance is within 1 cm of the target. You can adjust the target distance and movement speed by editing the script or by using rqt_reconfigure . The second script rotates the robot 360 degrees, again by monitoring the /odom topic. We’ll describe how to adjust your PID parameters based on the results in the next two sections.

7.4.1 Linear Calibration (线性校正)

首先,请确保您的机器人前面有足够的空间-至少2米,默认测试距离为1.0米。 使用卷尺,在地板上铺设至少1米长的胶带,并将胶带的起始端对准机器人上的一些可识别标记。 旋转机器人,使其与胶带平行。
First make sure you have plenty of room in front of your robot—at least 2 meters for the default test distance of 1.0 meters. Using a tape measure, lay out at least 1 meter of tape on the floor and align the starting end of the tape with some identifiable mark on your robot. Rotate the robot so that it is aimed parallel to the tape.

接下来,使用适当的启动文件打开机器人的基本控制器。 对于基于iRobot Create的TurtleBot,使用ssh连接机器人的笔记本电脑并运行:
Next, bring up your robot’s base controller with the appropriate launch file. For an iRobot Create based TurtleBot, ssh into the robot’s laptop and run:

roslaunch rbx1_bringup turtlebot_minimal_create.launch

接下来,运行线性校准节点:
Next, run the linear calibration node:

rosrun rbx1_nav calibrate_linear.py

最终,运行rqt_reconfigure:
Finally, run rqt_reconfigure :

rosrun rqt_reconfigure rqt_reconfigure

在rqt_reconfigure窗口中选择calibrate_linear节点。 开始测试前,请选中start_test旁边的复选框。 (如果机器人没有开始移动,请取消选中该复选框,然后再次选中它。)您的机器人应向前移动约1.0米。 要获取校正系数,请按照下列步骤操作:
Select the calibrate_linear node in the rqt_reconfigure window. To start the test, check the checkbox beside start_test . (If the robot does not start moving, un-check the checkbox then check it again.) Your robot should move forward approximately 1.0 meters. To get the correction factor, follow these steps:

  • Measure the actual distance with the tape and make a note of it.(使用尺子测量真实移动距离,并且在上面做上标记)
  • Divide the actual distance by the target distance and make a note of the ratio. (用实际距离 / 目标距离并记下比例。)
  • Return to the rqt_reconfigure GUI and multiply the odom_linear_scale_correction value by the ratio you just computed. Set the parameter to the new value. (返回到rqt_reconfigure GUI并将odom_linear_scale_correction值乘以您刚刚计算的比例。 将参数设置为新值。)
  • Repeat the test by moving the robot back to the start of the tape, then checking the start_test checkbox in the rqt_reconfigure window. (通过将机器人移回到胶带的开头,然后在rqt_reconfigure窗口中选中start_test复选框来重复测试。)
  • Continue repeating the test until you are satisfied with the result. An accuracy of 1 cm in 1 meter is probably good enough. (继续重复测试,直到对结果满意为止。 1米左右的话,相差1厘米的精度就足够了。)

拥有最终校正系数后,您需要使用适当的启动文件将其应用于机器人基本控制器的参数。 对于TurtleBot,将以下行添加到您的turtlebot.launch文件中:
With your final correction factor in hand, you need to apply it to the parameters of your robot’s base controller using the appropriate launch file. For a TurtleBot, add the following line to your turtlebot.launch file:

<param name="turtlebot_node/odom_linear_scale_correction" value="X"/>

X就是你的校正系数。
where X is your correction factor.

如果您的机器人使用ArbotiX基本控制器,请编辑YAML配置文件并通过 ticks_meter参数 / 校正系数来更改ticks_meter参数。
If your robot uses the ArbotiX base controller, edit your YAML configuration file and change the ticks_meter parameter by dividing it by your correction factor.

作为最后检查,使用新的校正系数启动机器人的启动文件。 然后运行calibration_linear.py脚本,但将odom_linear_scale_correction参数设置为1.0。 您的机器人现在应该走1.0米,而无需进一步校正。
As a final check, launch your robot’s startup file with the new correction factor. Then run the calibration_linear.py script but with the odom_linear_scale_correction parameter set to 1.0. Your robot should now go 1.0 meters without further correction.

7.4.2 Angular Calibration(角度校准)

如果您有基于iRobot Create的TurtleBot,请不要使用此方法。 而是运行TurtleBot的自动校准程序。
If you have an iRobot Create-based TurtleBot, do not use this method. Instead, run the TurtleBot’s automated calibration procedure.

在此测试中,您的机器人只会在原地旋转,因此空间并不是什么大问题。 在地板上放置一个标记(例如一条胶带),并将其与机器人的前部中心对齐。 我们将机器人旋转360度,看看它距离回到所标记地点的距离。
In this test, your robot will only rotate in place so space is not so much an issue. Place a marker (e.g. a piece of tape) on the floor and align it with the front center of the robot. We will rotate the robot 360 degrees and see how close it comes back to the mark.

用恰当的启动文件启动机器人的基本控制器。 对于原始的TurtleBot(iRobot创建基础),使用ssh连接机器人的电脑并运行:
Bring up up your robot’s base controller with the appropriate launch file. For an original TurtleBot (iRobot Create base), ssh into the robot’s laptop and run:

roslaunch rbx1_bringup turtlebot_minimal_create.launch

接下来,运行角度校准节点:
Next, run the angular calibration node:

rosrun rbx1_nav calibrate_angular.py

最后,运行rqt_reconfigure:
Finally, run rqt_reconfigure :

rosrun rqt_reconfigure rqt_reconfigure

返回到rqt_reconfigure窗口,然后选择calibrate_angular节点。 (如果未看到列出的calibrate_angular节点,请单击GUI界面右上角的蓝色刷新图标。)开始测试前,请选中start_test旁边的复选框。 (如果机器人没有开始移动,请取消选中该复选框,然后再次选中它。)您的机器人应旋转约360度。 如果旋转似乎比完全旋转多得多或少一点,请不要担心。 这就是我们要解决的问题。 要获取校正系数,请按照下列步骤操作:
Return to the rqt_reconfigure window and select the calibrate_angular node. (If you do not see the calibrate_angular node listed, click the blue refresh icon in the upper right corner of the GUI.) To start the test, check the checkbox beside start_test . (If the robot does not start moving, un-check the checkbox then check it again.) Your robot should rotate approximately 360 degrees. Don’t worry if it seems to rotate significantly more or less than a full rotation. That’s what we’re about to fix. To get the correction factor, follow these steps:

  • If the actual rotation falls short of a full 360 degrees, eyeball the fraction it did rotate and enter the estimated fraction in the odom_angular_scale_correction field in the rqt_reconfigure window. So if it looks like the robot rotated about 85% of the way, enter something like 0.85. If it rotated about 5% too far, enter something like 1.05. (如果实际旋转距离不足360度,请注意观察并估计它实际旋转的分数,然后在rqt_reconfigure窗口的odom_angular_scale_correction字段中输入估计的分数。 因此,如果机器人看上去旋转了大约85%,请输入0.85。 如果它额外多旋转了大约5%,则输入1.05。)
  • Repeat the test by realigning the marker with the front center of the robot, then check the start_test checkbox in the rqt_reconfigure window. (通过将标记与机器人的前端中心重新对齐来重复测试,然后在rqt_reconfigure窗口中选中start_test复选框。)
  • Hopefully the rotation will be closer to 360 degrees. If it is still short, decrease the odom_angular_scale_correction parameter a little and try again. If it rotates too far, increase it a little and try again. (我们希望旋转更加接近360度。 如果仍然旋转幅度很小,请稍微减小odom_angular_scale_correction参数,然后重试。 如果旋转幅度太大,请稍微增加一点,然后重试。)
  • Continue the procedure until you are happy with the result. (继续执行该过程,直到对结果满意为止。)

如何处理最终的校正系数取决于基本控制器的PID参数。 对于由ArbotiX基本控制器控制的机器人,请编辑YAML配置文件并通过base_width参数 / 校正系数来更改base_width参数。
What you do with your final correction factor depends on your base controller’s PID parameters. For a robot controlled by the ArbotiX base controller, edit your YAML configuration file and change the base_width parameter by dividing it by your correction factor.

作为最后检查,使用新的校正系数启动机器人的启动文件。 然后运行calibration_angular.py脚本,但将odom_angular_scale_correction参数设置为1.0。 您的机器人现在应该旋转360度,而无需进一步校正。
As a final check, launch your robot’s startup file with the new correction factor. Then run the calibration_angular.py script but with the odom_angular_scale_correction parameter set to 1.0. Your robot should now rotate 360 degrees without further correction.

你可能感兴趣的:(ROS机器人学习,rbx1书籍)