Localization of a mobile robot in ROS using Adaptive Monte Carlo Localization. This project is part of Udacity Robotics Software Engineer Nanodegree.
The project consists of the following parts:
- A Gazebo world and a mobile robot from this project.
- ROS packages: map_server, amcl, move_base.
- The pgm map file from the map folder is generated by the pgm_map_creator tool.
- ROS (Melodic/Kinetic), Gazebo on Linux
- CMake & g++
- Install dependencies
$ sudo apt-get update && sudo apt-get upgrade -y
$ sudo apt-get install ros-${ROS_DISTRO}-map-server
$ sudo apt-get install ros-${ROS_DISTRO}-amcl
$ sudo apt-get install ros-${ROS_DISTRO}-move-base
- Clone project and initialize catkin workspace
$ mkdir catkin_ws && cd catkin_ws
$ git clone https://github.com/huuanhhuynguyen/RoboND-Where-Am-I.git
$ mv RoboND-Where-Am-I src
$ cd src && catkin_init_workspace
- Also within
catkin_ws/src
, clone theteleop
package
$ git clone https://github.com/ros-teleop/teleop_twist_keyboard
- Move back to
catkin_ws\
and build
$ cd ..
$ catkin_make
- Launch the world and robot
$ source devel/setup.bash
$ roslaunch my_robot world.launch
- Open another terminal (Ctrl+Shift+T), and launch the
amcl.launch
file. Here, the map_server, amcl, and move_back packages will be launched.
$ source devel/setup.bash
$ roslaunch my_robot amcl.launch
- Open another terminal, and run the
teleop
node.
$ source devel/setup.bash
$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
-
Click on this terminal, type keyboard to navigate the robot around. The localization algorithm will update particles as the robot pose is updated.
-
Click on the Gazebo window and kidnap the robot to a random position in the house. Let the robot rotate for a while, it can quickly localize.
Note: Since the map (pgm file) is not perfect, there will be cases where the robot "mislocalize" itself. For example, the door sizes and positions are not perfect. The table on the map should be described by four legs, not by a filled rectangle.