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

How to get robot Trajectory from move_base

asked 2017-04-20 13:07:28 -0500

Atika gravatar image

updated 2017-04-30 13:52:06 -0500

Hello, I am new to ROS, and I am currently working on an android app to guide people in an indoor environment. I am using a picture of the environment and I would like to show on it the robot trajectory as shown on rviz. Is it possible? I tried to use a subscriber to the topic /move_base/TrajectoryPlannerROS/global_plan but it seems like the same set of Path messages (x, y, z...) is published periodically whatever the goal is (I noticed that using rostopic echo), while on rviz the trajectory changes. Am I doing it wrong?

Thank you in advance for your help

Edit : Here is what I get on rviz (global plan in pink) :

image description

And what my app draws basing on the x and y from position published on global_plan (the blue line)

image description

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-04-20 21:59:32 -0500

Geoff gravatar image

updated 2017-04-24 00:02:44 -0500

There are three topics that are particularly involved in carrying paths that the robot will follow:

  • plan, published by the global planner (NavfnROS is the default). This is the plan all the way to the goal (or to the edge of a map window, if that parameter is set). It is built based on the costmap, but because the costmap only includes sensor data where sensors are present (most often, this is sensors on the robot) it won't plan around obstacles that are not in the static map and are outside the robot's sensor visibility.
  • global_plan caries the portion of the global plan that the local planner is currently attempting to follow. It is published by the local planner, TrajectoryPlannerROS.
  • local_plan carries the path produced by the local planner, TrajectoryPlannerROS. This is also based on the costmap, but because it is only up to a short distance away it will include navigating around any visible obstacles as well. It also takes into account movement of the robot away from the global plan. This is why it often deviates from exactly matching the global path. Keep in mind that depending on how far ahead the local planner is working, there may not be much to show in the visualisation.

To see where the robot intends to go all the way to the goal, you should look at plan. To see where it plans to go in the short-term future, look at global_plan. To see where it will go immediately, including manoeuvering around obstacles, look at local_plan.

edit flag offensive delete link more


Thank you for your answer. The problem is that when, for example rviz shows a path avoiding obstacles, the path that is drawn on my app subscribed to global_plan is always staight and the robot when it moves on simulation goes straight too. Does rviz or slam alter the trajectory? Or does move_base a

Atika gravatar image Atika  ( 2017-04-21 07:41:44 -0500 )edit

Or does move_base and global_plan do all the work? If so, how does rviz show a different path than the global_plan one?*

Atika gravatar image Atika  ( 2017-04-21 07:44:58 -0500 )edit

OK, sorry, I misunderstood an aspect of your problem. If you want the exact path the robot will travel, not just a path to the goal, then you also need to consider the local_plan topic. This includes avoidance of dynamic obstacles for a short part of the path to the goal. I will update the answer.

Geoff gravatar image Geoff  ( 2017-04-23 23:20:20 -0500 )edit

No no, you did understand my problem. I do want to show the global plan to the goal. But using the position parameters published on the global_plan x and y, I get a wrong path on my app. Do the orientation count when drawing a path? I updated my question with the results I got.

Atika gravatar image Atika  ( 2017-04-30 13:47:16 -0500 )edit

Question Tools


Asked: 2017-04-20 13:07:28 -0500

Seen: 1,525 times

Last updated: Apr 30 '17