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
- 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.
- 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)
client.wait_for_server()
def send_robot_to_goal(X, Y, heading):
# Cancel any pre-existing goals (don't want them to conflict)
self.client.cancel_all_goals()
# 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 ...
(more)
Not sure what you want, but try the carrot planner
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
@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