Now let’s dive into the power of ROS. With ROS we have the ability to move TurtleBot (or any other robot) from one place to another while avoiding both static and dynamic obstacles all with a few lines of code.
NOTE: Make sure you have created your map prior to starting this tutorial.
Stop everything from the previous tutorials on both the TurtleBot and the workstation. On TurtleBot run:
If you see
odom received! you’re good to go.
If you receive a warning that starts with:
Waiting on transform..., try restarting
minimal.launch and then restarting
amcl_demo.lauch. You may need to try restarting a few times. Also, turning off the Kobuki base and turning it back on may help.
With everything running successfully on TurtleBot, go to the workstation and run:
RViz should open showing your map. TurtleBot isn’t capable of estimating its pose on startup, though it can do this after you initialize its pose.
Select “2D Pose Estimate” then click and hold on the location where TurtleBot is on the map. An arrow will appear under the mouse pointer while you are holding the mouse button – use this to estimate its orientation.
After setting the estimated pose, select “2D Nav Goal” and click the location where you want TurtleBot to go. You can also specify a goal orientation using the same technique we used with “2D Pose Estimate”.
TurtleBot should now be driving around autonomously based on your goals. Try specifying a goal and walking in front of it to see how it reacts to dynamic obstacles.
##TurtleBot Docking Station: Autonomous Charging
It’s probably not too surprising to hear that TurtleBot knows when its battery is getting low, and with the docking station it can autonomously charge itself.
Make sure the docking station is plugged in (so the red light is on) and against a wall, otherwise TurtleBot may push the station around while trying to charge. Close all terminals on TurtleBot and the workstation.
Place TurtleBot anywhere in line of sight up to 3 meters from the docking station. From there it can autonomously dock using its three IR receivers.
On TurtleBot run:
On the workstation run:
Then in a different terminal run:
Note that TurtleBot may rotate a full 360 degrees to determine the ideal path to the docking station. Often it will first drive perpendicular to the station so it can calculate the ideal path.