Simulation.py version of open cv?

13 posts / 0 new
Last post
crashmeplease
crashmeplease's picture
Simulation.py version of open cv?

Hello, I am having trouble running the simulation on my network, everything seems to load, says wait for go etc but nothing happens when i change the lights.

what i do notice is that I have this error;

Exception in thread Thread-8:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "./SimulationFront.py", line 255, in run
    frame = cv2.imdecode(frame, cv2.CV_LOAD_IMAGE_COLOR)
AttributeError: 'module' object has no attribute 'CV_LOAD_IMAGE_COLOR'

11:09:57.252507 WaitForGo()

So I was wondering if this is related? Is it a difference in open cv versions or have i missed a module. The Pi is a fresh version of raspbian stretch and full compiled opencv 3.3. I notice you have a recommended method of installation, are there module/version differences?

On a second note the Pi running the script seems to want to connect to 192.168.1.131, this ip is not on my network. Could it be that it does not find the server instead? I have changed the ip in the simulation.py script to match my java simulation server.

dinotoo
I think the fastest method is

I think the fastest method is to format sdcard and follow this : https://www.formulapi.com/race-code/sd-card-monster-summer-2017

crashmeplease
crashmeplease's picture
Agreed, I will go down this

Agreed, I will go down this route then we are all on the same page thanks.

Arron Churchill
Arron Churchill's picture
OpenCV version

Unfortunately they changed the names of a number of variables in OpenCV between the older (2.X) and newer (3.X) versions. These changes also affect some of the function calls slightly. It would be possible to update the code to run with the newer OpenCV, but we would need a custom setup SD card to run your code for the racing :)

The version of OpenCV installed on our SD cards appears to be 2.4.9.1 (print cv2.__version__). Any 2.X version should work fine though.

The IP address for simulationIP should be set to the Java simulation server. The 192.168.1.131 value is an old default, the latest code has 127.0.0.1 as standard (same machine).

crashmeplease
crashmeplease's picture
I will re-install everything

I will re-install everything as per the instructions given above, that should iron out any differences in open cv version. Yes it's a pain when the devs make minor changes to libraries and things like this..

As for the IP address, I had set the 127x to my server IP so don't understand why it was looking for 192.168.1.131. I downloaded the code a few days ago, I will have to find out the link location I was given, but is it possible that I have an old version of the code then?

Thanks.

dinotoo
And you got to specify the

And you got to specify the java server IP in SimulationFull.py

crashmeplease
crashmeplease's picture
Yes I had already set the IP

Yes I had already set the IP in that file, thanks, just didn't understand the call to the 192.68.1.131.

Arron Churchill
Arron Churchill's picture
IP address 192.168.1.131

By any chance are you entered into the RaceYourCode competition?

If so this would explain the connection to that machine. In the RaceYourCode setup this is the machine on our network which generates the live statistics view for the stream. Put simply the code is trying to send data to display to that IP address.

The IP address used for this is in the ipDisplay value inside Settings.py. On race day this needs to be 192.168.1.131 so you can see the values, but for local testing you can either set this to a different address to view the values using DisplayReadings.py, or simply ignore it. See the Guides\The scripts.txt file for more details.

crashmeplease
crashmeplease's picture
By any chance are you entered


By any chance are you entered into the RaceYourCode competition?

Yes that's correct.

Ah that is good to know thanks. So I assume that if I do change any of the code that I must preserve these variables so everyone can see what the borg thinks is happening and trying to do..? Although in the time I have I doubt I'll be making any substantial changes like that!

Arron Churchill
Arron Churchill's picture
Variables for display

You can change them if you like, but we recommend that you keep them. Basically the display on the stream is mostly so that you can tell what is going on when the robots are racing.

All of the values are held in Globals.dataToSend, found in Globals.py. They are updated by the UpdateDataToSend function in DataTransmission.py.

There are also three empty values which the code does not use, but will be displayed. They are user-1, user-2, and user-3 in Globals.dataToSend. They can contain numbers or text, whatever may be useful to know :)

crashmeplease
crashmeplease's picture
You'll be glad to know it's

You'll be glad to know it's all running now using the recommended setup, thanks.

dinotoo
Good news, you can focus on

Good news, you can focus on the code now !

Arron Churchill
Arron Churchill's picture
Good to hear

I am happy to hear that you have it all working now :)

The messages with registration information and links should have come from info@formulapi.com, so make sure it is on your spam filter allow list. The email with the code links has the subject "Formula Pi: Standard Race Code access - added"

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.