I would like to send a series of poses to Move Base, and have my robot follow these poses. I am using Move Base Flex, which extends a few extra actions compared to the regular Move Base. I am currently trying to understand how to use ExePathAction.
From what I understand, it allows the controller (i.e. the base local planner) to follow a set of poses. I am trying to give it 5 poses each 0.1 cm apart. What I've written so far:
#include "ros/ros.h"
#include <actionlib/client/simple_action_client.h>
#include <move_base_msgs/MoveBaseAction.h>
#include <mbf_msgs/ExePathAction.h>
#include <mbf_msgs/GetPathAction.h>
#include <mbf_msgs/MoveBaseAction.h>
#include <nav_msgs/Path.h>
typedef actionlib::SimpleActionClient<mbf_msgs::ExePathAction> PathClient;
int main(int argc, char** argv){
ros::init(argc, argv, "simple_path");
PathClient pc("mbf_costmap_nav/exe_path", true); // true doesnt need ros::spin
while(!pc.waitForServer(ros::Duration(5.0))){
ROS_INFO("Waiting for Move Base server to come up");
}
mbf_msgs::ExePathGoal target_path_;
//move_base_msgs::MoveBaseGoal goal;
nav_msgs::Path path_;
path_.header.frame_id = "base_link";
path_.poses[0].pose.position.x = 0.1;
path_.poses[0].pose.position.y = 0.0;
path_.poses[0].pose.orientation.z = 0.0;
path_.poses[0].pose.orientation.w = 1.0;
path_.header.frame_id = "base_link";
path_.poses[1].pose.position.x = 0.2;
path_.poses[1].pose.position.y = 0.0;
path_.poses[1].pose.orientation.z = 0.0;
path_.poses[1].pose.orientation.w = 1.0;
path_.header.frame_id = "base_link";
path_.poses[2].pose.position.x = 0.3;
path_.poses[2].pose.position.y = 0.0;
path_.poses[2].pose.orientation.z = 0.0;
path_.poses[2].pose.orientation.w = 1.0;
path_.header.frame_id = "base_link";
path_.poses[3].pose.position.x = 0.4;
path_.poses[3].pose.position.y = 0.0;
path_.poses[3].pose.orientation.z = 0.0;
path_.poses[3].pose.orientation.w = 1.0;
path_.header.frame_id = "base_link";
path_.poses[4].pose.position.x = 0.5;
path_.poses[4].pose.position.y = 0.0;
path_.poses[4].pose.orientation.z = 0.0;
path_.poses[4].pose.orientation.w = 1.0;
target_path_.path = path_;
pc.sendGoal(target_path_);
pc.waitForResult();
if(pc.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
ROS_INFO("Base moved %s", pc.getState().toString().c_str());
else if(pc.getState() == actionlib::SimpleClientGoalState::ABORTED)
ROS_INFO("Goal aborted");
else
ROS_INFO("Base failed to move for some reason");
return 0;
}
However this doesn't execute. I looked at the legacy relay node which relays classic move_base goals that appear on the move_base_simple/goal topic. However, that's not what I am looking for. I would like to directly use the ExePathAction, as I want to program more sophisticated navigation behaviour in the future.
Originally posted by curi_ROS on ROS Answers with karma: 166 on 2019-01-24
Post score: 0