This repository contains a ROS 2 package implementing an autonomous frontier exploration algorithm using Nav2. The Explorer Node subscribes to a map, detects frontiers, and sends navigation goals to explore the environment.
WhatsApp-Video-2025-05-21-at-000.mp4
- Frontier Detection: Automatically detects frontiers (unknown areas) in the map.
- Autonomous Navigation: Uses Nav2's
NavigateToPoseaction to navigate to frontiers. - Dynamic Goal Selection: Chooses the closest unexplored frontier for efficient exploration.
- ROS 2-Based: Compatible with ROS 2 (tested on Humble or Foxy distribution).
- Customizable Timer: Adjust the exploration frequency as needed.
- ROS 2 (Humble/Foxy)
- Python 3
- TurtleBot3 packages installed
- Nav2 installed and configured for your robot
- SLAM Toolbox installed
numpyPython library
-
Clone the repository into your ROS 2 workspace:
cd ~/ros2_ws/src git clone https://github.com/AniArka/Autonomous-Explorer-and-Mapper-ros2-nav2.git cd ~/ros2_ws colcon build
-
Install dependencies:
pip install numpy
-
Source the workspace:
source ~/ros2_ws/install/setup.bash
Follow these steps to test the Explorer Node with TurtleBot3 in a Gazebo simulation:
-
Launch the TurtleBot3 world in Gazebo:
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
-
Start the Nav2 stack:
ros2 launch nav2_bringup navigation_launch.py use_sim_time:=True
-
Launch SLAM Toolbox for mapping:
ros2 launch slam_toolbox online_async_launch.py
-
Launch RViz for visualization:
ros2 launch nav2_bringup rviz_launch.py
-
Run the Explorer Node:
ros2 run custom_explorer explorer
- Map Subscription: Subscribes to the
/maptopic to receive occupancy grid maps. - Frontier Detection: Identifies free cells adjacent to unknown areas as frontiers.
- Navigation: Sends goals to Nav2's
NavigateToPoseaction server for autonomous navigation to the closest frontier. - Dynamic Goal Selection: Continuously updates and selects frontiers during exploration.
explorer.py: Main node for detecting frontiers and sending navigation goals.requirements.txt: Python dependencies.README.md: Project documentation.
- Start the TurtleBot3 simulation environment.
- Run the Explorer Node as shown in the "Testing with TurtleBot3" section.
- Visualize progress in RViz as the robot autonomously explores the environment.
- Add support for multi-robot exploration.
- Implement a more advanced frontier selection algorithm.
- Optimize for larger environments.
Contributions are welcome! Please feel free to submit issues or pull requests.