This project, selected among the finalists of the 8th edition of TECHgium (L&T Technology Services) from over 40,000+ students, proposes a novel AI-based torque allocation system for electric vehicles navigating rough terrains. The aim is to maximize vehicle stability, avoid skidding, and adaptively balance torque across all four wheels based on real-time sensor input.
We built a complete simulation using Gazebo, developed an optimization algorithm (SLSQP) to compute adaptive torque distribution, trained a deep learning model, and finally deployed it in a Raspberry Pi-powered prototype. The real-time control and monitoring were achieved via a custom-built Flask web application.
Rubicon/
โโโ Evata/ # EV Car Model
โ โโโ Materials/
โ โโโ Meshes/
โ โโโ Thumbnails/
โ โโโ model.sdf
โ
โโโ World_Assets/ # Terrain Assets for Gazebo
โ โโโ Materials/
โ โโโ Meshes/
โ โโโ Thumbnails/
โ โโโ model.sdf
โ
โโโ try_world.sdf # Custom rough terrain Gazebo world
โโโ imu_reader5.py # IMU sensor reading and preprocessing script
โโโ training_data.csv # Raw data from Gazebo simulation
โโโ ai_model.csv # Processed dataset after optimization and feature engineering
โโโ ai_model.ipynb # AI training notebook
โโโ ai_model.keras # Trained neural network model (exported)
โโโ index.html # Flask dashboard template
โโโ raspi3.py # Main hardware control script (Raspberry Pi + sensors + AI + Flask)
- Rough Terrain World: Created a custom uneven terrain in Gazebo.
- EV Model: Integrated a 4-wheel-drive electric car model with sensor mounts.
- Data Logging: Captured
ax,ay,az,wx,wy,wzfrom the IMU during runs.
- Velocity Calculation: Derived
vx,vyusing acceleration data. - Wheel Speed Estimation: Applied rigid body kinematics.
- Slip Angle: Estimated slip angle for each wheel โ a major factor in torque gaps.
- Optimization Algorithm: Used SLSQP to:
- Ensure torque โค motor max torque.
- Fulfill driver-demanded torque.
- Balance left vs. right wheels.
- Torque to Duty Cycle: Converted optimized torque to RPM โ Duty Cycle (for motor drivers).
- Input Features:
ax,ay,wx,wy,wz - Target:
fl_duty,fr_duty,rl_duty,rr_duty - Model: Neural Network (4 hidden layers, ReLU + Dropout)
- Optimizer: Adam
- Output:
.kerasfile +scaler.pkl
- Created a virtual environment for isolated dependency management.
- Installed packages like
keras,scikit-learn,flask,RPi.GPIO, etc. - Uploaded model and scaler to run real-time inference from IMU.
- Chassis: 4-wheel drive (4 DC motors).
- Motor Control: Two L298N motor drivers for independent control.
- Sensors:
- IMU: Real-time terrain sensing.
- Ultrasonic Sensor: Obstacle avoidance (20cm threshold).
- Buzzer: Alerts on obstacle detection.
- AI Inference: AI model predicts optimal duty cycles in real-time.
- Control: Forward, Backward, Left, Right
- Live Graphs:
- Roll vs. Time ๐
- Pitch vs. Time ๐
- Duty Cycle Distribution
- Toggle AI Mode ON/OFF to compare stability
- Emergency Stop Button
- Responsive and clean UI
| Condition | Stability (Pitch/Roll) | Torque Distribution |
|---|---|---|
| Without AI | High Variance | Random/Fixed |
| With AI | Smoother Performance | Dynamic |
- Significant improvement in vehicle stability
- Real-time torque balancing with AI
- Effective slip angle adaptation
- Integrate 360ยฐ LIDAR for advanced obstacle detection.
- Implement Reinforcement Learning for adaptive control.
- Expand model to handle multi-terrain transitions.
- Deploy on real EV platforms for field testing.
- Add cloud sync and mobile app control.
Install Python dependencies using:
pip install -r requirements.txtThis includes:
tensorflow/kerasfor AI model inferencescikit-learnfor data preprocessing (StandardScaler)flaskfor the web dashboardmatplotlib,numpy, etc.
If you are using Mac M1, follow these steps to run the simulation and collect IMU data:
-
Start the Gazebo Server:
gz sim -v 4 try_world.sdf -s
-
Launch the Gazebo GUI (in a new terminal):
gz sim -v 4 -g
-
To view IMU data from the running simulation, use:
gz topic -e -t /imu
Ensure you have the EV model and terrain world files placed correctly in your project directory (try_world.sdf, Evata/, and World_Assets/).
To replicate the real-world testing on a prototype, you'll need:
| Component | Quantity | Purpose |
|---|---|---|
| Raspberry Pi 4B | 1 | Main controller for AI inference + sensors |
| L298N Motor Driver | 2 | For independent control of 4 DC motors |
| DC Motors | 4 | To drive each wheel |
| MPU6050 Sensor | 1 | For real-time pitch, roll, and acceleration |
| Ultrasonic Sensor | 1 | For obstacle detection |
| Buzzer | 1 | Alerts when obstacle is near |
| Jumper Wires | Many | To connect components on breadboard |
| Li-Po Battery Pack | 1 | Power supply for motors + Raspberry Pi |
| Car Chassis | 1 | Mounting platform for motors and sensors |
| Breadboard | 1 | Prototyping connections |
| Power Bank | 1 (optional) | Power Raspberry Pi independently |
๐ฆ Total POC cost โ โน18,800 (as per Techgium presentation)
Feel free to reach out if you're curious about:
- ๐ AI/ML for real-world robotics
- ๐ค AI in embedded hardware systems
- ๐ Data science or computer vision applications
- ๐ก Startup ideas around intelligent mobility
๐ง ujjwalrajbgis@gmail.com
๐ LinkedIn
- Ujjwal Raj โ System Design, AI Modeling, Hardware & Integration
Finalist at TECHgium 8th Edition | IIITDM Kancheepuram