This repository contains the code and setup instructions for my final year project during my degree studies. The project focuses on creating an autonomous robot using SLAM (Simultaneous Localization and Mapping) to explore an environment and build a map using ROS and Gazebo.
- Ubuntu 18.04 (Bionic Beaver)
- Robot Operating System (ROS) Melodic Morenia
- Gazebo
- Turtlebot3
- RViz
- Navigation Stack
Follow the steps below to set up the environment and install the necessary packages.
Open a terminal and run the following command to install Gazebo and related ROS packages:
sudo apt-get install ros-melodic-gazebo-ros-pkgs ros-melodic-gazebo-ros-control
Source ROS setup and install Turtlebot3 packages:
source /opt/ros/melodic/setup.bash
sudo apt-get install ros-melodic-turtlebot3-msgs
sudo apt-get install ros-melodic-turtlebot3
Create a catkin workspace and clone the required repositories:
cd ~
mkdir -p catkin_ws/src
cd catkin_ws/src
git clone -b melodic-devel https://github.com/ROBOTIS-GIT/turtlebot3
git clone -b melodic-devel https://github.com/ROBOTIS-GIT/turtlebot3_simulations
cd ..
catkin_make
source devel/setup.bash
Install the navigation stack package:
sudo apt-get install ros-melodic-navigation
Clone the navigation repository:
cd catkin_ws/src
git clone -b melodic-devel https://github.com/ros-planning/navigation
cd ..
catkin_make
source devel/setup.bash
Before launching the project, you need to set up the Turtlebot3 model:
export TURTLEBOT3_MODEL=waffle_pi
source ~/.bashrc
To launch the robot's environment in Gazebo, run the following command:
roslaunch ros_autonomous_slam turtlebot3_world.launch
To visualize mapping and localization, launch RViz with the following:
roslaunch ros_autonomous_slam autonomous_explorer.launch
In RViz, use the Publish Point Tool to specify target points for the robot to explore. Publish the following points in the highlighted square area:
- Upper left corner
- Lower left corner
- Lower right corner
- Upper right corner
- On the robot itself
The robot will autonomously explore the environment and generate a map.
Once the mapping is complete and satisfactory, generate the map with:
rosrun map_server map_saver -f my_map
The generated map will be saved in the catkin_ws folder.
This project allows you to set up and operate an autonomous robot using SLAM to map and explore an environment using ROS, Gazebo, and Turtlebot3. Follow the above steps to get the system up and running and generate your map!
This project is based on the work of fazildgr8.