ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

[move_base] make_plan service is returning an empty path

asked 2017-06-21 08:47:51 -0500

saken gravatar image

updated 2017-06-21 08:48:47 -0500

Hi!

I am working on autonomous exploration, and I am using move_base package for navigation tasks.

I wanted to use make_plan service of move_base package, but it's returning me an empty path even if the destination is reachable if you send it as a goal.

Has anyone faced with the same issue?

Here the code which calls make_plan service:

geometry_msgs::PoseStamped Start;
    Start.header.seq = 0;
    Start.header.stamp = Time(0);
    Start.header.frame_id = "map";
    Start.pose.position.x = x1;
    Start.pose.position.y = y1;
    Start.pose.position.z = 0.0;
    Start.pose.orientation.x = 0.0;
    Start.pose.orientation.y = 0.0;
    Start.pose.orientation.w = 1.0;

geometry_msgs::PoseStamped Goal;
    Goal.header.seq = 0;
    Goal.header.stamp = Time(0);
    Goal.header.frame_id = "map";
    Goal.pose.position.x = x2;
    Goal.pose.position.y = y2;
    Goal.pose.position.z = 0.0;
    Goal.pose.orientation.x = 0.0;
    Goal.pose.orientation.y = 0.0;
    Goal.pose.orientation.w = 1.0;

ServiceClient check_path = nh_.serviceClient<nav_msgs::GetPlan>("make_plan");
    nav_msgs::GetPlan srv;
    srv.request.start = Start;
    srv.request.goal = Goal;
    srv.request.tolerance = 1.5;

    ROS_INFO("Make plan: %d", (check_path.call(srv) ? 1 : 0));
    ROS_INFO("Plan size: %d", srv.response.plan.poses.size());

Here is the code to send MoveBaseGoal which works and robot moves to the same destination:

move_base_msgs::MoveBaseGoal move_goal;

    move_goal.target_pose.header.frame_id = "map";
    move_goal.target_pose.header.stamp = Time(0);

    move_goal.target_pose.pose.position.x = x;
    move_goal.target_pose.pose.position.y = y;
    move_goal.target_pose.pose.position.z = 0.0;
    move_goal.target_pose.pose.orientation.x = 0.0;
    move_goal.target_pose.pose.orientation.y = 0.0;
    move_goal.target_pose.pose.orientation.w = 1.0;

    ROS_INFO("Sending goal");
    ac_.sendGoal(move_goal,
             boost::bind(&ExploreAction::doneCb, this, _1, _2));
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-09-07 20:12:09 -0500

Jacbo gravatar image

you need to check service name.

ServiceClient check_path = nh_.serviceClient<nav_msgs::getplan>("make_plan");

--> ServiceClient check_path = nh_.serviceClient<nav_msgs::getplan>("/move_base/make_plan");

Thanks.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-06-21 08:47:51 -0500

Seen: 1,647 times

Last updated: Jun 21 '17