Problems in Testing Round 0
If you have not already seen the runs from the testing session check them out below. Skip to about 59 minutes to get to the end of the break.
As you probably heard we were having some issues with file permissions, but how did we find that out?
What we did during the break was to take one of the MonsterBorgs and attach a keyboard and monitor. Next we loaded one of the entries we could not get running and see what the output was in the terminal. The error we got was a bit surprising:
At first we thought that maybe that the upload was somehow missing files, but this is what we found:
It turns out we had assumed that the correct file permissions were already set in the .tar.gz
files uploaded. This was easily fixed by running
chmod +x /home/pi/formulapi/*.py chmod +x /home/pi/formulapi/*.sh
on each suspect card. We have also added this step into our SD card writing program.
At this point we re-tested all of the entries. This looked like everything was solved until one of the entries did this:
If you have been using Linux for a while you may have seen this error before, it means that the file has Windows style line endings, not Unix style ones :(
The reason the line endings matter is the very top of the Formula.py
file:
#!/usr/bin/env python
This tells the Linux command prompt to run the file using Python. The problem is that Windows uses two characters to end each line, causing the command prompt to get confused by the extra symbol, causing the error.
This second problem is easily fixed by changing the line endings, but we would have to do that for each entry. This is particularly awkward as Macs use a different scheme again. Instead it can be fixed by telling the command prompt to use Python directly like so:
sudo python /home/pi/formulapi/Formula.py
and in /etc/rc.local
using:
sudo python /home/pi/formulapi/Formula.py &
Python itself does not care which line endings are used, so this solves the issue in all cases :)
We made this change to all of the SD cards as well and they now all start the code properly. We have also fixed our standard SD card image to include this second change for both YetiBorgs and MonsterBorgs.
On a side-note we also noticed a slight mistake of logic. One of the colours we have used for MonsterBorg identification is green. This was a bad idea as the MonsterBorgs start in battery monitoring mode, which shows green to indicate the batteries are good. From now on we will use cyan instead of green so it is clear the code has actually started correctly.
Those of you who have watched the runs may also be wondering about Team Engima's entry (#1) running backwards. It turns out this was our fault as well... Put simply one of the MonsterBorgs we were running had incorrect wiring, causing forward and backward to be swapped. We have fixed the robot now and will re-run Team Engima in the second part of Testing Round 0 later today.
Add new comment