Running the simulator on Windows?

25 posts / 0 new
Last post
Saska
Running the simulator on Windows?

Hi! I'm trying to run the simulation, but it's not working. If i try to double-click the jarfile, nothing happens. If i try using a .bat or the command line, it shoots out my screen resolution, but after that nothing happens.

Am i doing something wrong?
Thanks,

-Sas :)

Arron Churchill
Arron Churchill's picture
What output do you get on the command line?

Can you copy / screenshot the output you see on the command line?

Usually it displays the starting positions and settings for each robot on the track, then the main screen becomes visible.

Like this:

D:\Formula_Pi\Simulation>Simulation.bat

D:\Formula_Pi\Simulation>java -jar Sim.jar
Screen: [1920x1080]
Loading File: [file:///D:/Formula_Pi/Simulation/tracks/final.trk]
Start [1] : [550.0,60.0]
Start [2] : [550.0,90.0]
Start [3] : [550.0,120.0]
Start [4] : [550.0,150.0]
Start [5] : [550.0,180.0]
Bot Settings:
tyre_diameter : 8.4
bount_length : 19
motor_ref_rpm : 180
body_width : 8.4
bound_width : 18
motor_ref_volt : 6
tyre_width : 4.2
motor_accel : 0.05
motor_max_volt : 10.0
motor_decel : -0.01

Bot Settings:
tyre_diameter : 8.4
bount_length : 19
motor_ref_rpm : 180
body_width : 8.4
bound_width : 18
motor_ref_volt : 6
tyre_width : 4.2
motor_accel : 0.05
motor_max_volt : 10.0
motor_decel : -0.01

Bot Settings:
tyre_diameter : 8.4
bount_length : 19
motor_ref_rpm : 180
body_width : 8.4
bound_width : 18
motor_ref_volt : 6
tyre_width : 4.2
motor_accel : 0.05
motor_max_volt : 10.0
motor_decel : -0.01

Bot Settings:
tyre_diameter : 8.4
bount_length : 19
motor_ref_rpm : 180
body_width : 8.4
bound_width : 18
motor_ref_volt : 6
tyre_width : 4.2
motor_accel : 0.05
motor_max_volt : 10.0
motor_decel : -0.01

Bot Settings:
tyre_diameter : 8.4
bount_length : 19
motor_ref_rpm : 180
body_width : 8.4
bound_width : 18
motor_ref_volt : 6
tyre_width : 4.2
motor_accel : 0.05
motor_max_volt : 10.0
motor_decel : -0.01

Bot Settings:
tyre_diameter : 8.4
bount_length : 19
motor_ref_rpm : 180
body_width : 8.4
bound_width : 18
motor_ref_volt : 6
tyre_width : 4.2
motor_accel : 0.05
motor_max_volt : 10.0
motor_decel : -0.01

Video Stream Settings:
port : 10000
res : 160x120
autostart : false

[4.199999809265137,0.0]
[3.99443718704001,1.297871317434465]
[3.3978712220670335,2.4686979475172475]
[2.4686979475172475,3.3978712220670335]
[1.2978713174344652,3.99443718704001]
[2.571758161418022E-16,4.199999809265137]
[-1.2978713174344647,3.9944371870400106]
[-2.468697947517247,3.3978712220670335]
[-3.397871222067033,2.468697947517248]
[-3.99443718704001,1.2978713174344654]
[-4.199999809265137,5.143516322836044E-16]
[-3.99443718704001,-1.2978713174344663]
[-3.3978712220670335,-2.468697947517247]
[-2.468697947517248,-3.397871222067033]
[-1.2978713174344656,-3.99443718704001]
[-7.715274484254065E-16,-4.199999809265137]
[1.2978713174344643,-3.9944371870400106]
[2.4686979475172466,-3.397871222067034]
[3.397871222067033,-2.4686979475172484]
[3.99443718704001,-1.2978713174344658]
Saska
The only thing I can see is

The only thing I can see is Screen: [1920x1080]

Arron Churchill
Arron Churchill's picture
Running from a command prompt

When you try running the simulation from a command prompt:

  1. What directory are you in?
  2. What command are you using to run the simulation?
  3. What output do you get from this command: java -version
Saska
1. I'm in the simulation

1. I'm in the simulation directory.
2. java -jar Sim.jar
3. 1.8.0_121

Arron Churchill
Arron Churchill's picture
Full Java details

What I meant was the full details from java -version, for example:

D:\Formula_Pi\Simulation>java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Saska
Java -version

Oops, sorry. It says
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

Arron Churchill
Arron Churchill's picture
Not sure what is wrong

No problem, it did not show anything which would explain the issue anyway :)

I am struggling to figure out what could be wrong here, it sounds like everything is right but it is obviously not running properly.

  1. Is there any other output at all of any kind, such as blank windows or error messages?
  2. When you run the command from the prompt does it return to the prompt straight away, or do you have to end the program yourself (e.g. CTRL+C)?
  3. Inside the simulation directory do you have these directories:
    img, Notices, settings, Sim_Lib, tracks
  4. Inside the tracks directory do you have a final.trk file?
  5. What version of Windows are your running?
Saska
More info

1. Nope. Nothing.

2. It keeps running, i have to end the program.

3. Only Notices and Sim_Lib

4. There is no tracks folder.

5. Windows 10

Arron Churchill
Arron Churchill's picture
Missing folders

It would seem you are missing the folders which contain the settings for drawing the track and the robots.
If I delete the folders you are missing I see the same problem here, so that is the cause of the strange behaviour.

You should have a directory tree which looks something like this:

C:\FRL\SOURCEFORGE\FORMULAPI\SIMULATION
|   Notice.txt
|   Readme.txt
|   Sim.jar
|   Simulation.bat
|
+---img
|       bot.png
|       bot_lid.png
|       bot_lid_template.png
|       bot_overview.png
|       bot_rim.png
|       bot_rim_inner.png
|       bot_tyre.png
|       chassis.png
|       lightbar_soft.png
|       track_v3.png
|
+---Notices
|       jogl.LICENSE
|       netty.LICENSE
|
+---settings
|       bot.conf
|       server.conf
|
+---Sim_lib
|       gluegen-rt-natives-linux-amd64.jar
|       gluegen-rt-natives-linux-i586.jar
|       gluegen-rt-natives-macosx-universal.jar
|       gluegen-rt-natives-windows-amd64.jar
|       gluegen-rt-natives-windows-i586.jar
|       gluegen-rt.jar
|       gluegen.jar
|       jmf.jar
|       jogl-all-natives-linux-amd64.jar
|       jogl-all-natives-linux-i586.jar
|       jogl-all-natives-macosx-universal.jar
|       jogl-all-natives-windows-amd64.jar
|       jogl-all-natives-windows-i586.jar
|       jogl-all.jar
|       netty-all-4.1.4.Final.jar
|
\---tracks
        default.trk
        final.trk

Probably the best thing to do is re-download the whole simulation folder from SourceForge,

Saska
That's what I'll do then.

That's what I'll do then. Thanks for the help!

Megawhat
No module named CV2 - windows7

Hi,

I am trying to run the simulator on Windows7 and getting a blank white screen at the moment (see attached).

I went to the directory to try to run "SimulationFull.py"
According to \\Guides\Simulation modes.txt

step 6 - Run the SimulationFull.py script on the Raspberry Pi and wait until it has printed "WaitForGo()".

I tried to run this on Windows, and it says
Traceback (most recent call last):
File "C:\Python\MonsterPi Code\SimulationFull.py", line 16, in
import cv2
ImportError: No module named cv2

My question is as follows
1. Is the simulator supposed to run on windows, with the Race-code run in Raspberry Pi? If yes, how do I connect the 2 computers?
2. If the simulator can run stand-alone on Windows (using windows 7 and without the pi), how do I make the pictures (race track and car) appear? Do I download open CV?
A. I have tried using the web page
https://github.com/opencv/opencv/releases/
Do I download 2.4.13.6 or 3.4.1? Are they both compatible with each other?
B. I currently have both Python 2.7.14 (for formula pi) and 3.6.4 (for python class which ends in 2 weeks)

Please accept my apologies for asking so many questions.
I am a newbie to Pi and so am learning as I go. Any tip will be greatly appreciated.

Many Thanks in advance.

Cheers,
Megawhat

Comment Images: 
dinotoo
Running the simulator on Windows?

You can launch SimulationFull.py on a raspberry or under W7, for me, using a raspberry is required only for cpu usage testing.

So don't forget network setup in SimulationFull.py (here, SimulationFull.py is lauched under W7, so IP is localhost 127.0.0.1 but with a raspberry, you got to set IP with W7 address) :
simulationIP = '127.0.0.1' # Address of the machine running the simulation
simulationPort = 10000 # Port number used by the simulation

If you're using a rapsberry, check that your W7 firewall allow connections between your rpi & W7.

My W7 setup for current winter season :
python 2.7.5
opencv 2.4.13
numpy 1.10.2

Guideline to follow fot current season : https://www.formulapi.com/race-code/sd-card-monster-summer-2017

Arron Churchill
Arron Churchill's picture
Setting up the simulation on Windows

For the SimulationFull.py script we usually recommend running it on a Raspberry Pi to check that it should work correctly on the robots, but it should work fine running on Windows as well.

We have some instructions on getting OpenCV setup on Windows here: OpenCV under Windows.

If you do run SimulationFull.py on the same machine then it should be ready to go, otherwise see dinotoo's reply above for the changes needed to get the script to talk to the simulation running on another machine.

The simulator itself does not need OpenCV, but it does need OpenGL v3.2 support. This is usually provided by the graphics card and its driver.

When you run the simulator it should also have a terminal window (black screen with white text). Are there any error messages shown?

Megawhat
Cannot see script print "Lights 1- Green

Hi guys,

Thank you very much for the tips so far. It has moved me to the next steps.

I successfully downloaded Open CV and Numpy and checked that our versions match.

I have now started the simulator. It is still showing a blank screen (White), however, in my python window, I am able to see 30fps, 20fps continously (as described in Step 6).

I tried to press the Green Button, it does nothing, the Red button does nothing (Please see screen print 1).
7. Press the Green button under StartSettings.
The script should print "Lights: 1 - Green".

I tried just about every other button and i still don't see the screen "Print" anything about light changing
If I press Ctrl + C, it just goes down the screen and "Wait for Waypoint (Please see screen print 2)

Do you have any recommendations?

Thanks,
Megawhat

Comment Images: 
picos_pit_crew
Not seeing the lights in the simulator.

If you have a widescreen display then the simulator won't see the lights if the window is maximised. I dont know why, it's one of a few simulator bugs waiting to be fixed. Does it work if the window is floating?

picos_pit_crew
PS...

Ps. Because theyve used some kind of high intensity LED's, in real life rather than green-red-green, what the camera sees is more like white-white-white. Don't rely on the simulator to create a reliable start lights detector. In fact don't rely on the simulator for anything, except for a bit of fun between races.

Arron Churchill
Arron Churchill's picture
Simulation not working

It is likely that the images from the simulator are not being generated correctly as they are related to the part which draws the view on the simulator screen. In other words we need to get the simulator to work correctly first before the script will be able to use it.

Can you copy / screenshot the text output from the other window opened when you run Simulation.bat? It should be another terminal with lots of text.

Usually it displays the starting positions and settings for each robot on the track, then the main screen becomes visible.

Like this:

D:\Formula_Pi\Simulation>Simulation.bat

D:\Formula_Pi\Simulation>java -jar Sim.jar
Screen: [1920x1080]
Loading File: [file:///D:/Formula_Pi/Simulation/tracks/final.trk]
Start [1] : [550.0,60.0]
Start [2] : [550.0,90.0]
Start [3] : [550.0,120.0]
Start [4] : [550.0,150.0]
Start [5] : [550.0,180.0]
Bot Settings:
tyre_diameter : 8.4
bount_length : 19
motor_ref_rpm : 180
body_width : 8.4
bound_width : 18
motor_ref_volt : 6
tyre_width : 4.2
motor_accel : 0.05
motor_max_volt : 10.0
motor_decel : -0.01

Bot Settings:
tyre_diameter : 8.4
bount_length : 19
motor_ref_rpm : 180
body_width : 8.4
bound_width : 18
motor_ref_volt : 6
tyre_width : 4.2
motor_accel : 0.05
motor_max_volt : 10.0
motor_decel : -0.01

Bot Settings:
tyre_diameter : 8.4
bount_length : 19
motor_ref_rpm : 180
body_width : 8.4
bound_width : 18
motor_ref_volt : 6
tyre_width : 4.2
motor_accel : 0.05
motor_max_volt : 10.0
motor_decel : -0.01

Bot Settings:
tyre_diameter : 8.4
bount_length : 19
motor_ref_rpm : 180
body_width : 8.4
bound_width : 18
motor_ref_volt : 6
tyre_width : 4.2
motor_accel : 0.05
motor_max_volt : 10.0
motor_decel : -0.01

Bot Settings:
tyre_diameter : 8.4
bount_length : 19
motor_ref_rpm : 180
body_width : 8.4
bound_width : 18
motor_ref_volt : 6
tyre_width : 4.2
motor_accel : 0.05
motor_max_volt : 10.0
motor_decel : -0.01

Bot Settings:
tyre_diameter : 8.4
bount_length : 19
motor_ref_rpm : 180
body_width : 8.4
bound_width : 18
motor_ref_volt : 6
tyre_width : 4.2
motor_accel : 0.05
motor_max_volt : 10.0
motor_decel : -0.01

Video Stream Settings:
port : 10000
res : 160x120
autostart : false

[4.199999809265137,0.0]
[3.99443718704001,1.297871317434465]
[3.3978712220670335,2.4686979475172475]
[2.4686979475172475,3.3978712220670335]
[1.2978713174344652,3.99443718704001]
[2.571758161418022E-16,4.199999809265137]
[-1.2978713174344647,3.9944371870400106]
[-2.468697947517247,3.3978712220670335]
[-3.397871222067033,2.468697947517248]
[-3.99443718704001,1.2978713174344654]
[-4.199999809265137,5.143516322836044E-16]
[-3.99443718704001,-1.2978713174344663]
[-3.3978712220670335,-2.468697947517247]
[-2.468697947517248,-3.397871222067033]
[-1.2978713174344656,-3.99443718704001]
[-7.715274484254065E-16,-4.199999809265137]
[1.2978713174344643,-3.9944371870400106]
[2.4686979475172466,-3.397871222067034]
[3.397871222067033,-2.4686979475172484]
[3.99443718704001,-1.2978713174344658]
Megawhat
Simulation.bat - output file

Hi Aaron,
As requested, attached is the text output from Simulation.bat.

It looks like the file above(The 2 files are taken 2min apart from the same session). Please let me know if this is not correct.

When I launch the simulator, the screen is square, (ie. not maximised).

Again, thank you for your help.

Cheers,
Megawhat

dinotoo
Running the simulator on Windows?

Seems to be an opengl issue.... a craphic card opengl driver issue : Try to download latest graphic card opengl driver for your graphic card. (for example for an Intel HD 3000, see https://www.intel.fr/content/www/fr/fr/support/articles/000005575/graphi... and https://downloadcenter.intel.com/fr/product/81500/C-ur-graphique-Intel-H...)

Then, after reboot, you can follow that :

Just launching .jar, you should have the track and the led bar displayed. The entire view had to be visible on your screen (for some reasons), if it's not case, move your window in order to see the entire view on your screen.

You must be in this state BEFORE launching SimulationFull, otherwise, it will not works.

Arron Churchill
Arron Churchill's picture
glClearDepthf not available

Those errors all seem to be the same, the code is trying to use the glClearDepthf function for OpenGL and it does not appear to be available.

The function is only available with OpenGL 4.1 or later support from the graphics card / driver.
glClearDepth — specify the clear value for the depth buffer

According to Wikipedia OpenGL 4.1 support should be available on "Nvidia GeForce 400 series and newer, AMD Radeon HD 5000 Series and newer, Intel HD Graphics in Intel Ivy Bridge processors and newer" (see here).

I agree with Dinotoo, see if there is a newer graphics driver for your machine. It is quite possible that you have an older driver which does not support OpenGL 4.1.

Megawhat
Thank you

Thanks Aaron,

it is a really old machine...
I will try this either on a newer computer or update my display drivers. Will keep you guys posted.

Hope you all have a good day!

Megawhat
Simulator worked! Thank you

Hello all,
Just want to say thank you for your support. Yes my computer was too old...

I have managed to follow the same instructions on a different computer and it is now working!

What an awesome simulator!

Arron Churchill
Arron Churchill's picture
Glad to hear you got it working :)

The simulator code was written by computernerd486 and is freely available on his GitHub here.

We are really grateful to him for all his hard work creating the simulator and improving it with new features. We only helped out by collecting some data for him to work with and writing the Python script which uses the simulation instead of a camera for the track images. He deserves all the credit :)

If you are interested you can see how the simulator progressed during its early development in the Race Simulation post.

dinotoo
Python, opencv... versions

Use same version specified in guidelines for Python, opencv, numpy and others libs is mandatory.

Others version = Possible bugs and support not easy if you have issues

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.