Ask Your Question

How to get a local path from teb local planner without topic?

asked 2019-03-11 11:13:50 -0500

inaba gravatar image

updated 2019-03-12 03:10:31 -0500

I would like to use teb local planner separately from the general navigation stack with my own navigation algorithms. I can initialize the teb planner, set a costmap, a global plan and compute the velocity commands. The teb planner calculates the local path that is seen via Rviz and the path is valid and feasible.

However, I am interested not in getting the velocity commands but only in the local plan (that is published to the topics /local_plan (nav_msgs/Path) or /teb_poses (geometry_msgs/PoseArray). I would like to get the plan not by subscribing to these topics but through code. Is there a way to do this?

I am using ROS Kinetic with Ubuntu 16.04.

Update: To be more clear, I want to get the local path calculated by teb. The local plan is published to the topic /local_plan (nav_msgs/Path). So basically I can write a subscriber to this topic. I am asking whether there is another way to get this path. Like there is a way to get the calculated command velocities through the function bool TebLocalPlannerROS::computeVelocityCommands(geometry_msgs::Twist& cmd_vel).

edit retag flag offensive close merge delete


This sounds like a strange use case. To avoid an xy-problem, could you please update your question by editing it and explain what your actually trying to achieve with this?

mgruhler gravatar image mgruhler  ( 2019-03-12 01:45:19 -0500 )edit

@mgruhler I added an update. Hope now it is more clear.

inaba gravatar image inaba  ( 2019-03-12 03:11:20 -0500 )edit

@inaba, thanks, but I still don't understand your usecase. Are you using move_base with teb_local_planner as the local planner therein? Or are you using this in your own node? How do you get to call the computeVelocityCommands function? So basically: how to you plan to tap into the API of teb_local_planner?

mgruhler gravatar image mgruhler  ( 2019-03-12 03:41:36 -0500 )edit

@mgruhler I am not using move_base and other navigation stack. I have my own nodes for global planner, move base and so on. I created an instance of TebLocalPlannerROS in my separate node (that is basically operates like a local planner), and can call the class functions like setPlan and computeVelocityCommands from this node. The teb computes the path and publishes it to the topic for visualization purposes only as it is written in the teb tutorial. Everything works just perfect. But the problem that I am not interested in the velocity commands, I am interested in the local path. In order to get it I have to subscribe to this topic that I am trying to avoid.

inaba gravatar image inaba  ( 2019-03-12 03:59:57 -0500 )edit

@inaba great. This is what was missing for me to understand your ultimate goal :-)

mgruhler gravatar image mgruhler  ( 2019-03-12 04:40:47 -0500 )edit

hi @mgruhler, can you please guide me for writing the separate node (that basically operates like a local planner), I have written my own global planer node, for obstacle avoidance we need to use the teb local planner. So please can you guide me?

vishal@leotechsa gravatar image vishal@leotechsa  ( 2019-10-15 04:21:35 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2019-03-12 04:45:47 -0500

mgruhler gravatar image

updated 2019-03-12 08:10:13 -0500

Looking at the interfaces, there is no such function directly available within the teb_local_planner_ros.h. You might consider contacting the maintainer @croesmann either here on the the GitHub repo.

So you might have to implement an interface yourself...

edit flag offensive delete link more


Thank you!

inaba gravatar image inaba  ( 2019-03-12 06:23:21 -0500 )edit

Indeed, even though it would be straightforward to add an accessor method to the teb_local_planner_ros.h interface, I think you are better with simply creating your own interface to omit all navigation stack stuff (like costmaps, ...).. TebLocalPlannerROS just wrapps some simple calls to the PlannerInteface (either TebLocalPlanner or HomotopyClassPlanner, depending on what you want).You can also ahve a look at the source file test_optim_node.cpp for some ideas. Btw. I'll be right back soon to support the planner ;-)

croesmann gravatar image croesmann  ( 2019-03-12 06:37:11 -0500 )edit

THUMBS UP@croesmann. Appreciate it. Really great project you have there!

mgruhler gravatar image mgruhler  ( 2019-03-12 08:09:44 -0500 )edit

@croesmann Thank you! I did this - wrote my own wrapper with an additional function to get the teb optimal path - and it works))

inaba gravatar image inaba  ( 2019-03-14 04:46:43 -0500 )edit

answered 2020-12-22 08:24:33 -0500

DiegoGuffanti gravatar image

Try to remap the /cmd_vel topic to another different i.e. /teb_cmd_vel. Then you will be able to control your robot by sending your own velocity commands using the /cmd_vel topic.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-03-11 11:13:50 -0500

Seen: 413 times

Last updated: Dec 22 '20