Implementation of 2D Motion Planning on an Occupancy Map using RRT Algorithm with Gradient-Based Sampling Guided by Neural Network
This project implements a Rapidly-exploring Random Tree (RRT) algorithm enhanced with neural network-guided sampling for path planning in 2D environments.
- ROS 2 (tested on Humble) with required ros2 packages
- Python 3.10
- Required Python packages (requirements.txt):
- Install the required ROS2 packages:
sudo apt-get install ros-humble-nav2-map-server ros-humble-nav2-lifecycle-manager
- Create ROS 2 workspace:
mkdir -p ros2_ws/src
cd ros2_ws/src
- Clone the repository:
git clone https://github.com/SirErico/Projekt_MiAPR
- Before building, create a venv
cd ..
python3 -m venv venv
- Install the Python dependencies from
requirements.txt
:
pip install -r requirements.txt
- Add 'COLCON_IGNORE' file to your venv folder
touch ~/venv/COLCON_IGNORE
- Source venv
source ~/path/to/venv/bin/activate
- Build and source workspace
colcon build
source /install/setup.bash
- Generate training data:
python3 src/sample_map.py
- Train the neural network:
python3 src/neural_net.py
To run the RRT algorithm with the neural net model:
ros2 launch mapr_rrt rrt_ai_launch.py model_path:=/your/path/model.keras
map_blur.py
: Applies a Gaussian blur to a map image.sample_map.py
: Samples data points from a map to create a dataset for training a neural network.show_map.py
: Visualization of the map .pgm and .csv file.neural_net.py
: Trains a neural network to learn occupancy probabilities from a map dataset.show_model.py
: Predicts occupancy for the entire map and visualizes the original and predicted occupancy maps.
If the virtual environment packages are not visible, add the following to your setup.cfg
file:
[build]
executable=/usr/bin/env python3