Strategy 3 – Automating Raspberry Pi setup with a script
Git and copying code are great for keeping code safe, but they don't help you reinstall and reconfigure Raspberry Pi OS on a card. However, we’ve already brought in a powerful tool – pyinfra. This can be used to manage configuration and software on the Raspberry Pi that will support our robot.This can let us automate everything, as a headless system, and recreate things if it all goes wrong.We’ll need a few helper scripts (alongside update_code.py) in the deploy folder and one to make a new robot running all the other tasks.Let’s start by making update packages and then installing some Python basics on the robot that we’ll need for later.
Updating packages
When you’ve installed Raspberry Pi OS on an SD card, the packages and package index can be out of date. It’s common to do update them before installing other packages.We can make a script to manage this for us. Create...