This project aims to develop an autonomous RC car using reinforcement learning and lidar sensors. The project involves training a neural network in a simulated environment using Webots and transferring the trained model to a real RC car for real-world testing.
![Voiture](https://private-user-images.githubusercontent.com/115778954/330918372-022129c9-feba-4c57-9f09-c53270332cac.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMDAxODIsIm5iZiI6MTcyMzk5OTg4MiwicGF0aCI6Ii8xMTU3Nzg5NTQvMzMwOTE4MzcyLTAyMjEyOWM5LWZlYmEtNGM1Ny05ZjA5LWM1MzI3MDMzMmNhYy5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxOFQxNjUxMjJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jNmQ3YzlkOWQ4ZWJlYTc3ZDExNjY2OTc5ZGM2ZTJhMWRiZDc0OGFhY2EyMjY1ZDIzMWE4YTI2NDAxYjA4YTUzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.vz0rolRTvRIK7Alc-F5NkbkFm6DPwHnUphAUeAmxJD8)
The simulation environment for this project was set up using Webots, a robotic simulation software. Webots allows for creating a realistic virtual environment where the reinforcement learning model can be trained efficiently and safely before transferring it to a real-world scenario.
![Voiture](https://private-user-images.githubusercontent.com/115778954/330917406-eaf13dee-a31c-4978-9791-05a28c6d7b8e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMDAxODIsIm5iZiI6MTcyMzk5OTg4MiwicGF0aCI6Ii8xMTU3Nzg5NTQvMzMwOTE3NDA2LWVhZjEzZGVlLWEzMWMtNDk3OC05NzkxLTA1YTI4YzZkN2I4ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxOFQxNjUxMjJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04MzUzMzQ5ZTM0Mzg0MDM4YmMzMjhmMGNlN2RhZGRlNzY4OWVhODIyMmQwNWYwMjc5OGFmMzkyYTIzYjgxZWUzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.O3ktxm5TnsLQVqfupmLuGEvxMFkcxWoZsZGJgs6P6xw)
The real-world implementation of the autonomous RC car involves several key components and technologies. Here is an overview of the hardware and software used:
- Raspberry Pi: The central processing unit for the RC car, running the Python code and handling sensor data.
- Python Code: Custom scripts developed to control the car, process sensor inputs, and execute the trained neural network model.
- Lidar: A lidar sensor is mounted on the car to provide real-time distance measurements, crucial for obstacle detection and navigation.
- Motors: The RC car is equipped with Dynamixel motors for precise control of steering and propulsion.
- TT02 Kit: The Tamiya TT02 chassis kit provides a robust and reliable base for the RC car, supporting the integration of all other components.
![Voiture](https://private-user-images.githubusercontent.com/115778954/330917395-df9dc62e-74a0-4777-90d5-bba6b7506e64.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQwMDAxODIsIm5iZiI6MTcyMzk5OTg4MiwicGF0aCI6Ii8xMTU3Nzg5NTQvMzMwOTE3Mzk1LWRmOWRjNjJlLTc0YTAtNDc3Ny05MGQ1LWJiYTZiNzUwNmU2NC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxOFQxNjUxMjJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05MTU4ZGNkOTQ0ZWNiZTlmODBkYmQ4NjJlNGMzMzIwMDcxNzI3ZmU5MmQ2MTU0NzRhNTRkMTcxNWQwMmVkMGIxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.3y2cqQm0ky6MhyKtKC3g0TtE64LqE8qrocjFyDiCs2w)
The model has been trained using reinforcement learning in the Webots simulation environment. The algorithm we used is Proximal Policy Optimization (PPO).
The trained model is transferred from the simulation environment to the real RC car for real-world testing. This process involves several steps to ensure a smooth transition and optimal performance:
Improving Similarity:
- Adjust physical parameters to make the simulation more realistic.
- Use realistic coefficients of friction, car mass, motor power, number of driving wheels, steering angle, and lidar parameters.
Domain Randomization:
Implemented domain randomization to introduce randomness, preventing overfitting to the simulation environment and enhancing robustness in real-world scenarios1.
-
Measurement Noise:
Add Gaussian noise to sensor measurements (e.g., Lidar) to mimic real-world sensor imperfections.
-
Action Noise:
Add randomness to car actions (e.g., steering angle, speed) to handle real-world variations.
For instance, the steering response of the simuated car for a given steering command had the following non-linear shape :
Using a random parameter
$b$ we introduce randomness which increases the robustness of the model. -
Random Obstacles:
Add random obstacles to the track to improve model robustness.
- Successfully trained the RL model in Webots with domain randomization.
- Improved model robustness by adding randomness to sensor measurements and car actions.
-
Transferred the trained model to the real RC car.
-
Observed the performance in a racing event, demonstrating the effectiveness and areas for improvement.
Observations:
- The car performed well in simulations and had promising results in real-world testing.
- Encountered zigzagging behavior in straight lines due to discrepancies in simulation parameters and real-world conditions.
Suggested Improvements:
- Optimize the real-world car code for better performance seems the most relevant thing to do.
- Use Progressive Neural Networks for continuous learning in real-world conditions2.
- Consider simpler simulations for potentially better sim2real transfer3.
Further details can be found in the report.pdf
file.
Footnotes
-
Tobin, J., Fong, R., Ray, A., Schneider, J., Zaremba, W., & Abbeel, P. (2017). Domain Randomization for Transferring Deep Neural Networks from Simulation to the Real World. Available at https://arxiv.org/abs/1703.06907. ↩
-
Rusu, A. A., Rabinowitz, N. C., Desjardins, G., Soyer, H., Kirkpatrick, J., Kavukcuoglu, K., Pascanu, R., & Hadsell, R. (2022). Progressive Neural Networks. Available at https://arxiv.org/abs/1606.04671. ↩
-
Truong, J., Rudolph, M., Yokoyama, N. H., Chernova, S., Batra, D., & Rai, A. (2023). Rethinking Sim2Real: Lower Fidelity Simulation Leads to Higher Sim2Real Transfer in Navigation. In Proceedings of The 6th Conference on Robot Learning. Available at https://proceedings.mlr.press/v205/truong23a.html. ↩