StarlingUAS / ProjectStarling

BRL Flight Arena Infrastructure 2.0
Other
17 stars 3 forks source link

Base OS Image configuration and auto build #30

Open mhl787156 opened 3 years ago

mhl787156 commented 3 years ago

Configuration and auto build system for base OS images

rob-clarke commented 3 years ago

k3s configuration in: /etc/rancher/k3s/config.yaml

Content:

node-label:
  - "starling.uas/type=vehicle"
node-taint:
  - "starling.uas/type=vehicle:NoSchedule"
rob-clarke commented 3 years ago

Add the chrony package and add to configuration in /etc/chrony/chrony.conf:

server ${TIMESERVER_IP} iburst prefer

Source IP from image build config?

mhl787156 commented 3 years ago

Yes, thats a good idea. All drones are assumed to need a timeserver. Only exception is outdoors where drones may have internet? However outdoors will need extra configuration anyway, so that just needs to be added to the notes in the docs.

liamf555 commented 3 years ago

Add RPI-GPIO to image

rob-clarke commented 3 years ago

Look at installing rootless docker in image

mhl787156 commented 3 years ago

As of right now, here are the list of additional instructions that must be run on the current image (that Liam gave to me on Teams) which afaik only contains RPI-GPIO:

#1 make sure k3s_install.sh is executable
sudo chmod +x k3s_install.sh

#2 Put the px4 udev rules in the right place
# The file is from here: https://github.com/CopterExpress/clover/blob/master/clover/udev/99-px4fmu.rules
cp 99-pxfmu.rules /lib/udev/rules.d/

#3 Install Time synchonisation through Chrony
sudo apt-get install chrony
echo server 192.168.10.80 iburst prefer >> /etc/chrony/chrony.conf

#4 Update Docker Daemon to include the registry mirror
sudo cat <<EOF >/etc/docker/daemon.json
{
    "registry-mirrors": ["http://192.168.10.80:5000"]
}
EOF

#5 Add vehicle config template file with default values
sudo cat <<EOF >/etc/starling/vehicle.config
VEHICLE_FCU_URL=serial:///dev/px4fmu
VEHICLE_FIRMWARE=px4
VEHICLE_MAVLINK_SYSID=13
VEHICLE_NAME=clover13
EOF

#6 Enable i2c, 
echo dtparam=i2c_arm=on >> /boot/config.txt
echo dtparam=i2s=on >> /boot/config.txt
echo dtparam=spi=on >> /boot/config.txt

echo i2c-dev >> /etc/modules
  1. Add shutdown button (#50)!

Put the following python script in the home directory shutdown.py.txt

And this in /lib/systemd/system/shutdown.service

[Unit]
Description=Shutdown Service
After=multi-user.target

[Service]
Type=simple
WorkingDirectory=/home/pi/
User=root
ExecStart=/usr/bin/python3 /home/pi/shutdown.py

[Install]
WantedBy=multi-user.target

Then run to ensure it automatically starts up sudo systemctl enable application.service


That is all the steps I have figured out so far I think and hopefully covers everything!

mhl787156 commented 3 years ago

Also note for future readers, the configuration mentioned here: https://github.com/UoBFlightLab/ProjectStarling/issues/30#issuecomment-806024167

Has now been changed to:

starling.dev/type: vehicle
starling.dev/vehicle-class: rotary
starling.dev/vehicle-type: clover