systemetric / shepherd

👨‍🌾 Shepherd is the code management system used on the RoboCon brains
Other
2 stars 1 forks source link

Shepherd fails to run if it's not on a pi #36

Open Minion3665 opened 3 years ago

Minion3665 commented 3 years ago

Shepherd uses the raspberry pi GPIO pins and the raspberry pi camera, which means that it can't run without a raspberry pi.

The package fake-rpi is in the dev-dependencies on poetry, but is unused when running sudo python3 app.py; there is not a module to emulate the raspberry pi's camera.

What needs to be done:

Minion3665 commented 3 years ago
WillMunns commented 3 years ago

Shepherd on the Brain is launched as a systemd process, the relative path is predictable and settable by the configuration, if you use relative paths then the brain will work, but it will break if you do things like running shepherd not from its actual directory.

We cannot use ~ for home because of reasons, if we did we would still be hardcoding the directory, so its probably "bad".

We could have the installation of Robot and Shepherd as environment variables, this would break deployed brains if the change slipped into a patch.

Possibly the solution is all of the above, use pathlib to search for a known directory ([robot/]robot?) or file ([robot/]robot/__init__.py) from an ENV, then home/pi/robot, then ../robot then ~/robot. Obviously, if we are doing this then we need to add a message on stdout for where we are getting robot from.

We are already doing something like this for other reasons to find the default team image.