Linux cheat sheet for Donkey Car

Once you ssh onto your Pi you are expected to use linux commands:

  • cd | Change directory. When you are lost type ‘cd’ and you will end up in your home directory where you always start. ’~’ means your home directory, ‘..’ Means the directory above
  • cd d2 | Go down into the ‘d2’ directory
  • ls | List directory. You should get something like this:

(dk) pi@willburro:~/d2 $ ls

  • data logs models
  • nano | Edit donkeycar config file before you start the program
  • history | Shows you all commands you recently typed. You get something like this:

746 python drive --model ~/d2/models/mypilot

747 sudo poweroff

748 cd d2

749 python drive --model ~/d2/models/mypilot

750 sudo poweroff

751 sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

752 sudo power

  • !746 | Reruns command numbered 746 above. Up down cursor will also show you previous commands, and Left right cursor allows you to edit your previous commands
  • <Control-C> | Quits your current program
  • rm -r ~/d2/data/tub_* | Deletes all data
  • ls -1 ~/d2/data/tub_1_18-04-21/*.jpg | wc -l | Count number of pictures in the tub
  • du -s ~/d2/data/* | Lists size of each tub

For more commands and its function, you may check out

How to expand the partition in your SD Card

Raspberry Pi image is not using the whole SD card. You'll need to expand the partition to use all 16/32GB of the card.

Here are the steps:

  1. SSH into your Raspberry Pi
  2. Type `df -h` to see the current disk size, should be around 2.7G.
  3. Type `sudo raspi-config` to configuration tool.
  4. Select `7 Advanced Options`.
  5. Select `A1 Expand Filesystem`.
  6. Select `<Finish>` to exit configuration tool and reboot.
  7. After the Raspberry Pi is rebooted, SSH back into it and type `df -h` again. You should see the disk size is around 30G now.

You can capture a lot more training data now!