
Get step-by-step guidance to build autonomous car simulations with Python using Pygame and NEAT, training neural networks from sensor input to improve decision making and avoid collisions.
Discover eight chapters detailing who this course serves, the Python tools and libraries, and a step-by-step plan to build and test autonomous car simulations.
Explore self-driving technology for automotive enthusiasts and aspiring software engineers, and learn a simple, technical view of autonomous car simulations you can build with Python.
Learn to set up Python 3.11, choose an IDE, and install Pygame and NEAT to build an autonomous car simulation, with NEAT enabling learning from experience via predefined fitness criteria.
Explore the core concept of autonomous cars and learn how neural networks, reinforcement learning, and machine learning drive real-time decisions using sensor data from LIDAR, radar, and cameras.
See how autonomous cars use a three-layer neural network and sensors to decide braking or steering, with NEAT fitness scores ranking cars to select the best self-driving model.
Learn how to set up your IDE for this Python project with Visual Studio Code, with alternatives PyCharm and Sublime Text, and download guidance for macOS, Windows, and Linux.
Install the latest python version above 3.6 from the official download page, then open Visual Studio Code and install the main Python extension for upcoming pygame and neat libraries steps.
Install neat and pygame with pip, ensure Python 3.6 or higher, and create a test.py in Visual Studio Code to start building your autonomous car project.
Explore a basic Python training session covering data types, functions and parameters, classes, and Pi game basics to prepare for the autonomous car project.
This lecture introduces basic Python data types, including string, integer, float, and boolean, through hands-on variable usage, printing, and type checks with examples on quotes, spaces, and simple operations.
Learn how to define functions in Python with parameters, return values, and practical examples like calculating a total and car velocity using distance and time.
Learn Python classes and objects by building car examples, including BMW and color attributes, initializing with __init__, and printing values to reinforce core concepts.
Learn the basics of pi game for our autonomous car simulation, including installing pi game, importing it, initializing, creating a screen, and getting its size.
Prepare car objects for simulation by sourcing PNG core and car lane icons under Creative Commons licenses, converting SVGs to PNG when needed, and organizing yellow and red core assets.
Learn how to download a free tool for building a car track, with step-by-step guidance to choose direct download for the latest version 2.10.34 and ensure a stable internet connection.
Build a car track for autonomous car simulations by drawing on a blank gym canvas with a brush and black color, then export as png.
Create a new folder for the self-driving project, transfer core assets and track.png, add the configuration txt for the neat algorithm, and prepare the Python main file for the project.
Discover the neat configuration file for autonomous car projects, including fitness criterion set to max, fitness threshold, population size 30, reset on extinction, and network parameters.
Initialize the autonomous car simulation by creating an AutonomousCar class in Python, loading the core image with pygame and neat, and setting initial position and state.
Create two functions, def positions and def avoid collisions, to initialize the object's positions and avoid collisions on a track by inspecting track pixels and toggling is_alive.
Develop a render detection function to identify obstacles on the track, detect the closest obstacle (roadblock), and compute distance using cosine and sine with a degree-to-radian angle.
Develops a position update function that keeps the autonomous car on track by updating speed, position, rotation, and collision detection using trigonometry and multi-direction distance checks.
Create three short python functions to initialize radar data from five sensors, compute a fitness score by distance divided by 50, and check if the car remains alive on track.
Define the run_autonomous_core function, taking genomes and config, to run autonomous cars by initializing pygame, loading the track image, creating neural networks and cores, and evaluating fitness through iterations.
Initialize pygame, set a 1500 by 800 display, load the track image, and run a loop that activates neural networks to determine actions for the autonomous car.
Build and run a neat autonomous car simulation by wiring configurations from a neat_config.txt file, defining populations, reporters, and statistics for multi-generation iterations.
Test the self-driving autonomous car simulation by validating decision making, sensor integrations, and collision prevention, then apply corrections and tune speed to keep on the track and improve fitness.
Summarize the course learnings by highlighting testing essentials—decision making, integrations, and collision prevention—for autonomous car simulations, and encourage creative, real-project practice with code quality and documentation.
Welcome to Self-Driving Simulations: Developing Autonomous Cars with Python course. This is basically an extensive project based course where you will be fully guided step by step on how to build autonomous vehicle simulation with self driving feature using Python programming language alongside with Python libraries, such as Pygame and NEAT where Pygame will be utilised to create a visual and realistic representation of the simulated environment while NEAT which stands for NeuroEvolution of Augmenting Topologies will be used to train the neural networks to control and design self driving behaviour. The neural network takes input from the car's sensors. In addition, the neural network will also learn and adapt over time through evolutionary algorithms, improving the car's driving performance and decision-making skills. In the introduction session, you will be learning the basic fundamentals of autonomous car, getting to know technologies behind it as well as understanding how it works. Then, after learning the basic concepts, you will be guided step by step to set up all necessary tools, for instance Visual Studio Code IDE, installing Python, and other relevant tools. Before getting into the project, there will be a basic python training session where you will learn all important concepts in Python that you need to know and master to prepare you for the upcoming project. The basic Python training session is optional since the session was created and intended only for those who are not very confident with their Python programming skills. In the basic Python training session, you will learn different data types or variables, how to build functions and pass down parameters to the function, how to build class, and basic fundamentals of Pygame. Then, once the basic Python training session has been completed, you will move to the project where you will be fully guided step by step on how to build an autonomous car simulation with advanced self driving features from scratch. Once the project has been built, we are going to be conducting testing, not only to test if the code works but also to test if the output of the code is what we expected to get. There will be three main objectives that will be tested, those are the car's decision making ability, sensor integration, and collision prevention.
First of all, we need to ask ourselves this question. Why should we learn how to build an autonomous car simulator? It might be very interesting to learn how the self-driving feature in cars like Tesla works, obviously the system is very complicated and a bit difficult to be understood but what if you have a chance to learn the self driving mechanism from a more simple perspective and that’s exactly what you are going to learn in this course. The next follow up question might potentially be, well it is near impossible and definitely unrealistic to create my own real autonomous vehicle like Tesla, it will cost you a lot and even if you have the funding, you might not have the right skill sets and knowledge to begin with. That is actually true to some extent, we are not going to build a brand new car with self -driving features, instead, we can potentially build a very cool self-driving game or maybe build an autonomous object simulator.
Below are things that we are going to learn from this course:
Learning the fundamental concepts of self driving autonomous car, getting to know technologies behind it, as well as its capabilities and limitations
Learning and understanding how autonomous car works
Basic Python training session which prepares you better for the autonomous car project
Building self driving autonomous car simulation project using Pygame and NEAT
Learning how to build and design car track using GIMP painting tool
Testing the self driving autonomous cars to ensures the car has a good decision making ability, solid sensor integrations, and effective collision prevention system