话题move_base/result,获取状态
Action Published Topics
move_base/feedback (move_base_msgs/MoveBaseActionFeedback)
Feedback含有基座当前位置信息
move_base/status (actionlib_msgs/GoalStatusArray)
携带目标执行的状态信息
move_base/result (move_base_msgs/MoveBaseActionResult)
对于move_base action的result为空
状态返回的是数字,数字代表的含义在actionlib_msgs/GoalStatus.msg中定义了
# 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
头文件
源代码:获取到达目标的状态
订阅话题
move_base/feedback (move_base_msgs/MoveBaseActionFeedback)
Feedback含有基座当前位置信息
move_base/status (actionlib_msgs/GoalStatusArray)
携带目标执行的状态信息
move_base/result (move_base_msgs/MoveBaseActionResult)
对于move_base action的result为空
状态返回的是数字,数字代表的含义在actionlib_msgs/GoalStatus.msg中定义了
# 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
头文件
from move_base_msgs.msg import *
#include <move_base_msgs/MoveBaseAction.h>
#include <move_base_msgs/MoveBaseGoal.h>
源代码:获取到达目标的状态
void status_callback(const move_base_msgs::MoveBaseActionResult& msg)
{
if(msg.status.status == 3)
{
std::cout<<"the goal was achieved successfully!"<<std::endl;
}
}
订阅话题
ros::Subscriber goal_sub =n.subscribe("move_base/result", 10, status_callback);
0 个回复