I've had this robot for the last 6 months, and I've finally worked out how to get the code right make it go round the track. Yey!
But, how do I actually make my yeti work?
I've powered it with the 9v battery, and turned it on. It boots up. (I added a USB, HDMi so I can see what it's doing while it's running, and I can control the 4 motors individually from the GUI, so that bit all works.
I've waved coloured lights at it, and nothing happens.
I've now come to the conclusion that I need to add a line of code somewhere to make it auto run.
Could someone please help?
Hi Paxo,
It sounds like you might be missing the line in rc.local that runs the formula.py file at start up. This blog post towards the end has some instructions in the final note section that should help you
https://www.formulapi.com/race-code/sd-card-winter-2016
Thanks for that, but now I have another question.
It says to add the line of code to rc.local.
Problem is, which one? I've searched for rc.local, and I found 2 copies. One dated 06/04/15. 820 bytes, and one dated 27/05/16. 420 bytes.
They both seem to be buried deep in the /dev directory.
The rc.local file should be in /etc folder
Here is a web page with further info about the file
https://www.raspberrypi.org/documentation/linux/usage/rc-local.md
I don't know why, but when I do a file search, it doesn't show rc.local in the /etc file.
Anyways, I've typed sudo nano /etc/rc.local into the terminal and it appeared.
Is there a specific location in the file I need to add the line of code? Because I put sudo python /home/pi/formulapi/Formula.py & as line 1, and it still doesn't work.
The command should be placed further down, just before the
exit 0
line. Having said that I do not think this will be the problem.The best thing to do here would be to check the script itself is actually working first. Run the command like this from the terminal:
You will not need the
&
in this case, and without it you can use CTRL+C to end the scrpt early.If you need to have a monitor / keyboard attached to do this then you can place the YetiBorg on top of something so that the wheels do not touch the ground.
Okay, cheers.
I THINK it's working now. Annoyingly, I've run out of 9v batteries.
I have had that problem many times, especially when we first started the actual race series.
We keep a small army of rechargeable AAs and 9V batteries plus chargers for both so that we have plenty of batteries on standby for the racing and for any testing / development for robots we are working on.
On a side note you can make a slight alteration to the code to skip the light detection stage if you want. All you need to do is look for this line in
RaceCodeFunctions.py
:and change it to read
instead.
The change will mean that when
WaitForGo()
is called inRace.py
the YetiBorg will immediately start racing rather than waiting to see the green and red start lights. If you do make the change remember to put the original version back before submitting any code for the series!Cheers. :)
Add new comment