Closed Panchadip-128 closed 3 weeks ago
Our team will soon review your PR. Thanks @Panchadip-128 :)
@abhisheks008 Please review once
The model files
is empty. What's the purpose of it?
@abhisheks008 For me its showing files inside model directory
Oh sorry , I have removed it Please check now @abhisheks008
@abhisheks008
Pull Request for DL-Simplified 💡
Issue Title : Drone Navigation Detection and Path Tracing with Reinforcement Learning
JWOC Participant
) GSSoC Ext 2024 ContributorCloses: #929
Describe the add-ons or changes you've made 📃
Features Pathfinding with A Algorithm: Finds an optimal, shortest path from the starting position to the target using the A heuristic. Reinforcement Learning Navigation: A reinforcement learning model trains to achieve the navigation goal while avoiding obstacles, rewarding efficient paths. Dynamic Obstacles: Specify obstacle positions to simulate real-world barriers and allow pathfinding adaptations. Comprehensive Visualizations: Includes static, dynamic, and 3D visualizations of the environment, path costs, and drone’s decision-making process. Real-time Animation: Watch the drone’s actions in a step-by-step movement toward the target.
Project Structure pathfinding block: Contains the A* algorithm and helper functions for calculating paths. reinforcement_learning block: Implements the reinforcement learning environment using OpenAI Gym, where the drone learns an optimal policy for navigation. visualizations block: Defines visualization functions, including static, dynamic, and heatmap visualizations.
Setup Instructions Clone the repository:
git clone https://github.com/Panchadip-128/Drone-Navigation_Detection_using_RL.git cd Drone-Navigation_Detection_using_RL
Install required dependencies: pip install -r requirements.txt Run the script: Drone-Navigation_Detection_using_RL.ipynb
Usage: Specify Start, Target, and Obstacle Positions: Set coordinates for the drone’s starting position, the target, and obstacles. Choose Navigation Algorithm: Run either the A* pathfinding method or the reinforcement learning model to observe different navigation approaches.
Select Visualization Type: View different visualizations of the environment, path, costs, and drone movements.
Visualizations The project includes several visualizations to illustrate pathfinding and navigation strategies in the environment.
Basic Environment Setup Sets up a grid environment, marking the drone’s starting position, the target, and obstacles.
def visualize_environment(drone_pos, target_pos, obstacles, grid_size=(10, 10)) env graph
Static Path Visualization Displays a static view of the calculated A* path from start to target.
def visualize_path(drone_pos, target_pos, obstacles, path) a star graph
Heatmap of Pathfinding Costs Shows a heatmap for traversal costs to each grid cell, providing insight into pathfinding challenges.
def visualize_cost_heatmap(start, goal, obstacles, grid_width, grid_height) pathfinding_heat-map
Dynamic Movement Visualization Animates the drone’s movement toward the target, step-by-step, showing real-time path adjustments.
Navigation Graph
3D Surface Plot of Pathfinding Costs Visualizes the cost distribution across the grid in 3D, highlighting areas with high or low pathfinding costs.
3D Path Finding Cost Suraface schematic
Navigation Graph:
Drone Navigation Graph
Reinforcement Learning (RL) Model Overview In addition to the A* algorithm, this project includes a reinforcement learning approach to allow the drone to learn optimal navigation strategies through interaction with the environment. The RL agent is implemented using OpenAI Gym and trained with the Proximal Policy Optimization (PPO) algorithm from stable-baselines3.
RL Environment The RL environment for the drone is defined in DroneEnv, an OpenAI Gym environment that:
Defines the drone’s possible actions: Up, Down, Left, Right, and diagonal moves. Contains a custom reward function: Positive Reward: Awarded for reaching the target. Penalty: Applied when the drone hits an obstacle or moves away from the target. Exploration vs. Exploitation: Introduces a small exploration rate (epsilon) to encourage the drone to explore initially before converging on optimal paths.
Training the RL Model from stable_baselines3 import PPO
env = DroneEnv() model = PPO("MlpPolicy", env, verbose=1) model.learn(total_timesteps=10000) # Training the model with adjustable timesteps Evaluation After training, the RL model navigates the drone autonomously, continuously adjusting its path based on learned policies. This approach enhances the drone’s flexibility, enabling it to adapt even with changing obstacles or targets.
Type of change ☑️
What sort of change have you made:
How Has This Been Tested? ⚙️
To ensure the functionality and robustness of the drone navigation code, various testing methodologies have been employed. The following sections detail the testing approaches, scenarios, and outcomes.
Checklist: ☑️