Now that you’ve found that TurtleBot can go to a specific relative pose (pose = location + orientation), it’s probably not surprising to learn that it can go to a specific location on a map.
Let’s try this out by telling TurtleBot to go near our docking station.
First, we need to load the map and update the script with a pose that is close to our docking station. About one meter away from the station is perfect.
On TurtleBot, open a terminal window and run:
On the workstation, open a terminal window and run:
In RViz, select “2D Pose Estimate” and click the map approximately where TurtleBot is and align the arrow to indicate orientation.
Next, select “Publish Point” and hover over your map (but don’t click) where you’d like TurtleBot to go when you run your script. On the bottom left corner of the screen next to “select this point” you’ll notice three numbers which change when you move the mouse. This is your point, so write these numbers down.
TIP: The third number is altitude. It may show a number that isn’t perfectly 0, but regardless of what it says, use 0.
In a new terminal window run:
Look for this line of code (line 83):
y values with the numbers you wrote down earlier when doing “publish point”. Save and exit.
NOTE: As seen previously, TurtleBot will avoid obstacles and will try to calculate a plausible path as long as the
rospy.duration time limit hasn’t expired.
TIP: If you view the terminal where you are running
amcl_demo.launch it will show a report that tells you when TurtleBot has given up attempting to reach a goal.
As we remember from our dead reckoning experiments (draw_a_square.py), accuracy is a major problem when relying only on speed and course. The good news with ROS’s move base algorithms is that TurtleBot continuously uses its surroundings to determine where it is on the map and therefore doesn’t get lost. To learn about this in detail read about AMCL.
Starting to See Our Goal
In the mission of making a coffee delivery robot, you can start to think of people’s desks as a list of known points. You can even geek out and set the orientation for everyone’s desks so it points perfectly toward them by modifying the Quaternion() value. The last thing we want is for our coworkers to have to turn the robot a little to make coffee!