Ask Your Question

base_local_planner simplest navigation (no curve lines)

asked 2016-07-26 04:00:13 -0600

aerydna gravatar image

hi there, i'm pretty new to ros world and i want my robot to navigate only straight+inplace rotation. I noticed that with base_local_planner the robot start to go navigate forward before finishing the orientation. How can i accomplish this goal? thanks in advance

edit retag flag offensive close merge delete


Not sure what you want, but try the carrot planner

Humpelstilzchen gravatar image Humpelstilzchen  ( 2016-07-27 09:27:25 -0600 )edit

you mean that is not possible with base_local_planner or dwa to navigate the robot only on straight lines? anyway i'll try it

aerydna gravatar image aerydna  ( 2016-07-28 03:19:58 -0600 )edit

@Humpelstilzchen what i'm searching is a local planner that navigate the robot in a full-in-place-rotation-first-then-go-ahead way. with the robot path that always looks like a polygon

aerydna gravatar image aerydna  ( 2016-07-28 03:23:55 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-31 05:11:52 -0600

M@t gravatar image

updated 2016-08-01 17:13:21 -0600

TL;DR: Use a SimpleActionClient to send a MoveBaseGoal to an instance of the move_base node. There's a tutorial that shows you how to do this in C++ here or look below for the python equivalent. In the target pose you can specify a pose and an orientation. What you want to do is calculate the heading between "goalN" and "goalN+1" then send your robot to goalN with that heading. So that when the robot successfully gets to goalN it will automatically rotate on the spot to face goalN+1.

Of course, MoveBase goals work with any heading you provide, so your robot doesn't have to rotate to face anything specifically. But if your robot is already facing the next goal, that usually ensures that the path-planner will plot a straight line directly to it.

Full explanation:

So you want to achieve a trajectory that looks something like this?


I've just managed to achieve this myself, and there isn't really a good explanation anywhere of how to do all this so I'll try to quickly run you through it.

What you will need

  1. A navigation stack for your robot. Doesn't really matter how you do it as long as you have a map, an odometry stream for your robot in that map, and an instance of the move_base node. I'm personally using the robot_localization package and a pre-made launch file for the move_base node that came with the robot I'm using.
  2. A node which acts as a SimpleActionClient. You will have to write this yourself, but it's relatively straight forward as long as your navigation stack works properly.

Writing the SimpleActionClient

There is already a tutorial on how to do this in C++ here, but I'm using Python so that's what my explanation will be in.

Essentially the actionlib package is a framework for writing your own goal and feedback system. The client sends the goal (usually from your laptop) and the server typically runs on the robot, executes the goal and provides feedback. The goal can be anything from moving the robot base to moving an arm. There is already a simplified version of this package with a few basic goals built in, and this is what we will be using. More specifically, we want to use the 'MoveBaseAction' goal that tells the move_base node where to send the robot in the world.

The code I use (roughly para-phrased) is here:

# Important modules to import
import rospy
import actionlib
from move_base_msgs.msg import *

# Create your SimpleActionClient and boot a default version of the SimpleActionServer
client = actionlib.SimpleActionClient('move_base', MoveBaseAction) 

def send_robot_to_goal(X, Y, heading):
    # Cancel any pre-existing goals (don't want them to conflict)

    # Convert to a heading (yaw) to quaternion
    yaw = heading
    roll = 0.0
    pitch = 0.0
    quaternion = tf.transformations.quaternion_from_euler(roll, pitch, yaw)

    # Create a new goal
    goal = MoveBaseGoal()
    goal.target_pose.header.frame_id = 'map'          # The frame you want to ...
edit flag offensive delete link more


first of all, thank you for the answer. what you describe seems to work only with multiple goal so i presume i have to (by writing a simple action client) split a single goal in two sub-goal the first for the rotation and the second for the linear movement.

aerydna gravatar image aerydna  ( 2016-08-01 03:56:06 -0600 )edit

i'm a bit disappointed for base_local_planner (and the other local planner too) not to having a simple flag to work in this way though

aerydna gravatar image aerydna  ( 2016-08-01 03:56:55 -0600 )edit

You're welcome, and you're absolutely right. You can issue a goal where X,Y is the current position and only the heading is different. But for reasons I don't quite understand, this doesn't seem to work for me.

M@t gravatar image M@t  ( 2016-08-01 16:24:16 -0600 )edit

@M@t Hi, did you manage to accomplish this?

stevemartin gravatar image stevemartin  ( 2018-10-26 05:26:40 -0600 )edit

Hi @stevemartin, are you asking if I have achieved "in-place" rotation using move_base? I haven't actually tried to do that in a while, but I know it is possible because you can do it with the simulated jackal in these Clearpath tutorials.

M@t gravatar image M@t  ( 2018-10-29 18:16:42 -0600 )edit

Your Answer

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

Add Answer

Question Tools



Asked: 2016-07-26 04:00:13 -0600

Seen: 1,322 times

Last updated: Aug 01 '16