actionlib_msgs简介及使用

在路径/opt/ros/indigo/share/actionlib_msgs/msg下有三个msg文件:

  1. GoalID.msg

  2. GoalStatus.msg

  3. GoalStatusArray.msg


  • Message: actionlib_msgs/GoalID
  • File: actionlib_msgs/GoalID.msg
  • Raw message definition:
# The stamp should store the time at which this goal was requested.
# It is used by an action server when it tries to preempt all
# goals that were requested before a certain time
time stamp

# The id provides a way to associate feedback and
# result message with specific goal requests. The id
# specified must be unique.
string id

  • Message: actionlib_msgs/GoalStatus
  • File: actionlib_msgs/GoalStatus.msg
  • Raw message definition:
GoalID goal_id
uint8 status
uint8 PENDING         = 0   # The goal has yet to be processed by the action server
uint8 ACTIVE          = 1   # The goal is currently being processed by the action server
uint8 PREEMPTED       = 2   # The goal received a cancel request after it started executing
                            #   and has since completed its execution (Terminal State)
uint8 SUCCEEDED       = 3   # The goal was achieved successfully by the action server (Terminal State)
uint8 ABORTED         = 4   # The goal was aborted during execution by the action server due
                            #    to some failure (Terminal State)
uint8 REJECTED        = 5   # The goal was rejected by the action server without being processed,
                            #    because the goal was unattainable or invalid (Terminal State)
uint8 PREEMPTING      = 6   # The goal received a cancel request after it started executing
                            #    and has not yet completed execution
uint8 RECALLING       = 7   # The goal received a cancel request before it started executing,
                            #    but the action server has not yet confirmed that the goal is canceled
uint8 RECALLED        = 8   # The goal received a cancel request before it started executing
                            #    and was successfully cancelled (Terminal State)
uint8 LOST            = 9   # An action client can determine that a goal is LOST. This should not be
                            #    sent over the wire by an action server

#Allow for the user to associate a string with GoalStatus for debugging
string text

  • Message: actionlib_msgs/GoalStatusArray
  • File: actionlib_msgs/GoalStatusArray.msg
  • Raw message definition:
# Stores the statuses for goals that are currently being tracked
# by an action server
Header header
GoalStatus[] status_list

使用

例如,使用navigation stack导航的机器人停止导航,可以使用如下方式取消所有goal(及发送fullly empty goal),

  • 命令方式
rostopic pub /move_base/cancel actionlib_msgs/GoalID -- {}
  • 代码方式
ros::Publisher cancel_pub =  nh_.advertise("move_base/cancel",1);
actionlib_msgs::GoalID empty_goal;
cancel_pub.publish(empty_goal);

 

你可能感兴趣的:(ROS,ROS,action,actionlib,actionlib_msgs)