https://github.com/maelh/self-driving-car-simulation
Simple reproducible self driving car, using FastAI/PyTorch and CoppeliaSim (V-REP)
https://github.com/maelh/self-driving-car-simulation
coppeliasim deep-learning fastai python pytorch self-driving-car vrep
Last synced: 3 months ago
JSON representation
Simple reproducible self driving car, using FastAI/PyTorch and CoppeliaSim (V-REP)
- Host: GitHub
- URL: https://github.com/maelh/self-driving-car-simulation
- Owner: maelh
- License: mit
- Created: 2022-02-01T23:46:53.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-02T14:06:39.000Z (over 4 years ago)
- Last Synced: 2025-10-19T13:11:36.058Z (8 months ago)
- Topics: coppeliasim, deep-learning, fastai, python, pytorch, self-driving-car, vrep
- Language: Python
- Homepage:
- Size: 41.4 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple reproducible self-driving car
Realizing even a simple self-driving car is a non-trivial project, especially when hardware is involved.
This self-driving car project presents a fully software based solution, that is reproducible and functional without prior training, using the open source robot simulator [CoppeliaSim](https://www.coppeliarobotics.com/) (V-REP), the machine learning library FastAI/PyTorch, and custom Python code to automatically steer/drive the car, as well as collect training data.
While a pre-trained steering model is included, such that the car can drive autonomously right after installation, there is also code to retrain the deep learning model from scratch: a Juypter notebook (or alternatively a simple Python program) is provided to create and train the steering model, which is based on a CNN (convolutional neural network) classifier.
It provides:
- Simple noise free and high contrasting camera pictures
- Allows for easier experimenting with deep learning, while not getting distracted with the complexity of a highly dynamic real world (shadows, changing sun or internal lighting, shaking of the camera while driving, lens distortion, noise from the camera sensor, and multiple other possible effects that need to be filtered out or compensated for).
- In the real world, the need to create a training set that captures all this variability in sufficient detail, makes it difficult to get started, and less easy to debug issues, since results are less predictable.
- A predefined test track that allows to test the exact same situation again and again
- You can always add variability later on, such as randomizing the starting position or adapting tracks. But when you get started you can be sure everything works as intended, without experimenting.
- A self-driving mode that is guarantueed to work, since the environment is the same as the one it was trained on.
- Simple capturing of training data by driving the car in the simulator using your arrow keys.
- A Jupyter notebook to fit the CNN (convolutional neural network) on the captured training data.
- Simple code that focuses on the bare essentials.
- Complete set of steps that can be followed to have the same result, again, without unknown factors getting in the way.
## Hardware alternatives
Usual approaches are to modify a toy RC car, by adding a small computer, a camera, a battery pack, and a way to drive the motors. This means you need to either hack the remote control, or add electronics to drive the motors using a microcontroller. You also have to pick a suited camera. It turns out that wide angle view cameras are necessary to get a sufficiently descriptive view of the road to drive along.
Single-board computers like a Raspberry Pi are usually not powerful enough to derive steering commands with low enough latency from camera input. Jetson Nano is a good alternative since it provides accelerated inference over its GPU.
If you have a 3d printer and dont mind buying various components, you can look into [JetRacer](https://github.com/NVIDIA-AI-IOT/jetracer) or buy a complete kit from WaveShare. Another option is [Donkey Car](https://github.com/autorope/donkeycar), but again a 3d printer is helpful, since distributors are not available in every country.
While those kits help, they are not without issues, and require enough familiarity with hardware to be able to troubleshoot problems. A simulator allows to try out various hardware setups more easily, by tuning camera or motor properties, and more easily creating test tracks.
When you are also a beginner in machine learning, a complete software package that gets you started directly, with a reproducible setup, will make it a lot easier to experiment and focus on the task at hand compared to the solutions presented above.