Politecnico di Milano - Accademic Year 2021-2022
The project was implemented utilizing ROS Noetic on a Linux Ubuntu 20.04 machine.
Tested also with ROS Melodic on a Linux Ubuntu 18.04 machine.
- Write a launch files to create the map
- Write a launch file to perform amcl based localization
- Write a service to save an image with the map and the trajectory of the robot
- A node is needed to publish the odometry as a tf
- A node is needed to merge the two lasers
To see the complete requirements -> Project presentation
- bags: directory containing the supplied bags.
- launch: directory containing the launch-file that sets the parameter for gmapping, amcl and the merging node
- src: contains the nodes, writtn in c++
- srv: contains the file to generate the service needed to save the map
- map: containing the final map generated by gmap
- rviz: directory containing the config file to see the maping or the localization.
- script: contains a python node using openCV to process the image, publish a processed version and a png map
- OdomeryBroadcaster: this node reads the provided odometry and broadcasts the tf transformation.
- PathBroadcaster: the node reads the poses provided by amcl and stores them in a vector inside the
nav_msgs::Pathmessage pubblished on topic/path - CustomMapSaver: this node is a modified version of the original one2 of the ros map server. It has the callback from the service to save the map along with the path computed by amcl.
- occupancy_grid_processing.py: reads the topic
/mappubblished from gmapping and pubblish the processed map on topic/my_map
- link.launch: set up the basic transformations for the robot and start the merging node1
- gmap.launch: set up the parameter and launch the gmapping node which will pubblish the map and the transformation between
mapandodom - amcl.launch: set up and run amcl for the locaization pubblishing the transformation between
mapandodom
In order to run the gmapping algorithm and acml some packages are needed
For ROS Melodic on a Linux Ubuntu 18.04 machine
$ sudo apt install ros-melodic-robot-localization ros-melodic-imu-tools ros-melodic-rviz-imu-plugin ros-melodic-stage* ros-melodic-mapviz* ros-melodic-gmapping ros-melodic-amcl ros-melodic-navigation ros-melodic-ira-laser-toolsFor ROS Noetic on a Linux Ubuntu 20.04 machine
$ sudo apt install ros-noetic-robot-localization ros-noetic-imu-tools ros-noetic-rviz-imu-plugin ros-noetic-stage* ros-noetic-mapviz* ros-noetic-gmapping ros-noetic-amcl ros-noetic-navigation ros-noetic-ira-laser-toolsThe provided commands will run all the nodes specified in the launch file and a precofigured rviz to look at the mapping.
$ roslaunch RoboticsProject_2 gmap.launchThe map can be saved with this command
$ rosrun map_server map_saver -f mapThe postprocessed map can be saved with this command
$ rosrun map_server map_saver -f map map:=/my_mapThis command will run the localization with acml and open rviz preconfigured.
$ roslaunch RoboticsProject_2 acml.launchTo save the map with the computed path use the following command.
This will save the map in the package directory with the provided name
$ rosservice call save_map CustomMap| We generate the map using the first bag provided. | ![]() |
|---|
We use the generated map to implement localization using amcl on the other 2 bags saving the path of the robot.
| bag 2 | bag 3 |
|---|---|
![]() |
![]() |



