In this project we present a solution to industrialize the production of donkeycar car raspberry pi images and allow everyone to be able to install easily the donkeycar environnement. We have also added some tools like our manager to make public demonstrations, led several donkeycars to the public having now knowledge of the project, register for a driving session (with an estimated waiting time), drive with multiple cars at the same time and see in live on a huge screen their time lapses, start a recorded driving then view their own model in action (without handling transfers ...).
๐ก uses the original donkeycar project
๐ How to use this project
Before using this project you need to build your donkeycar. If you don't have a donkeycar, please follow this tutorial made by the donkeycar community
if you are using a wide angle camera like this, we have modeled a camera cap holder on the chassis a camera cap holder. Convenient to avoid losing it
๐ open chassis stl file
If you wanted to use our features and improvements you should create your own recipe book with your wanted recipes. Indeed, ansible has a configuration file where we specify what options ( recipe ) we want, so you have to modify the donkeycar.yml file and comment recipes you don't want
roles:
- role: raspi-config #rasperry pi configuration role
become: yes # This role need root privileges
- role: car-config # car configurations (ntp, hostname, ds4drv...)
become: yes # This role need root privileges
- role: shutdown-btn # shutdown button service
become: yes # This role need root privileges
- role: ps4-controller # install and configure ds4drv
become: no # This role no need root privileges
- role: openCV # Install openCV (optional)
become: yes # This role need root privileges
- role: donkeycar # Donkeycar installation
become: no # This role doesn't need root privileges
- role: mycar # create car with configurations
become: no # This role no need root privileges
- role: IR-lap-timer # install dependencies for take charge IR counter
become: yes # This role need root privileges
๐ ansible/donkeycar.yml preview
raspi-config
: defaults installations like wifi credentials, ssh ...car-config
: car configurations (ntp, hostname, ds4drv...)shutdown-btn
: add scripts for the shutdown button ( see documentation and schematic )ps4-controller
: installation of ds4drv and configuration for ps4 bluetooth controllersopenCV
: install openCV according to donkeycar documentationdonkeycar
: install donkeycar project and its requirementsmycar
: create mycar folder with its filesIR-lap-timer
: Infrared installation and configuration
Don't comment required recipes (raspi-config, car-config, donkeycar, mycar ), this action can prevent the proper functioning of installations or configurations
โ ๏ธ Some features have hardware requirement. **Please read our electronic schematic
-
modify configuration for single car
Before deployed your recipe, you should modify config var with your configurations like
wpa_suplicant
to specify acces point name and credentials, donkeycar steering, throttle configuration and ip's of donkeycar serversโ ๏ธ If you change the server ip or just change server pc, you should change ip configurations manually at/etc/systemd/system/donkeycar.service
. -
configuration for multiple cars with the same image
You can configure the cars independently, in our case we have 4 configurations (see ansible/config). To do this, you should specify add the car's hostname and mac address:
e4:5f:01:68:17:2c dababycar
afterwards, just create a folder with the car name at
ansible/config
. For our example we should create dababycar folder atansible/config/dababycar
.In this folder we should to create two file configuration :
ds4drv.env
--> ps4 controller colormyconfig.py
--> donkeycar myconfig
example :
CONTROLLER_LED_COLOR=A103FC
DRIVE_TRAIN_TYPE = "PIGPIO_PWM" # SERVO_ESC|DC_STEER_THROTTLE|DC_TWO_WHEEL|SERVO_HBRIDGE_PWM|PIGPIO_PWM|MM1|MOCK STEERING_CHANNEL = 12 #channel on the 9685 pwm board 0-15 STEERING_LEFT_PWM = 739 #pwm value for full left steering STEERING_RIGHT_PWM = 400 #pwm value for full right steering STEERING_PWM_PIN = 12 #Pin numbering according to Broadcom numbers STEERING_PWM_FREQ = 75 #Frequency for PWM STEERING_PWM_INVERTED = False #If PWM needs to be inverted THROTTLE_CHANNEL = 13 #channel on the 9685 pwm board 0-15 THROTTLE_FORWARD_PWM = 575 #pwm value for max forward throttle max 750 THROTTLE_STOPPED_PWM = 470 #pwm value for no movement THROTTLE_REVERSE_PWM = 400 #pwm value for max reverse throttle THROTTLE_PWM_PIN = 13 #Pin numbering according to Broadcom numbers THROTTLE_PWM_FREQ = 75 #Frequency for PWM THROTTLE_PWM_INVERTED = False #If PWM needs to be inverted AUTO_RECORD_ON_THROTTLE = False #if true, we will record whenever throttle is not zero. if false, you must manually toggle recording with some other trigger. Usually circle button on joystick. CONTROLLER_TYPE='custom' # Set the controller to be used to be our custom one () LOGGING_LEVEL='DEBUG'
After having created your ansible playbook, you can launch it with these two options :
- install it by ssh but you should configure manually internet, ssh and install ansible on your raspberry pi. Follow this tutorial
- generate your raspian image with donkeycar installed using packer.follow this tutorial
Our lap-timer is based on an infrared emitting tower, each car is counting it's lap timings and they are displayed in live in the DonkeyCar manager (public screen). If you want to build your one, you can follow this documentation
1 - Run our backend according to our documentation
2 - Run our frontend according to our documentation
3 - Run jsfw server for wired controllers documentation
About our architecture :
โจ Our features
we have made a ansible book to automate our donleycar and raspberry pi installation remotely (ssh). Indeed, these recipes allow us to have one single clean installation and be able to repeat it to infinity.
โน๏ธ Read documentation !!
With ansible and packer, we can also generate a raspian image with our donkeycar installation. This feature is very usefull if we want to share it with people and don't use ssh.
โน๏ธ Read documentation !!
We have created a donkeycar manager. This manager is separated in to parts : a backend ( with database, api ...) and a frontend ( vuejs 2), it allow us to see cars who running, stopped, manage players in races...
โน๏ธ For more informations about how it works, you can see our documentation here
We have created some shortcuts for easily make maintenance task like for test camera, shutdown car... See documentation
we have made a shutdown button, to shutdown car manually because when ssh crash we can't make a clean shutdown and we risk to damage the SD card See documentation
This led indicator allow us to know if the car is up or not. If the led is up, the car working.
we using
KY-022
sensor for our cars, It allow us to count laps when a car pass front of the infrared emitting tower
For count laps in donkeycar manager, we should build a infrared emitting tower. If you want to build your one, you can follow this documentation
โน๏ธ see documentation
โน๏ธ see documentation