ROS actionlib框架解析

ROS actionlib提供了一种在ROS server基础上,支持长时间任务中断和执行反馈的机制。它允许Action Client发送goal请求,Action Server执行并可能被取消。反馈机制允许服务器在执行过程中报告status、result和feedback。在机器人系统中,goal定义关节目标位置和速度,cancel用于取消指令,result指示目标是否成功,status表示机器人状态,feedback则包含关节实时位置和速度信息。

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

actionlib的概念和作用:

ROS wiki的解释为:

In any large ROS based system, there are cases when someone would like to send a request to a node to perform some task, and also receive a reply to the request. This can currently be achieved via ROS services.
In some cases, however, if the service takes a long time to execute, the user might want the ability to cancel the request during execution or get periodic feedback about how the request is progressing. The actionlib package provides tools to create servers that execute long-running goals that can be preempted. It also provides a client interface in order to send requests to the server.

译:在任何基于ros的大型系统中,都存在这样的情况:有人希望向节点发送请求以执行某些任务,同时也希望收到对请求的回复。这目前可以通过ros server实现。
但是,在某些情况下,如果服务需要很长时间才能执行,则用户可能希望能够在执行期间取消请求,或获得有关请求进度的定期反馈。actionlib包提供了创建servers的工具,这些servers执行可以抢占的长期运行目标。它还提供了一个client接口,以便向服务器发送请求。

actionlib设计的目的在于在ROS server机制之上提供可以控制中断以及过程中的反馈的机制,从而使整个系统不会因为某个任务执行时间过长而导致整个系统的阻塞。

我们将此特性应用到ROS系统和机器人底层控制之间的通信上,从而保证上位机对下位机的实时监控。


actionlib的运行机制

在这里插入图片描述
如图,整体的运行机制为:Action Client发送goal请求,Action Server接受并执行goal请求。同时客户端也可以下发cancel请求,服务端会在必要的时刻上报(给客户端)当前的status,result,feedback。

ROS wiki中关于这些消息内容的解释:

Goal
To accomplish tasks using actions, we introduce the notion of a goal that can be sent to an ActionServer by an ActionClient. In the case of moving the base, the goal would be a PoseStamped message that contains information about where the robot should move to in the world. For controlling the tilting laser scanner, the goal would contain the scan parameters (min angle, max angle, speed, etc).

Feedback
Feedback provides server implementers a way to tell an ActionClient about the incremental progress of a goal. For moving the base, this might be the robot’s current pose along the path. For controlling the tilting laser scanner, this might be the time left until the scan completes.

Result
A result is sent from the ActionServer to the ActionClient upon completion of the goal. This is different than feedback, since it is sent exactly once. This is extremely useful when the purpose of the action is to provide some sort of information. For move base, the result isn’t very important, but it might contain the final pose of the robot. For controlling the tilting laser scanner, the result might contain a point cloud generated from the requested scan.

在我们设计的机器人系统中:

  • goal 各个关节的目标位置以及到达目标位置的速度
  • cancel 取消当前目标指令
    .
  • result goal指令是否执行成功
  • status 当前机器人主体是否空闲、工作、故障
  • feedback 对机器人主体各个关节位置和速度的实时反馈

其中,result和feedback需求澄清的一点是:
result只在整个交互中由server发送一次,用来告诉client下发的goal是否执行成功,而feedback是在整个执行过程中多次发送,反馈的内容为当前运行的角度和速度等信息。


主要的逻辑已经描述完成,ROS wiki提供了官方实例
后边会更新我自己设计的面向双臂机器人的整个框架,待续。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值