ROS By Example_hydro_volume1_CN_6,7

来源:互联网 发布:淘宝衣服怎么换货 编辑:程序博客网 时间:2024/05/21 11:37
6. INSTALLING THE ARBOTIX SIMULATOR
    To test our code on a simulated robot, we will use the arbotix_python simulator found in the ArbotiX stack by Michael Ferguson.

7. CONTROLLING A MOBILE BASE
    In this chapter we will learn how to control a mobile base that uses a pair of differential drive wheels and a passive caster wheel for balance. ROS can also be used to control an omni-directional base as well as flying robots or underwater vehicles but a land-based differential drive robot is a good place to start.
    在本章中,我们将学习如何控制使用一对差分驱动轮和被动脚轮平衡的移动平台。ROS也可以用来控制万向平台以及飞行机器人或水下车辆,但陆基差分驱动机器人是一个良好的开端。

7.1 Units and Coordinate Systems

7.1单位和坐标系


    Before we can send movement commands to our robot, we need to review the measurement units and coordinate system conventions used in ROS.

    在我们把移动命令发送给我们的机器人之前,我们需要查看ROS使用的测量单位和坐标系约定。


    When working with reference frames, keep in mind that ROS uses a right-hand convention for orienting the coordinate axes as shown on left. The index and middle fingers point along the positive x and y axes and the thumb points in the direction of the positive z axis. The direction of a rotation about an axis is defined by the right-hand rule shown on the right: if you point your thumb in the positive direction of any axis, your fingers curl in the direction of a positive rotation. For a mobile robot using ROS, the x-axis points forward, the y-axis points to the left and the z-axis points upward. Under the right-hand rule, a positive rotation of the robot about the z-axis is counterclockwise while a negative rotation is clockwise.

    用参考坐标,记住,ROS使用右手定则定向坐标轴,如图左侧。的食指和中指沿正x和y轴以及在正z轴方向上的拇指点指向。一个绕轴旋转的方向被定义为右侧所示的右手法则:如果你点任何轴的正方向拇指,手指蜷缩在一个正向旋转的方向。对于使用ROS的移动机器人,x轴点向前,y轴指向左侧和z轴点向上。根据右手定则,围绕z轴的机器人的正旋转是逆时针而负顺时针旋转。


    Remember also that ROS uses the metric system so that linear velocities are always specified in meters per second (m/s) and angular velocities are given in radians per second (rad/s). A linear velocity of 0.5 m/s is actually quite fast for an indoor robot (about 1.1 mph) while an angular speed of 1.0 rad/s is equivalent to about one rotation in 6 seconds or 10 RPM. When in doubt, start slowly and gradually increase speed. For an indoor robot, I tend to keep the maximum linear speed at or below 0.2 m/s.
    也请记住,ROS使用公制系统,始终指定线速度是每秒(米/秒)和角速度米每秒(弧度/秒)弧度。为0.5米/秒的线性速度实际上是相当快的室内机器人(约1.1英里),而为1.0弧度/秒的角速度相当于6秒左右旋转一周或10的RPM。如果有疑问,慢慢开始,逐渐增加速度。对于室内机器人予倾向于保持最大的线性速度等于或低于0.2米/秒。

7.2 Levels of Motion Control

7.2水平运动控制


    Controlling a mobile robot can be done at a number of levels and ROS provides methods for most of them. These levels represent different degrees of abstraction, beginning with direct control of the motors and proceeding upward to path planning and SLAM (Simultaneous Localization and Mapping).

    可以在多个层面进行控制移动机器人和ROS为它们大多数提供了方法。这些级别代表了不同程度的抽象,首先是直接控制电机,向上到路径规划和SLAM(同步定位与地图)。


7.2.1 Motors, Wheels, and Encoders

7.2.1电机,车轮,和编码器


    Most differential drive robots running ROS use encoders on the drive motors or wheels. An encoder registers a certain number of ticks (usually hundreds or even thousands) per revolution of the corresponding wheel. Knowing the diameter of the wheels and the distance between them, encoder ticks can be converted to the distance traveled in meters or the angle rotated in radians. To compute speed, these values are simply divided by the time interval between measurements.

    大多数运行ROS的差分驱动机器人使用编码器来驱动电机或轮子。编码器存储一定数量每个相应车轮的转速刻度(成百上千)。知道车轮的直径和它们之间的距离,编码器刻度可以转换为以米行进的距离或以弧度的角度旋转。计算速度,这些值由测量之间的时间间隔简单地划分。


    This internal motion data is collectively known as odometry and ROS makes heavy use of it as we shall see. It helps if your robot has accurate and reliable encoders but wheel data can be augmented using other sources. For example, the original TurtleBot uses a single-axis gyro to provide an additional measure of the robot's rotational motion since the iRobot Create's encoders are notably inaccurate during rotations.

    该内部运动数据统称为测距,并且ROS大量使用了这些数据,正如我们将要看到的。它帮助,如果你的机器人具有准确而可靠的编码器,但轮的数据可以通过其他途径补充。例如,原来的TurtleBot使用单个轴陀螺仪来提供附加测量机器人的旋转运动,因为iRobot公司创建编码器中的旋转显着不正确的。


    It is important to keep in mind that no matter how many sources of odometry data are used, the actual position and speed of the robot in the world can (and probably will) differ from the values reported by the odometry. The degree of discrepancy will vary depending on the environmental conditions and the reliability of the odometry sources.

    重要的是要记住,无论使用多少不同来源的测距数据,机器人在世界的实际位置和速度可以(并且很可能)与测距报告的值不同。差异程度将根据环境条件和测距源来源的可靠性而改变。


7.2.2 Motor Controllers and Drivers
7.2.2电机控制器和驱动器
    At the lowest level of motion control we need a driver for the robot's motor controller that can turn the drive wheels at a desired speed, usually using internal units such as encoder ticks per second or a percentage of max speed. With the exception of the Willow Garage PR2 and TurtleBot, the core ROS packages do not include drivers for specific motor controllers. However, a number of third-party ROS developers have published drivers for some of the more popular controllers and/or robots such as the Arduino, ArbotiX, Serializer, Element, LEGO® NXT and Rovio. (For a more complete list of supported platforms, see Robots Using ROS.)

    在运动控制的最低级,我们需要一个机器人的电机控制器的驱动,此驱动可以以所需的速度驱动车轮,通常使用内部单位例如每秒编码刻度或者每最大速度百分比。唯一的例外是Willow Garage的PR2和TurtleBot,核心ROS包不包括特定的电机控制器的驱动程序。然而,一些第三方ROS开发者发布一些比较流行的控制器和/或机器人的驱动,如Arduino的,ArbotiX,Serializer(串行),元,乐高NXT和Rovio。 (有关支持的平台的完整列表,请参阅机器人使用ROS)。


7.2.3 The ROS Base Controller
    At the next level of abstraction, the desired speed of the robot is specified in real-world units such as meters and radians per second. It is also common to employ some form of PID control. PID stands for "Proportional Integral Derivative" and is so-named because the control algorithm corrects the wheel velocities based not only on the difference (proportional) error between the actual and desired velocity, but also on the derivative and integral over time. You can learn more about PID control on Wikipedia. For our purposes, we simply need to know that the controller will do its best to move the robot in the way we have requested.

    在抽象的下一级,机器人的期望速度指定为真实世界的单位,例如米每秒和弧度每秒。它也是通常使用某种形式的PID控制。 PID代表“比例积分微分”并且被如此命名,是因为控制算法修正车轮速度 不仅基于实际和期望的速度之间的差(比例),但基于随时间的微积分。您可以在维基百科上了解更多关于PID控制。对于我们而言,我们只需要知道,控制器将尽最大努力朝着我们所要求的方式移动机器人。


    The driver and PID controller are usually combined inside a single ROS node called the base controller. The base controller must always run on a computer attached directly to the motor controller and is typically one of the first nodes launched when bringing up the robot. A number of base controllers can also be simulated in Gazebo including the TurtleBot, PR2 and Erratic.

    驱动器和PID控制器通常结合在单一ROS节点内,这个节点称为主控制器。主控制器必须总是在计算机上运行,这个计算机直接连接到电机控制器。这个主控制器通常是启动机器人时首先启动的节点之一。一些主控制器还可以在Gazebo上模拟,Gazebo包括TurtleBot,PR2和Erratic(不稳定)。


    The base controller node typically publishes odometry data on the /odom topic and listens for motion commands on the /cmd_vel topic. At the same time, the controller node typically (but not always) publishes a transform from the /odom frame to the base frame—either /base_link or /base_footprint. We say "not always" because some robots like the TurtleBot, uses the robot_pose_ekf package to combine wheel odometry and gyro data to get a more accurate estimate of the robot's position and orientation. In this case, it is the robot_pose_ekf node that publishes the transform from /odom to /base_footprint. (The robot_pose_ekf package implements an Extended Kalman Filter as you can read about on the Wiki page linked to above.)

    主控制器节点通常在 /odom(用来测距)话题上发布测距数据,并监听/cmd_vel话题上的运动命令。同时,通常控制器节点(但不总是)发布一个从/odom坐标到基坐标的转换--要么到/ base_link或/ base_footprint的转换。我们说“不总是”,因为一些机器人像TurtleBot,采用robot_pose_ekf包结合车轮测距和陀螺仪数据以获得所述机器人的位置和方向的更精确的估计。在这种情况下,robot_pose_ekf节点发布从/odom 到/ base_footprint的变换。 (该robot_pose_ekf包实现扩展卡尔曼滤波器,正如你可以连接到上面的维基页面上阅读。)


    Once we have a base controller for our robot, ROS provides the tools we need to issue motion commands either from the command line or by using other ROS nodes to publish these commands based on a higher level plan. At this level, it does not matter what hardware we are using for our base controller: our programming can focus purely on the desired linear and angular velocities in real-world units and any code we write should work on any base controller with a ROS interface.

    一旦我们有我们的机器人的主控制器,ROS提供了我们需要处理运动命令的工具,无论命令来自命令行或通过使用其他ROS节点发布基于一个更高的层次规划的命令。在这个层面上,对于我们主控制器,我们使用什么硬件都不重要:我们的程序能完全专注于真实世界单位的所需的线速度和角速度,我们写的任何代码应该能够通过一个ROS 接口工作在任何主控制器上。


7.2.4 Frame-Base Motion using the move_base ROS Package
7.2.4使用move_base ROS包的基于坐标运动
    At the next level of abstraction, ROS provides the move_base package that allows us to specify a target position and orientation of the robot with respect to some frame of reference; move_base will then attempt to move the robot to the goal while avoiding obstacles. The move_base package is a very sophisticated path planner and combines odometry data with both local and global cost maps when selecting a path for the robot to follow. It also controls the linear and angular velocities and accelerations automatically based on the minimum and maximum values we set in the configuration files.

     在抽象的下一层,ROS提供了move_base包。move_base包允许我们指定一个相对于某些参考系的机器人目标位置和方向; move_base之后尝试将机器人移动到目标位置和方向,同时避开障碍物。该move_base包是一个非常复杂的路径规划,并且move_base包在选择机器人遵循的路径时,结合了本地和全球成本的地图的测距数据。它也自动基于最小和最小值控制线速度、角速度和加速度(我们在配置文件中设置最大值和最小值)。


7.2.5 SLAM using the gmapping and amcl ROS Packages
7.2.5 使用映射和AMCL ROS包的SLAM
    At an even higher level, ROS enables our robot to create a map of its environment using the SLAM gmapping package. The mapping process works best using a laser scanner but can also be done using a Kinect or Asus Xtion depth camera to provide a simulated laser scan. If you own a TurtleBot, the TurtleBot stack includes all the tools you need to do SLAM.

    在一个更高的层次,ROS能够让我们的机器人创建一个地图。创建地图的环境使用SLAM gmapping包。地图创建过程最好效果是使用激光扫描仪,但也可以使用Kinect(超高动力学)或华硕Xtion深度摄像头,来提供一个模拟的激光扫描。如果你拥有一个TurtleBot,TurtleBot堆包含了所有你需要做的SLAM的工具。


    Once a map of the environment is available, ROS provides the amcl package (adaptive Monte Carlo localization) for automatically localizing the robot based on its current scan and odometry data. This allows the operator to point and click on any location on a map and the robot will find its way there while avoiding obstacles. (For a superb introduction to the mathematics underlying SLAM, check out Sebastian Thrun's online Artificial Intelligence course on Udacity.)

    一旦环境地图是可用的,ROS提供了amcl包(自适应蒙特卡洛本地化)用来根据它的当前扫描和测距数据自动定位的机器人。这允许操作者指向和点击在地图上任意位置,机器人能够找到去那里的路径,同时避开障碍物。(对于一个极好的介绍基本SLAM数学,看看塞巴斯蒂安史朗的在线人工智能课程Udacity。)


7.2.6 Semantic Goals
7.2.6语义目标
    Finally, at the highest level of abstraction, motion goals are specified semantically such as "go to the kitchen and bring me a beer", or simply, "bring me a beer". In this case, the semantic goal must be parsed and translated into a series of actions. For actions requiring the robot to move to a particular location, each location can be passed to the localization and path planning levels for implementation. While beyond the scope of this volume, a number of ROS packages are available to help with this task including smach, executive_teer, worldmodel, semantic_framer, and knowrob.

    最后,在抽象的最高水平,运动目标在语义上指定,如“去厨房给我拿啤酒”,或者简单地说,“给我一杯啤酒”。在这种情况下,语义目标必须被解析并翻译成一系列的动作。对于需要的机器人移动到特定位置的动作,每个位置都要传递到定位和路径规划层去实施。虽然超出了本卷的范围,一些ROS包可以帮助完成这个任务,包括smach,executive_teer,worldmodel,semantic_framer和knowrob。


7.2.7 Summary
    In summary, our motion control hierarchy looks something like this:
     总之,我们的运动控制层次看起来是这样的:
Goal
AMCL(acml包:用来根据它的当前扫描和测距数据自动定位的机器人)
Path Planner(路径规划)
move_base (move_base包允许我们指定一个相对于某些参考系的机器人目标位置和方向,也有路径规划)
/cmd_vel + /odom
Base Controller
Motor Speeds
    In this chapter and the next, we will learn how to use these levels of motion control. But before we can understand the more powerful features provided by move_base, gmapping and amcl, we need to start with the basics.
    在本章和下一章中,我们将学习如何使用这些运动控制层。但在此之前,我们要理解move_base,gmapping和AMCL提供更强大的功能,我们需要从基础开始。

/home/buslab/Desktop/ROSbyExample_cn


0 0
原创粉丝点击