This project connects a trained neural network model with the Udacity Self-Driving Car Simulator to control a car autonomously based on real-time image data.
model/model.h5: Trained Keras model file.drive.py: Main Python server that receives simulator images, predicts steering angles, and sends control commands back.
Follow these steps carefully:
- Download the simulator:
- Install and open the simulator.
- Select "Autonomous Mode" when you start it (after you connect this server).
git clone https://github.com/sanjaybarla/self_driving_car_udacity.git
cd self_driving_car_udacityMake sure you have Python 3.6 or higher.
pip install -r requirements.txtpython server.pyThe server will start listening on port 4567. You should see
connected- Open the Udacity Self-Driving Car Simulator.
- Select "Autonomous Mode".
- Click "Select".
- The simulator will now send camera images to your server, and your server will respond with steering and throttle commands!
This project uses a trained deep learning model to predict steering angles based on preprocessed images. Throttle is adjusted dynamically based on the speed (simple formula: throttle = 1.0 - (speed / speed_limit)). Image preprocessing includes cropping, color space conversion (RGB β YUV), Gaussian blur, resizing, and normalization.
- Incoming camera images are processed with:
- Crop (remove sky and car hood)
- Convert RGB to YUV color space
- Apply Gaussian blur
- Resize to (200x66) pixels
- Normalize pixel values between 0 and 1
This matches the Nvidia end-to-end self-driving car model training approach.