Final project of the course "Design Methods for Unmanned Vehicles" of University of Trento.
This work aims at achieving autonomous exploration and mapping in an unknown environment by deploying multiple robots, each equipped with an RGB-D camera. The project has been developed as a ROS (Noetic) package, developed in Python3 and C++. Turtlebot was used as robot model, but the core can be easily deployed to other models.
Simulation general scheme:
The solution of the SLAM problem and point-cloud re-construnction is handled using RTAB-Map, by IntRoLab. This is done for each robot, and the resulting maps are fed into a map marger, which generates a global point_cloud of the environment in real-time.
A OpenCV-based frontier detector identifies the regions to be explored in the map.
A task manager assigns the frontiers to the individual robots, following a precise exploration strategy. An improved version of the A* algorithm (based on the Fast Marching Method) is used for path planning, and it ensures obstacle avoidance with good clearance.
When all frontiers are explored, all robots go back to the initial position. In post-processing, the point-clouds generated by the single robots can be merged to obtain a final, refined one.
Install ROS Noetic:
sudo apt update
sudo sudo apt install ros-noetic-desktop
Source the ROS environment:
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
Make sure that Gazebo and Rviz are installed:
sudo apt-get install ros-noetic-gazebo-ros-pkgs ros-noetic-gazebo-ros-control
sudo apt-get install ros-noetic-rviz
Install Python 3.8 with the following command:
sudo apt install python3.8
sudo apt install python3-pip
Install the required packages:
pip3 install numpy opencv-python numba scikit-fmm
Create the catkin_ws workspace:
mkdir -p ~/turtle_ws/src
Clone the project repository in the "src" folder:
cd ~/turtle_ws/src
git clone https://github.com/matteomastrogiuseppe/Multirobot-Exploration-and-Mapping
Build the workspace and packages:
cd ~/turtle_ws
catkin_make
Remember to source this workspace by editing the .bashrc file:
echo "source ~/turtle_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
For a first development, the TurtleBot
environment was used. RTAB-Map
was used for solution of SLAM and mapping.
multirobot_map_merge
was used to merge the robot individual maps.
sudo apt install ros-$ROS_DISTRO-rtabmap-ros
cd ~/turtle_ws/src
git clone -b noetic-devel https://github.com/ROBOTIS-GIT/turtlebot3_simulations
git clone -b noetic-devel https://github.com/ROBOTIS-GIT/turtlebot3
git clone -b noetic-devel https://github.com/hrnr/m-explore/tree/noetic-devel/map_merge
cd ~/turtle_ws/
catkin_make
To run the simulation:
roslaunch multi_explore multi_explore.launch
- The global gridmap generally spawns after 20 seconds in ROS time, because of the map merger initial overhead.
- The first run will take more time, because some functions will be compiled in machine code through the Numba library. After the first run, everything is stored in the cache, so no need to wait for the compilation at every launch.
- The real-time, merged pointcloud is already integrated in RViz, but it is disabled by default due to heavy computational load.
To save and export the final RTAB-Map point-clouds:
rtabmap-databaseViewer
Import the .db file, and export the final point-cloud as a .ply file.
A more refined point-cloud (e.g. deletes overlapping points) can be obtained through "PC_merger.cpp". It mostly makes use of the ICP algorithm to align and merge the point-clouds. Using a KD-tree data structure, it is possible to efficiently define the closest points between the two maps, which is at the basis of the ICP registration step.