A PyTorch-based implementation of a self-driving car using Deep Q-Learning. The car learns to navigate through a custom environment, avoiding obstacles while trying to reach its target.
- Deep Q-Learning implementation for autonomous navigation
- Interactive environment with drawable obstacles
- Real-time visualization of car sensors and decision making
- Save/Load functionality for trained models
- Performance tracking and visualization
- Red Circle: The car with its direction indicator
- Blue Lines: Three sensors detecting obstacles
- Green Circle: Target destination
- Dark Blue Lines: Obstacles (sand) drawn by user
- Control Buttons:
- Clear: Reset the environment
- Save: Store trained model
- Load: Use previously trained model
- Run
map.py
to start the simulation - Left-click and drag to draw obstacles (sand)
- Watch the car learn to navigate to the green target
- Use buttons to manage the simulation
- Python 3.x
- PyTorch
- Pygame
- Numpy
- Matplotlib
map.py
: Main simulation environmentai.py
: Deep Q-Learning implementation
The car uses three sensors to detect obstacles and learns to navigate through reinforcement learning.