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
Simulation general scheme:
To obtain an accurate Point Cloud map of the environment visited the solution by IntRoLab was used. In particular the solution offered by rtabmap_ros allows a seamless integration of the library directly in ROS.
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.
To use this solution, run the following bash code to install the dependencies
The information connected to the point cloud will be stored into a database .db file. In order to obtain the final Point Cloud run the following module in a bash terminal
rtabmap-databaseViewer
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.
For the detection of the various QR codes it is necessary the package ViSP stack for ROS
Follow the ufficial procedure at vision_visp (probably it will be neccesary to install from source, remember that the workspace is called turtle_ws)
In order to try the correct installation, run
roslaunch visp_auto_tracker tutorial.launch
In order to display the correct QR codes in the TurtleBot environment, copy and past the folder
turtle_ws/src/turtlebot3_simulations/turtlebot3_gazebo/worlds
turtle_ws/src/turtlebot3_simulations/turtlebot3_gazebo/models
turtle_ws/src/turtlebot3_simulations/turtlebot3_gazebo/launch
into your workspace at the defined positions. In this way you will obtain the QR codes positioned in the TurtleBot Arena.
For this project the repo gazebo_models was used for the creation of the models.
In order to create the proper QR-codes is necessary to change the code since for Vision Visp it is necessary to print a black square around the QR-code requested. In order to do this it is necessary to change the code at line 93 with
if white_contour_px > 0:
convert_cmd = "convert %s -bordercolor white -border %dx%d %s" % (
image_dest_path, 57,
57, image_dest_path)
if args.verbose:
print(convert_cmd)
os.system(convert_cmd)
convert_cmd = "convert %s -bordercolor black -border %dx%d %s" % (
image_dest_path, 150,
150, image_dest_path)
if args.verbose:
print(convert_cmd)
os.system(convert_cmd)
convert_cmd = "convert %s -bordercolor white -border %dx%d %s" % (
image_dest_path, 10,
10, image_dest_path)
if args.verbose:
print(convert_cmd)
os.system(convert_cmd)
This will set the border as required. Be aware that changes might be required, depending on the dimension of the original QR-code.













