JetRacer: Spurführung mit künstlicher Intelligenz: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
| (26 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
[[ | |||
[[ | [[Category:Projects]] | ||
[[ | [[Category:JetRacer]] | ||
[[File:JetRacer Waveshare.jpg|thumb|right|500px|Fig. 1: JetRacer AI Pro from Waveshare]] | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| ''' | | '''Author:''' || [[User:Evrard_Leuteu-Feukeu|Evrard Leuteu]] | ||
|- | |- | ||
| ''' | | '''Type:''' || Project Work | ||
|- | |- | ||
| | | '''Start Date:''' || TBD | ||
|- | |- | ||
| | | '''Submission Date:''' || TBD | ||
|- | |- | ||
| | | '''Supervisor:''' || [[User:Ulrich_Schneider| Prof. Dr.-Ing. Schneider]] | ||
|} | |} | ||
== | |||
== Introduction == | |||
# | The goal of this project was to optimize the JetRacer’s AI for autonomous navigation on the test circuit of the [[Labor_Autonome_Systeme|Autonomous Systems Laboratory]] at HSHL. The JetRacer was required to drive counterclockwise in the right lane as fast and robustly as possible using MATLAB® and a self-developed PD controller. | ||
# | |||
# | Tasks included training a neural network, limiting maximum speed to approximately 1 m/s, taking videos during laps, and deploying the system using GPU Coder. | ||
# | |||
# Drive the JetRacer in the right lane counterclockwise with the gamepad controller. Limit the speed via Software to a maximum (e. | # Familiarization with the existing framework. | ||
# Optimization of the AI for the circuit in the [[Labor_Autonome_Systeme|Autonomous Systems Laboratory]] (speed, robustness). | |||
# Optimization of the controller (e.g., PD controller). | |||
# Use of MATLAB to train the Jetson Nano. | |||
# Drive the JetRacer in the right lane counterclockwise with the gamepad controller. Limit the speed via Software to a maximum (e.g., 1 m/s). | |||
# Take a video while driving a lap with MATLAB<sup>®</sup> using a MATLAB<sup>®</sup>-script. | # Take a video while driving a lap with MATLAB<sup>®</sup> using a MATLAB<sup>®</sup>-script. | ||
# Load the pretrained NN. | # Load the pretrained NN. | ||
# Train the pretrained NN with MATLAB<sup>®</sup> with a MATLAB<sup>®</sup>-App (GUI) by clicking the desired path in the images. | # Train the pretrained NN with MATLAB<sup>®</sup> with a MATLAB<sup>®</sup>-App (GUI) by clicking the desired path in the images. | ||
# Option: Use classic lane tracking algorithms to teach the NN automatically. | # Option: Use classic lane tracking algorithms to teach the NN automatically. | ||
# Write a PD | # Write a PD controller that uses the NN to drive in the right lane. Program this in MATLAB<sup>®</sup> and let it run on the JetRacer GPU using GPU Coder. | ||
# Goal: the car should drive autonomously several laps in the right lane as fast as possible. | # Goal: the car should drive autonomously several laps in the right lane as fast as possible. | ||
<!-- | <!-- | ||
# | # Use of ROS2 to train the Jetson Nano. | ||
# | # Evaluation of the advantages and disadvantages of the programming environments. | ||
# | # Selection of an AI development environment. | ||
--> | --> | ||
# | # Documentation according to scientific standards in the HSHL Wiki. | ||
== Requirements == | |||
The project requires prior knowledge in the following subjects. If you do not meet the requirements, you must acquire these skills during the course of the project using literature or online courses. | |||
* | * Experience with Artificial Intelligence/Deep Learning | ||
* | * Programming in C++, Python | ||
* | * Document versioning with SVN | ||
== | == Requirements for Scientific Work == | ||
* Scientific approach (project plan, etc.), useful article: [[Gantt-Diagram|Create a Gantt diagram]] | |||
* Weekly progress reports (informative), update the [[Discussion:JetRacer:_Lane_Following_with_Artificial_Intelligence|Meeting Minutes]] – live discussion with Prof. Schneider | |||
* Project presentation in the Wiki | |||
* Daily backup of project results in SVN | |||
* Daily documentation of working hours | |||
* [[Student_Projects_with_Prof._Schneider|Student Projects with Prof. Schneider]] | |||
* [[Requirements_for_Scientific_Work|Requirements for Scientific Work]] | |||
== Project Plan == | |||
[[File:Project work.png|frame|Fig. 0: Gantt_Diagram]] | |||
[[Datei:Project work.jpg]] | |||
== | == Previous Work and Researched on The Topic == | ||
*Apu, M. L.: ''[[JetRacer: Spurführung mit künstlicher Intelligenz und MATLAB/Simulink]]''. Projektarbeit<br> | |||
* | |||
*Kamal, A.: ''[[JetRacer: Optimierung der Streckenführung]]''. Projektarbeit | *Kamal, A.: ''[[JetRacer: Optimierung der Streckenführung]]''. Projektarbeit | ||
== Theoretical Background == | |||
The NVIDIA® Jetson Nano™ is a small, powerful computing platform ideal for embedded AI projects. It allows the execution of real-time video analysis, neural network inference, and hardware-accelerated image processing using tools like MATLAB® and GPU Coder. | |||
Classical lane detection algorithms and steering control (e.g., PD controllers) are fundamental in autonomous driving and were combined with neural networks to improve the JetRacer’s decision-making. | |||
Convolutional Neural Networks (CNNs) are a core part of this project. They process images in layers—first detecting edges and shapes, then combining them to recognize lanes. Pooling layers reduce data size while preserving important features, helping the model run faster on limited hardware. The final layers (fully connected or “dense” layers) interpret these features and output the steering decision. | |||
In training, the following notion should be understood: | |||
*'''Epochs''': represent full passes through the dataset. More epochs typically improve learning up to a point, but too many can lead to overfitting. | |||
*'''Root Mean Square Error (RMSE)''': measures how far off the model’s predictions are—lower RMSE values indicate more accurate steering predictions. | |||
*'''Accuracy''': measures the percentage of correct predictions. In classification models (like predicting discrete steering directions), accuracy helps track how well the model is learning to choose the correct class. Higher accuracy indicates better model performance, especially when validation accuracy is also high. | |||
*'''Loss''': indicates how badly the model is performing. It is a numerical value that shows how far the model’s predictions are from the actual labels. During training, the goal is to minimize the loss function. A low training loss means the model is learning well; a low validation loss means it can generalize to new data. | |||
*'''Validation''': refers to the process of checking how well the model performs on unseen data (not used for training). A separate validation dataset is used to measure generalization performance and avoid overfitting. | |||
*'''Overfitting''': happens when the model learns the training data too well, including noise and outliers, but fails to perform well on new data. Signs of overfitting include high training accuracy but low validation accuracy. | |||
*'''Underfitting''': occurs when the model is too simple or not trained enough to capture the patterns in the data. Both training and validation accuracy remain low. | |||
*'''Batch''': a batch is a small group of training samples processed together before updating the model. Training on batches (instead of the full dataset) helps improve efficiency and generalization. The number of samples in one batch is called the '''batch size'''. | |||
*'''Learning Rate''': controls how big the model’s updates are during training. If it’s too high, the model may skip the optimal solution; if too low, training may be very slow or get stuck. | |||
*'''Training vs. Validation Accuracy/Loss''': while training accuracy/loss shows how well the model fits the training data, validation accuracy/loss indicates how well it performs on unseen data. A good model has both high accuracy and low loss on both datasets, with a small gap between them. | |||
Regression approaches output continuous values but were unstable during testing. This project instead uses **classification**, where each image maps to one of a few predefined steering categories (e.g., left, center, right). This gave better performance and more predictable behavior. | |||
* | |||
== Model Architecture == | |||
The JetRacer's steering model uses a **Convolutional Neural Network (CNN)**, a type of AI designed to process images and make decisions based on what it “sees”. | |||
The CNN works like this: | |||
*1. '''Input Layer''': Receives a grayscale image, resized to 224×224 pixels. | |||
*2. '''Convolutional Layers''': These scan the image to find patterns (like lines or edges). Early layers detect simple shapes; deeper layers recognize more complex patterns like lanes. | |||
*3. '''ReLU Activation''': This function makes sure only useful data passes through to the next layer. | |||
*4. '''Pooling Layers''': These reduce the image size while keeping important features, which makes the network faster and less sensitive to noise. | |||
*5. '''Flatten Layer''': Turns the filtered image into a 1D list of numbers. | |||
*6. '''Fully Connected Layers''': These make the final decision by combining the information and outputting a single steering command. | |||
*7. '''Output Layer''': The final result is a classification—e.g., turn left, go straight, or turn right. | |||
This setup is small enough to run efficiently on the Jetson Nano, and accurate enough to follow the lane smoothly. | |||
This model, trained on camera images with corresponding steering labels, helps the JetRacer stay in its lane without human intervention. | |||
== [[Understand the Existing System Framework]] == | |||
[[ | |||
== [[Optimize AI for Speed and Robustness in the Lab]] == | |||
== [[Improve the Controller (e.g., PD Controller)]] == | |||
== [[Use MATLAB to Train on Jetson Nano]] == | |||
== [[Drive JetRacer Counterclockwise Using a Gamepad, Limiting Speed (e.g., 1 m/s)]] == | |||
== [[Record a Lap Using a MATLAB Script]] == | |||
== [[Load and Retrain a Pretrained NN with a MATLAB GUI]] == | |||
== [[Optionally, Automate NN Training with Classic Lane Tracking]] == | |||
== [[Develop a PD Controller Using the NN, Coded in MATLAB for JetRacer GPU]] == | |||
== [[Autonomous Driving Analysis, sumarry And Conclusion]] == | |||
== [[Walkthrough all Matlab Code Used In This Project]] == | |||
== | == SVN Repository == | ||
*[https://svn.hshl.de/svn/HSHL_Projekte/trunk/JetRacer/ SVN Repository] | |||
== Getting Started == | |||
To get started, read the following articles: | |||
* Siddiquy, T.: ''[[Automated lane following of a Waveshare JetRacer with artificial intelligence]]. Bachelor's Thesis'' | |||
* Kamal, A.: ''[[JetRacer: Optimization of Lane Following]]. Project Work'' | |||
* [[Gantt-Diagram|Create a Gantt Diagram]] | |||
* [[Writing_Wiki_Articles | Tips for Writing a Wiki Article]] | |||
* [[Software_Planning|Introduction to PAP Designer]] | |||
* [[Software_Version_Management_with_SVN|Introduction to SVN]] | |||
== Useful Articles == | |||
* [https://de.mathworks.com/videos/matlab-and-simulink-robotics-arena-deep-learning-with-nvidia-jetson-and-ros--1542015526909.html Deep Learning with MATLAB, NVIDIA Jetson, and ROS] | * [https://de.mathworks.com/videos/matlab-and-simulink-robotics-arena-deep-learning-with-nvidia-jetson-and-ros--1542015526909.html Deep Learning with MATLAB, NVIDIA Jetson, and ROS] | ||
* [https://github.com/NVIDIA-AI-IOT/jetracer NVidia: JetRacer] | * [https://github.com/NVIDIA-AI-IOT/jetracer NVidia: JetRacer] | ||
* [https://www.formulaedge.org/what-is-jetracer formulaedge.org] | * [https://www.formulaedge.org/what-is-jetracer formulaedge.org] | ||
* [https://www.waveshare.com/wiki/JetRacer_AI_Kit Waveshare Wiki] | * [https://www.waveshare.com/wiki/JetRacer_AI_Kit Waveshare Wiki] | ||
* [https://de.mathworks.com/matlabcentral/answers/2072946-matlab-to-control-jetracer-jetson-nano-tx1-motor/?s_tid=ans_lp_feed_leaf FAQ: | * [https://de.mathworks.com/matlabcentral/answers/2072946-matlab-to-control-jetracer-jetson-nano-tx1-motor/?s_tid=ans_lp_feed_leaf FAQ: MATLAB to control JetRacer (Jetson Nano TX1) motor] | ||
* [https://arxiv.org/html/2404.06229v1 Towards Autonomous Driving with Small-Scale Cars: A Survey of Recent Development] | * [https://arxiv.org/html/2404.06229v1 Towards Autonomous Driving with Small-Scale Cars: A Survey of Recent Development] | ||
* [https://www.mathworks.com/help/ros/ug/lane-detection-in-ros2-using-deep-learning-with-matlab.html Lane Detection in ROS 2 Using Deep Learning with MATLAB] | * [https://www.mathworks.com/help/ros/ug/lane-detection-in-ros2-using-deep-learning-with-matlab.html Lane Detection in ROS 2 Using Deep Learning with MATLAB] | ||
| Zeile 139: | Zeile 164: | ||
* [https://www.mathworks.com/videos/machine-learning-with-simulink-and-nvidia-jetson-1653572407665.html Machine Learning with Simulink and NVIDIA Jetson] | * [https://www.mathworks.com/videos/machine-learning-with-simulink-and-nvidia-jetson-1653572407665.html Machine Learning with Simulink and NVIDIA Jetson] | ||
* [https://www.researchgate.net/publication/365940001_Comparative_Transfer_Learning_Models_for_End-to-End_Self-Driving_Car Comparative Transfer Learning Models for End-to-End Self-Driving Car] | * [https://www.researchgate.net/publication/365940001_Comparative_Transfer_Learning_Models_for_End-to-End_Self-Driving_Car Comparative Transfer Learning Models for End-to-End Self-Driving Car] | ||
* [https://www.researchgate.net/publication/349219294_Multi-task_deep_learning_with_optical_flow_features_for_self-driving_cars Multi-task | * [https://www.researchgate.net/publication/349219294_Multi-task_deep_learning_with_optical_flow_features_for_self-driving_cars Multi-task Deep Learning with Optical Flow Features for Self-Driving Cars] | ||
* [https://www.mathworks.com/help/reinforcement-learning/ug/train-dqn-agent-for-lane-keeping-assist.html Train DQN Agent for Lane Keeping Assist] | * [https://www.mathworks.com/help/reinforcement-learning/ug/train-dqn-agent-for-lane-keeping-assist.html Train DQN Agent for Lane Keeping Assist] | ||
* [https://www.researchgate.net/publication/372281750 Real-Time End-to-End Self-Driving Car Navigation] | * [https://www.researchgate.net/publication/372281750 Real-Time End-to-End Self-Driving Car Navigation] | ||
| Zeile 145: | Zeile 170: | ||
* [https://developer.nvidia.com/embedded/learn/jetson-ai-certification-programs Jetson AI Courses and Certifications] | * [https://developer.nvidia.com/embedded/learn/jetson-ai-certification-programs Jetson AI Courses and Certifications] | ||
* [https://forums.developer.nvidia.com/ NVIDIA Developer Forums] | * [https://forums.developer.nvidia.com/ NVIDIA Developer Forums] | ||
* [[ChatGPT | * [[ChatGPT Guide for a Lane Following Algorithm]] | ||
== | == Literature == | ||
S<span style="font-variant:small-caps">chreiber</span>, C.: '' | |||
S<span style="font-variant:small-caps">chreiber</span>, C.: ''AI-Supported "Follow-Me" Function Using the JetRacer as an Example''. Mittweida, Hochschule Mittweida – University of Applied Sciences, Faculty of Engineering Sciences, Master's Thesis, 2023. URL: [https://monami.hs-mittweida.de/frontdoor/deliver/index/docId/14754/file/MA_55114_Christian-Schreiber_geschwaerzt.pdf] | |||
---- | ---- | ||
→ | |||
→ back to the main article: [[Student_Projects|Student Projects]] | |||
Aktuelle Version vom 12. Juni 2025, 20:51 Uhr

| Author: | Evrard Leuteu |
| Type: | Project Work |
| Start Date: | TBD |
| Submission Date: | TBD |
| Supervisor: | Prof. Dr.-Ing. Schneider |
Introduction
The goal of this project was to optimize the JetRacer’s AI for autonomous navigation on the test circuit of the Autonomous Systems Laboratory at HSHL. The JetRacer was required to drive counterclockwise in the right lane as fast and robustly as possible using MATLAB® and a self-developed PD controller.
Tasks included training a neural network, limiting maximum speed to approximately 1 m/s, taking videos during laps, and deploying the system using GPU Coder.
- Familiarization with the existing framework.
- Optimization of the AI for the circuit in the Autonomous Systems Laboratory (speed, robustness).
- Optimization of the controller (e.g., PD controller).
- Use of MATLAB to train the Jetson Nano.
- Drive the JetRacer in the right lane counterclockwise with the gamepad controller. Limit the speed via Software to a maximum (e.g., 1 m/s).
- Take a video while driving a lap with MATLAB® using a MATLAB®-script.
- Load the pretrained NN.
- Train the pretrained NN with MATLAB® with a MATLAB®-App (GUI) by clicking the desired path in the images.
- Option: Use classic lane tracking algorithms to teach the NN automatically.
- Write a PD controller that uses the NN to drive in the right lane. Program this in MATLAB® and let it run on the JetRacer GPU using GPU Coder.
- Goal: the car should drive autonomously several laps in the right lane as fast as possible.
- Documentation according to scientific standards in the HSHL Wiki.
Requirements
The project requires prior knowledge in the following subjects. If you do not meet the requirements, you must acquire these skills during the course of the project using literature or online courses.
- Experience with Artificial Intelligence/Deep Learning
- Programming in C++, Python
- Document versioning with SVN
Requirements for Scientific Work
- Scientific approach (project plan, etc.), useful article: Create a Gantt diagram
- Weekly progress reports (informative), update the Meeting Minutes – live discussion with Prof. Schneider
- Project presentation in the Wiki
- Daily backup of project results in SVN
- Daily documentation of working hours
- Student Projects with Prof. Schneider
- Requirements for Scientific Work
Project Plan
Previous Work and Researched on The Topic
- Apu, M. L.: JetRacer: Spurführung mit künstlicher Intelligenz und MATLAB/Simulink. Projektarbeit
- Kamal, A.: JetRacer: Optimierung der Streckenführung. Projektarbeit
Theoretical Background
The NVIDIA® Jetson Nano™ is a small, powerful computing platform ideal for embedded AI projects. It allows the execution of real-time video analysis, neural network inference, and hardware-accelerated image processing using tools like MATLAB® and GPU Coder.
Classical lane detection algorithms and steering control (e.g., PD controllers) are fundamental in autonomous driving and were combined with neural networks to improve the JetRacer’s decision-making.
Convolutional Neural Networks (CNNs) are a core part of this project. They process images in layers—first detecting edges and shapes, then combining them to recognize lanes. Pooling layers reduce data size while preserving important features, helping the model run faster on limited hardware. The final layers (fully connected or “dense” layers) interpret these features and output the steering decision.
In training, the following notion should be understood:
- Epochs: represent full passes through the dataset. More epochs typically improve learning up to a point, but too many can lead to overfitting.
- Root Mean Square Error (RMSE): measures how far off the model’s predictions are—lower RMSE values indicate more accurate steering predictions.
- Accuracy: measures the percentage of correct predictions. In classification models (like predicting discrete steering directions), accuracy helps track how well the model is learning to choose the correct class. Higher accuracy indicates better model performance, especially when validation accuracy is also high.
- Loss: indicates how badly the model is performing. It is a numerical value that shows how far the model’s predictions are from the actual labels. During training, the goal is to minimize the loss function. A low training loss means the model is learning well; a low validation loss means it can generalize to new data.
- Validation: refers to the process of checking how well the model performs on unseen data (not used for training). A separate validation dataset is used to measure generalization performance and avoid overfitting.
- Overfitting: happens when the model learns the training data too well, including noise and outliers, but fails to perform well on new data. Signs of overfitting include high training accuracy but low validation accuracy.
- Underfitting: occurs when the model is too simple or not trained enough to capture the patterns in the data. Both training and validation accuracy remain low.
- Batch: a batch is a small group of training samples processed together before updating the model. Training on batches (instead of the full dataset) helps improve efficiency and generalization. The number of samples in one batch is called the batch size.
- Learning Rate: controls how big the model’s updates are during training. If it’s too high, the model may skip the optimal solution; if too low, training may be very slow or get stuck.
- Training vs. Validation Accuracy/Loss: while training accuracy/loss shows how well the model fits the training data, validation accuracy/loss indicates how well it performs on unseen data. A good model has both high accuracy and low loss on both datasets, with a small gap between them.
Regression approaches output continuous values but were unstable during testing. This project instead uses **classification**, where each image maps to one of a few predefined steering categories (e.g., left, center, right). This gave better performance and more predictable behavior.
Model Architecture
The JetRacer's steering model uses a **Convolutional Neural Network (CNN)**, a type of AI designed to process images and make decisions based on what it “sees”.
The CNN works like this:
- 1. Input Layer: Receives a grayscale image, resized to 224×224 pixels.
- 2. Convolutional Layers: These scan the image to find patterns (like lines or edges). Early layers detect simple shapes; deeper layers recognize more complex patterns like lanes.
- 3. ReLU Activation: This function makes sure only useful data passes through to the next layer.
- 4. Pooling Layers: These reduce the image size while keeping important features, which makes the network faster and less sensitive to noise.
- 5. Flatten Layer: Turns the filtered image into a 1D list of numbers.
- 6. Fully Connected Layers: These make the final decision by combining the information and outputting a single steering command.
- 7. Output Layer: The final result is a classification—e.g., turn left, go straight, or turn right.
This setup is small enough to run efficiently on the Jetson Nano, and accurate enough to follow the lane smoothly.
This model, trained on camera images with corresponding steering labels, helps the JetRacer stay in its lane without human intervention.
Understand the Existing System Framework
Optimize AI for Speed and Robustness in the Lab
Improve the Controller (e.g., PD Controller)
Use MATLAB to Train on Jetson Nano
Drive JetRacer Counterclockwise Using a Gamepad, Limiting Speed (e.g., 1 m/s)
Record a Lap Using a MATLAB Script
Load and Retrain a Pretrained NN with a MATLAB GUI
Optionally, Automate NN Training with Classic Lane Tracking
Develop a PD Controller Using the NN, Coded in MATLAB for JetRacer GPU
Autonomous Driving Analysis, sumarry And Conclusion
Walkthrough all Matlab Code Used In This Project
SVN Repository
Getting Started
To get started, read the following articles:
- Siddiquy, T.: Automated lane following of a Waveshare JetRacer with artificial intelligence. Bachelor's Thesis
- Kamal, A.: JetRacer: Optimization of Lane Following. Project Work
- Create a Gantt Diagram
- Tips for Writing a Wiki Article
- Introduction to PAP Designer
- Introduction to SVN
Useful Articles
- Deep Learning with MATLAB, NVIDIA Jetson, and ROS
- NVidia: JetRacer
- formulaedge.org
- Waveshare Wiki
- FAQ: MATLAB to control JetRacer (Jetson Nano TX1) motor
- Towards Autonomous Driving with Small-Scale Cars: A Survey of Recent Development
- Lane Detection in ROS 2 Using Deep Learning with MATLAB
- Train DQN Agent for Lane Keeping Assist
- Build Neural Networks for Self-Driving Cars with MATLAB
- DLI Training: Deep Learning for Autonomous Vehicles
- Machine Learning with Simulink and NVIDIA Jetson
- Comparative Transfer Learning Models for End-to-End Self-Driving Car
- Multi-task Deep Learning with Optical Flow Features for Self-Driving Cars
- Train DQN Agent for Lane Keeping Assist
- Real-Time End-to-End Self-Driving Car Navigation
- Hello AI World
- Jetson AI Courses and Certifications
- NVIDIA Developer Forums
- ChatGPT Guide for a Lane Following Algorithm
Literature
Schreiber, C.: AI-Supported "Follow-Me" Function Using the JetRacer as an Example. Mittweida, Hochschule Mittweida – University of Applied Sciences, Faculty of Engineering Sciences, Master's Thesis, 2023. URL: [1]
→ back to the main article: Student Projects
