Smart_Traffic_Sim is a cutting-edge simulation project focused on developing a new traffic control strategy for autonomous vehicles (AVs) at intersections, eliminating the need for traditional traffic lights. This project aims to minimize traffic congestion and collisions through smart intersection management, leveraging the capabilities of AVs to create a safer and more efficient traffic flow.
- 🧠 Smart Intersection Management: Advanced algorithms to manage vehicle flow at intersections without traffic lights.
- 🚗 Autonomous Vehicle Physics: Realistic physics simulation for AVs, including velocity, distance, and time calculations.
- 🎮 Dynamic Vehicle Generation: Keyboard commands to generate vehicles with various routes, ensuring diverse traffic patterns.
- 🎞️ Animation: Smooth and realistic animation of AVs as they navigate through the intersection.
- 📊 Statistics Tracking: Comprehensive statistics to analyze intersection performance, including max/min velocity, time, and close calls.
- 🚥 Reduce Traffic Congestion: Optimize vehicle flow to prevent traffic jams.
- 🔒 Enhance Safety: Minimize collisions and ensure safe distances between vehicles.
- 🚀 Prepare for AV Future: Develop traffic strategies tailored for the upcoming era of autonomous vehicles.
- Intersection Setup: Focus on a cross intersection with distinct lanes for right turns, straight ahead, and left turns.
- Vehicle Control: Implement physics for AVs, ensuring they follow the designated routes and maintain safe distances.
- Simulation Commands: Use keyboard events to generate vehicles and control the simulation, with specific keys for different directions.
- Animation Requirements: Animate vehicles realistically as they move and turn within the intersection.
- Statistics Window: Display detailed statistics upon exiting the simulation.
To run this project, you need to have Rust installed. Follow the instructions below to install Rust.
- Open a terminal.
- Run the following command to install Rust using
rustup
:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Follow the on-screen instructions to complete the installation.
- After installation, ensure the Rust toolchain is up to date:
rustup update
Clone the repository and follow the instructions in the README to set up the simulation environment and start experimenting with smart intersection management for AVs.
git clone https://github.com/nixa001/Smart_Traffic_Sim.git
cd Smart_Traffic_Sim
cargo run
To run the simulation, use the following commands:
- ↑ Arrow Up: Generate vehicles from south to north.
- ↓ Arrow Down: Generate vehicles from north to south.
- → Arrow Right: Generate vehicles from west to east.
- ← Arrow Left: Generate vehicles from east to west.
- R: Continually generate random vehicles (using the game loop).
- Esc: Finish the simulation and generate a window with all statistics.
- Exit Simulation: