10 part1: Localizing
How does a Robot figure out where it is? Even if there's no map?
- How does the Robot “know” where it is?
- How does it determine it’s “pose”?
- Relative to a coordinate system
- Could be GPS coordinates
- But more likely coordinate of a given map
Localizing the Robot on a map
- Key package is called
amcl - Adaptive Monte Carlo Localization
- It’s a deep theoretical area covered in Probabilistic Robotics by Sebsastian Thrun, et al
How it works at a high level
- Location of robot is its pose
- Always known with respect to a map coordinate frame (also called sometimes the world coordinate frame)
amcl maintains a set of candidate poses plus a probability that they reflect reality
- As robot moves, actual sensor readings are compared with expected sensor readings for each pose, and the probability of each candidate pose can be updated.
- Low probability poses are discarded, and high probability poses are updated based on odometry, scan, and probability.
- For path planning purposes the highest probability pose is used.
- It is definitely a guess not a certainty.
- We will rebuild the map here to make sure things are consistent
- A new wrinkle here is the use of turtlebot3_simulation which will take the place of teleop
- That node drives the robot around ranomly while gmapping is building the map
- After some time has gone by, save the map.
NB Be careful with the filenames of the map. You will get strange errors if the file name given to turtlebot3_navigation is incorrect or not resolvable!
# create the simulated environment called stage_4
$ roslaunch turtlebot3_gazebo turtlebot3_stage_4.launch
# launch a simulated turtlebot3 that drives a random pattern
$ roslaunch turtlebot3_gazebo turtlebot3_simulation.launch
# launch the slam algoritm, which will create an in-memory map data structure
$ roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping
# After the map looks done, save it into a map file for later.
$ cd ~
$ rosrun map_server map_saver -f stage4