Skip to content

mdl29/donkeycarLPH

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

donkeycar LPH

repo-size contributor commitActivity mainLanguage

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

🧰 Build your own donkeycar


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

Tips :

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 chassis

πŸ“’ open chassis stl file

πŸ§ͺ Create your ansible recipe


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 controllers
  • openCV : install openCV according to donkeycar documentation
  • donkeycar : install donkeycar project and its requirements
  • mycar : create mycar folder with its files
  • IR-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 default car configurations


  • 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

    πŸ“’ ansible/group_vars/all

    ⚠️ 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:

    πŸ“’ ansible/config/hostnames

    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 at ansible/config/dababycar.

    In this folder we should to create two file configuration :

    • ds4drv.env --> ps4 controller color
    • myconfig.py --> donkeycar myconfig

    example :

    πŸ“’ ansible/config/dababycar/ds4drv.env

    CONTROLLER_LED_COLOR=A103FC

    πŸ“’ ansible/config/dababycar/myconfig.py

    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'

Our schematic


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

πŸ‘· Build infrared transmitter


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

🏎 Run our manager and happy race !


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 :

diagram


✨ Our features

Software


Ansible remote installation documentation :

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 !!

Generate raspian image with donkeycar installation :

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 !!

Donkeycar manager :

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

Hardware



Our schematic :

Fichier Fritzing

PS4 controller Shortcuts

We have created some shortcuts for easily make maintenance task like for test camera, shutdown car... See documentation

Shutdown button :

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

Led indicator :

This led indicator allow us to know if the car is up or not. If the led is up, the car working.

Infrared sensor

we using KY-022 sensor for our cars, It allow us to count laps when a car pass front of the infrared emitting tower

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

3D designs


Anti-theft for ps4 controllers :

ℹ️ see documentation

Camera cap holder :

ℹ️ see documentation