简单介绍Player的configure文件

本文介绍了Player的configure文件,用于定义机器人硬件资源的控制方式。configure文件基于Player的接口、驱动和设备概念,通过driver将数据映射到device interface。文中以Pioneer机器人和SICK激光雷达为例,解释了如何配置p2os和sicklms200驱动,以及设备接口的使用。此外,还简单提及了Stage和Gazebo的configure文件区别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、对实物机器人的Configure  .cfg文件

通过Player控制机器人的时候首先应该要做的就是要告诉Player机器人上到底有什么硬件资源需要进行控制。

configure (.cfg)文件就是用来通知Player的:它的内容决定了Player的控制对象。

就好比这样一个函数:y=f(x)

这里的y是Player ,属于软件;x是需要控制的硬件;用来反映它们之间关系的映射f,就是configure文件。

Configure的语法结构基于Player的三个核心概念,即接口,驱动,和设备

There are 3 key concepts in Player[1]:

  • interface : A specification of how to interact with a certain class of robotic sensor, actuator, or algorithm. The interface defines the syntax and semantics of all messages that can be exchanged with entities in the same class.

  • driver : A piece of software (usually written in C++) that talks to a robotic sensor, actuator, or algorithm, and translates its inputs and outputs to conform to one or more interfaces. The driver's job is hide the specifics of any given entity by making it appear to be the same as any other entity in its class.

  • device : A driver bound to an interface, and given a fully-qualified address. All messaging in Player occurs among devices, via interfaces. The drivers, while doing most of the work, are never accessed directly.

用一句话概括它们之间的关系:driver把得到的数据映射到绑定在其上的相应的device interface。

Pioneer3AT with sonar, also attached with GPS, SICK LMS200 Laser, ARM, CAMERA

接着看通过一个例程分析它的语法:我的机器人平台是Pioneer 系列mobile robot,使用SICK LMS200 laser range-finder.于是我建立一个名为pioneer.cfg的文件,内容如下:

第一段说明这个configure file 使用“p2os” driver接入机器人的Motor.并通过端口 "/dev/ttyS0"(即串口0)与device通信;并把把机器人从motors和encoders得到的数据映射到 "position2d:0"。

(接口前缀“odometry:::”是说明这个接口返回的是量程计测的数据;后缀:0为序号,表示第一个型为position2d 的device interface)

第二段说明用名为“sicklms200”的driver通过串行口"/dev/ttyS1" 接入SICK laser,并映射数据到device interface
“laser:0”。

第三段有点特别,它多了一行:requires ["position2d:0" "laser:0"]

这个名为 vfh 的driver是一个实现了navigation和obstacle-avoidance算法的驱动, 这里算法的实现需要两个设备接口: position2d:0及 laser . (即Navigation算法基于position2d实现,OA算法基于laser实现)vfh 通过提供一个position2d:1 device interface, 经过算法处理得到的“target poses”将被送给这个device .

再进一步看一下driver:

以我们最常用的“p2os”为例。这个驱动是为 ActivMedia系列的机器人专门打造,所以很常用。

一个“p2os" driver支持的众多设备如:position2d, power, sonar, arm, gripper, bumper, blobfinder...;其中,仅position2d就可设定三种返回值[3]

所以,如果需要用到其它设备,就需要在CFG文件里例出相应的设备名称:

如果这个用到p2os不支持的设备,则需要用单独的driver,如上面例子的sicklms200 laser ranger finder,就需要用名为”sicklms200“的driver。如果我还用到了上图中的摄像头:sonyevid30,那么我就要用到相应的driver:

注:

所有Player支持的Driver列表参考libplayerdrivers

所有Player支持的Device Interface列表参考:libplayercore


2. 对于Stage和Gazebo的Configure .cfg文件

对仿真工具Stage和Gazebo而言,它们的cfg文件就另当别论了。因为Player对于Stage的支持是基于libstageplugin的,所以对于stage,Player只用到一个名叫"stage"的driver,这个driver仅能够提供blobfinder,camera,fiducial,laser,position,ranger, gripper等几个device interface.


类似的,对于Gazebo, Player也只用到一个"gazebo"的driver,通过”libgazeboplugin“作用,提供的device interface比起stage还有限:


未完待续...
$ player pioneer.cfg


更多例程请见/usr/local/share/player/config.

参考:
[1] Interface, Driver, Device  "Player Manual 2.1.1"

[2] Writing Configuration Files "Player Manual 2.1.1"

[3] p2os [Drivers] "Player Manual 2.1.1"

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值