How do I make my yeti go?

9 posts / 0 new
Last post
Paxo Parrot
How do I make my yeti go?

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?

Jamie
Jamie's picture
Missing line in file

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

Paxo Parrot
Thanks for that, but now I

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.

Jamie
Jamie's picture
rc.local

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

Paxo Parrot
I don't know why, but when I

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.

Arron Churchill
Arron Churchill's picture
Code not running

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:

cd /
sudo python /home/pi/formulapi/Formula.py

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.

Paxo Parrot
Okay, cheers.

Okay, cheers.

I THINK it's working now. Annoyingly, I've run out of 9v batteries.

Arron Churchill
Arron Churchill's picture
Always the way...

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:

        ImageProcessor.SetImageMode(ImageProcessor.WAIT_FOR_LIGHTS)

and change it to read

        ImageProcessor.SetImageMode(ImageProcessor.FOLLOW_TRACK)

instead.

The change will mean that when WaitForGo() is called in Race.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!

Paxo Parrot
Cheers. :)

Cheers. :)

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Syntax highlight code surrounded by the <pre class="brush: lang">...</pre> tags, where lang is one of the following language brushes: bash, cpp, perl, python.
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Comment Images
Files must be less than 10 MB.
Allowed file types: png gif jpg jpeg.
Comment Attachments
Files must be less than 10 MB.
Allowed file types: txt pdf nfo doc docx rtf jpg png gif bmp zip tar gz csv xls.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.