Robotics StackExchange | Archived questions

How to create an action server for navigation?

I have created my own robot and already created a 2d map using gmapping with laser. The simple amcl localization is used in rviz (laser - particle filter) and my robot is able to localize in a created pmg map in rviz. Now, I want to send a goal coordinates for my robot for it to navigate within a map and I have created a new package and a new node like following this tutorial: http://wiki.ros.org/navigation/Tutorials/SendingSimpleGoals

I can see that it waits for the server and when I launch this node, I get the move_base/goal topic but the client just awaits. How can I create this server?

Asked by stevemartin on 2018-10-16 03:37:00 UTC

Comments

So you are stuck here I guess:

  while(!ac.waitForServer(ros::Duration(5.0))){
    ROS_INFO("Waiting for the move_base action server to come up");
  }

Is this message showing all the time? Also do you have move_base running?

Asked by pavel92 on 2018-10-16 03:50:12 UTC

You should look into the actionlib doc and also the action lib tutorials to understand the basics of it first.

Asked by Delb on 2018-10-16 03:56:43 UTC

@pavel92 Yes, it shows every 5 seconds. It is running.

Asked by stevemartin on 2018-10-16 04:55:19 UTC

@Delb I have read that tutorial, in Action Server CPP file, they have included chores::DoDishesGoalConstPtr& goal in void execute. What will be equivalentvent to that in move_base_msgs::MoveBaseAction ?

Asked by stevemartin on 2018-10-16 05:20:32 UTC

You should continue investigating the tutorials it's explained (here). For move_base that should be move_base_msgs::MoveBaseGoalConstPtr& goal

Asked by Delb on 2018-10-16 05:33:02 UTC

@stevemartin: what sort of robot do you have? A differential drive platform?

If so: unless you want to learn how to write your own action server for this, I would suggest to use one of the available diff drive packages or ros_control plugins. That will save you quite some time.

Asked by gvdhoorn on 2018-10-16 05:36:09 UTC

@gvdhoorn Yes, a mobile robot. I can see that the plugin is responsible for the movement and I believe it publishes to /cmd_vel topic. But I was looking for the navigation of my robot. I want to send a goal coordinates and let my robot to navigate to that point (in known map).

Asked by stevemartin on 2018-10-16 06:00:12 UTC

The navigation stack is typically responsible for consuming nav goals and then transforming those into Twist msgs published on cmd_vel topics that ultimately make the robot move.

It's rare for someone to write their own MoveBaseGoal consumer.

Asked by gvdhoorn on 2018-10-16 06:03:55 UTC

@gvdhoorn Can you point on the source where I can achieve that? I am quite lost and probably did wrong by writing MoveBaseGoal

Asked by stevemartin on 2018-10-16 06:20:25 UTC

wiki/navigation.

Asked by gvdhoorn on 2018-10-16 06:27:15 UTC

if you can post the code of your node. It will be easier to debug.

Asked by pavel92 on 2018-10-17 01:51:43 UTC

Even I'm stuck in here, after doing all the tutorials!

Asked by pmuthu2s on 2018-10-21 16:54:46 UTC

Answers

I had the similar situation a while ago when the move_base action server was not coming up. The reason was that move_base and the node where the action client was created were in different namespaces. After they were put in the same namespace the problem was solved.

Asked by pavel92 on 2018-11-01 03:29:32 UTC

Comments