University robotics project that builds a complete ROS 2 Humble workflow for mapping and autonomous navigation. The project converts recorded 3D LiDAR data into a 2D laser scan, creates an occupancy map with SLAM Toolbox, localizes a simulated AgileX Scout Mini with AMCL, and executes a sequence of navigation goals through Nav2.
- 2D occupancy-grid mapping from recorded PointCloud2 data
- Point-cloud conversion with
pointcloud_to_laserscan - Localization with Adaptive Monte Carlo Localization (AMCL)
- Nav2 planning and control with the MPPI controller
- Stage simulation of an omnidirectional AgileX Scout Mini
- Sequential waypoint execution through a ROS 2 C++ action client
- Configurable launch files, frames, topics, maps, and goal files
flowchart LR
A["Recorded /ugv/rslidar_points"] --> B["PointCloud2 to LaserScan"]
B --> C["SLAM Toolbox"]
J["Recorded odometry and TF"] --> C
C --> D["Occupancy map"]
D --> E["Stage simulation"]
E --> F["AMCL localization"]
F --> G["Nav2 planning and MPPI control"]
H["CSV waypoints"] --> I["C++ goal publisher"]
I --> G
| Project requirement | Implementation |
|---|---|
| Build a map from recorded odometry, TF, and LiDAR data | PointCloud2 conversion and SLAM Toolbox mapping launch pipeline |
| Simulate the assigned omnidirectional robot | Custom AgileX Scout Mini model and world for Stage |
| Localize and navigate in the reconstructed map | AMCL, Nav2 planning, MPPI control, costmaps, and recovery behaviors |
Read x,y,theta goals from CSV and send them sequentially |
C++ NavigateToPose action client with rejection retries and result tracking |
| Provide task-specific visualization | RViz configurations for map, TF, laser scan, AMCL particles, paths, and goals |
| Save the reconstructed and serialized map | PGM/PNG/YAML map files and SLAM Toolbox pose graph artifacts |
second_project/
|-- config/ # SLAM Toolbox, point-cloud conversion, and Nav2 parameters
|-- csv/ # Navigation waypoints
|-- launch/ # Mapping and navigation launch files
|-- map/ # Occupancy map and serialized SLAM pose graph
|-- rviz/ # RViz configurations
|-- src/ # C++ waypoint action client
`-- world/ # Stage simulation world and robot model
tools/
`-- map_processing/ # Offline map inspection and cleanup utilities
The project was developed and run inside the robotics course Docker environment. The image was based on ros:humble-perception; the colcon_ws workspace and rosbag directory were mounted from the host, and graphical applications such as RViz and Stage were forwarded from the container. Cyclone DDS was used as the ROS middleware implementation.
The course Docker image is not bundled in this repository. The package can be built inside the original environment or an equivalent ROS 2 Humble container with the dependencies below.
- Docker-based ROS 2 Humble environment, or a native ROS 2 Humble installation
colconandrosdep- Nav2
- SLAM Toolbox
pointcloud_to_laserscan- RViz 2
- Cyclone DDS
stage_ros2_stageros- Python 3 and Pillow for the optional map-processing tools
Clone the repository into the src directory of the container's ROS 2 workspace, install available dependencies, and build the package:
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/MasterPula/ros2-mapping-navigation.git
cd ~/ros2_ws
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install --packages-select second_project
source install/setup.bashSome ROS 2 distributions may require stage_ros2_stageros to be installed from source.
The provided rosbag contained noisy odometry on /odom, a 3D point cloud on /ugv/rslidar_points, and transforms on /tf and /tf_static. Start SLAM Toolbox, convert the recorded point cloud to a laser scan, and optionally play the rosbag automatically:
ros2 launch second_project mapping.launch.py \
play_bag:=true \
bag_path:=/path/to/rosbagThe launch file can save the generated occupancy map when rosbag playback finishes. A pose graph can also be serialized manually:
ros2 service call /slam_toolbox/serialize_map \
slam_toolbox/srv/SerializePoseGraph \
"{filename: '/path/to/map'}"Launch the omnidirectional Scout Mini model in Stage together with the map server, AMCL, Nav2 servers, RViz, and the waypoint publisher:
ros2 launch second_project navigation.launch.pyThe goal_publisher node reads x, y, and theta values from second_project/csv/goals.csv. It sends each pose to the Nav2 NavigateToPose action server, waits for the result, retries rejected goals, and reports the final success/failure count.
Useful launch overrides include:
ros2 launch second_project navigation.launch.py \
rviz:=false \
stage_gui:=false \
start_goals:=true \
goals_file:=/path/to/goals.csvThe scripts in tools/map_processing/ were used to inspect, convert, clean, and validate the generated occupancy map. They are offline development utilities and are not required to run the ROS 2 package.
Licensed under the Apache License 2.0. See LICENSE.
