Running the simulator

27 posts / 0 new
Last post
topshed
Running the simulator

Hi,

I'm having problem getting the simulator to work. First of all I should confess that I'm running it on a Mac because I don't have a Windoze PC.

The simulator seems to run ok and I when I run SimulationFull.py on my Pi it connects and starts printing fps values. However when I activate the green lights nothing happens. Should the image in the top left of the simulator screen show the lights coming on?

I've got some modified race code but don't want to upload it until I've at least tested it a little bit.

thanks in advance

Richard

piborg
piborg's picture
Simulation lights

Yes, you should see the lights in the image on the top left.
I have attached an image below with the green lights on.

From memory the simulation has not been tested on a Mac.
It would probably help if you can attach an image of what the simulation screen looks like on your machine.

As a temporary measure you can get the code to skip waiting for lights.
First open RaceCodeFunctions.py and look for this line:

        ImageProcessor.SetImageMode(ImageProcessor.WAIT_FOR_LIGHTS)

and change it to .

        ImageProcessor.SetImageMode(ImageProcessor.FIRST_STRAIGHT)

Just remember to undo the change before uploading your code!

Comment Images: 
topshed
Thanks for your reply.

Thanks for your reply.

Here's what it looks like on the Mac. The green (or red) lights never come on.

Comment Images: 
topshed
I tried the fix you suggested

I tried the fix you suggested and now the YetiBorg starts moving! Thank you.

However it seems to zig-zag randomly across the track until it hits the sides and then the camera view goes grey and the bars by the rear wheels start filling up red. This is using the standard (unmodified) race code.

Is this to what is supposed to happen? Should there be a marker showing the car's progress around the track?

Comment Images: 
piborg
piborg's picture
Simulation running

The simulation shows the grey image when the YetiBorg has left the track.
There should be a small image of a YetiBorg on the track showing the current position.

Here is a video from an older version of the simualtor showing a run with the standard code unmodified:

topshed
Really helpful!

Thanks for the movie - it's really helpful to see what it is supposed to look like. On my Mac, the marker car does not appear at all.

The good news is that I now seem to have some code which can successfully complete a lap without crashing off!

topshed
Problems with simulation on windows

I'd like to test the start of race process so I borrowed my son's Win10 laptop to try the simulation. Unfortunately it is even worse than on the Mac! The main window doesn't show at all, only the controls on the left.

I'm running java 1.8.0.101-b13

Comment Images: 
piborg
piborg's picture
Graphics card / chipset

Do you know what graphics card / chipset the laptop is using?

Based on the error message it may be that it does not support all the necessary OpenGL functions.
From another thread it looks like the card would need to support a version of OpenGl of 3.2 or newer.

There is a tool you can use to check the OpenGL support on a machine here: http://www.realtech-vr.com/glview/
When the program is run it should show what version is supported, there will also be a "see details" link to the right of the version with more detailed information.

topshed
Here's the output

Renderer: Intel(R) HD Graphics 3000
Vendor: Intel
Memory: 1809 MB
Version: 3.1.0 - Build 9.17.10.4229
Shading language version: 1.40 - Intel Build 9.17.10.4229

Max texture size: 8192 x 8192
Max vertex texture image units: 16
Max texture image units: 16
Max geometry texture units: 0
Max anisotropic filtering value: 16
Max viewport size: 8192 x 8192
Max Clip Distances: 6
Max samples: 4

Extensions: 129

GL_3DFX_texture_compression_FXT1
GL_ARB_color_buffer_float
GL_ARB_compatibility
GL_ARB_copy_buffer
GL_ARB_depth_buffer_float
GL_ARB_depth_clamp
GL_ARB_depth_texture
GL_ARB_draw_buffers
GL_ARB_draw_buffers_blend
GL_ARB_draw_elements_base_vertex
GL_ARB_draw_instanced
GL_ARB_explicit_attrib_location
GL_ARB_fragment_coord_conventions
GL_ARB_fragment_program
GL_ARB_fragment_program_shadow
GL_ARB_fragment_shader
GL_ARB_framebuffer_object
GL_ARB_framebuffer_sRGB
GL_ARB_half_float_pixel
GL_ARB_half_float_vertex
GL_ARB_instanced_arrays
GL_ARB_map_buffer_range
GL_ARB_multisample
GL_ARB_multitexture
GL_ARB_occlusion_query
GL_ARB_occlusion_query2
GL_ARB_pixel_buffer_object
GL_ARB_point_parameters
GL_ARB_point_sprite
GL_ARB_provoking_vertex
GL_ARB_sampler_objects
GL_ARB_seamless_cube_map
GL_ARB_shader_bit_encoding
GL_ARB_shader_objects
GL_ARB_shading_language_100
GL_ARB_shadow
GL_ARB_sync
GL_ARB_texture_border_clamp
GL_ARB_texture_buffer_object_rgb32
GL_ARB_texture_compression
GL_ARB_texture_compression_rgtc
GL_ARB_texture_cube_map
GL_ARB_texture_env_add
GL_ARB_texture_env_combine
GL_ARB_texture_env_crossbar
GL_ARB_texture_env_dot3
GL_ARB_texture_float
GL_ARB_texture_non_power_of_two
GL_ARB_texture_query_lod
GL_ARB_texture_rectangle
GL_ARB_texture_rg
GL_ARB_texture_rgb10_a2ui
GL_ARB_timer_query
GL_ARB_transpose_matrix
GL_ARB_uniform_buffer_object
GL_ARB_vertex_array_bgra
GL_ARB_vertex_array_object
GL_ARB_vertex_buffer_object
GL_ARB_vertex_program
GL_ARB_vertex_shader
GL_ARB_vertex_type_2_10_10_10_rev
GL_ARB_window_pos
GL_ATI_separate_stencil
GL_EXT_abgr
GL_EXT_bgra
GL_EXT_blend_color
GL_EXT_blend_equation_separate
GL_EXT_blend_func_separate
GL_EXT_blend_minmax
GL_EXT_blend_subtract
GL_EXT_clip_volume_hint
GL_EXT_compiled_vertex_array
GL_EXT_draw_buffers2
GL_EXT_draw_range_elements
GL_EXT_fog_coord
GL_EXT_framebuffer_blit
GL_EXT_framebuffer_multisample
GL_EXT_framebuffer_object
GL_EXT_gpu_program_parameters
GL_EXT_multi_draw_arrays
GL_EXT_packed_depth_stencil
GL_EXT_packed_float
GL_EXT_packed_pixels
GL_EXT_rescale_normal
GL_EXT_secondary_color
GL_EXT_separate_specular_color
GL_EXT_shadow_funcs
GL_EXT_stencil_two_side
GL_EXT_stencil_wrap
GL_EXT_texture3D
GL_EXT_texture_array
GL_EXT_texture_compression_s3tc
GL_EXT_texture_edge_clamp
GL_EXT_texture_env_add
GL_EXT_texture_env_combine
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_integer
GL_EXT_texture_lod_bias
GL_EXT_texture_rectangle
GL_EXT_texture_shared_exponent
GL_EXT_texture_snorm
GL_EXT_texture_sRGB
GL_EXT_texture_swizzle
GL_EXT_transform_feedback
GL_IBM_texture_mirrored_repeat
GL_INTEL_map_texture
GL_INTEL_performance_queries
GL_NV_blend_square
GL_NV_conditional_render
GL_NV_primitive_restart
GL_NV_texgen_reflection
GL_SGIS_generate_mipmap
GL_SGIS_texture_edge_clamp
GL_SGIS_texture_lod
GL_WIN_swap_hint
WGL_ARB_buffer_region
WGL_ARB_create_context
WGL_ARB_extensions_string
WGL_ARB_framebuffer_sRGB
WGL_ARB_make_current_read
WGL_ARB_multisample
WGL_ARB_pbuffer
WGL_ARB_pixel_format
WGL_ARB_pixel_format_float
WGL_EXT_depth_float
WGL_EXT_extensions_string
WGL_EXT_pixel_format_packed_float
WGL_EXT_swap_control
WGL_EXT_swap_control_tear

Core features
v3.0 (100 % - 23/23)
v3.1 (100 % - 8/8)
v3.2 (70 % - 7/10)
v3.3 (70 % - 7/10)
v4.0 (21 % - 3/14)
v4.1 (0 % - 0/7)
v4.2 (0 % - 0/13)
v4.3 (0 % - 0/23)
v4.4 (0 % - 0/10)
v4.5 (0 % - 0/11)
vARB 2015 (0 % - 0/13)
vARB 2016 (0 % - 0/1)

OpenGL driver version check (Current: 3.1.0 - Build 9.17.10.4229, Latest known: 9.17.10.4229):
Outdated version of display drivers detected
According the database, you are might be not using the latest version of display drivers for your video card.

No ICD registry entry
The current OpenGL driver doesn't expose the SOFTWARE/Microsoft/Windows (NT)/CurrentVersion/OpenGLDrivers registry entry. Unable to detect the driver version, driver revision name and filename.

Extension verification:
GL_EXT_color_subtable was not found, but has the entry point glColorSubTableEXT
GL_EXT_paletted_texture was not found, but has the entry point glColorTableEXT
GL_EXT_paletted_texture was not found, but has the entry point glGetColorTableEXT
GL_EXT_paletted_texture was not found, but has the entry point glGetColorTableParameterfvEXT
GL_EXT_paletted_texture was not found, but has the entry point glGetColorTableParameterivEXT

piborg
piborg's picture
OpenGL 3.2 only partially supported

The OpenGL support does seem to be the issue, the log suggests that v3.2 is only partially supported.

Towards the end of the output it suggests there might be a more recent driver.
Could you check to see if that is the case?

topshed
On the latest

Updating the driver directly doesn't find a newer version. I downloaded the Intel tool that should find and identify any new drivers and that said it was the latest too. The Toshiba support site doesn't offer anything either :-(

piborg
piborg's picture
Not sure what to suggest

I am a little unsure if there is much that can be done here.

I will ask computernerd486 to have a look and see if he has any suggestions.

topshed
Success

Finally got the simulation fully functional - ended up running it in a Windows VM or my MAC

thanks for all your help!

piborg
piborg's picture
Windows VM

Glad to hear you found a way to get everything to work in the end ^_^

Out of curiosity what virtual machine software did you use to get things running?
Did you have to make any special changes at all?

topshed
Used VMware Fusion

Didn't need to do anything other than install the latest Java SDK!

casramsey
Same open GL problem

I'm having the same problems as topshed in that I'm getting the following exception:

Exception in thread "main-AWTAnimator#00" com.jogamp.opengl.util.AnimatorBase$UncaughtAnimatorException: java.lang.RuntimeException: com.jogamp.opengl.GLException: Caught GLException: Method "glActiveTexture" not available on thread AWT-EventQueue-0
at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:92)
at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
at com.jogamp.opengl.util.Animator$MainLoop.run(Animator.java:204)
at java.lang.Thread.run(Unknown Source)

The trouble is, when I try and run GLView it crashes. Graphics drivers all seem up to date. Anybody got a good solution, or is running a VM the only way to go?

computernerd486
GL Exception

The VM is a decent so gap, I'll try and dig into that error running after work and see if I can come up with anything.

I've been unable to replicate, so it's a touch harder to debug.

piborg
piborg's picture
Bug with the GLEW code?

It sounds like there is a potential problem with this particular function with at least one Intel graphics chip on OSX.

Here is a thread discussing the problem:
http://arstechnica.com/civis/viewtopic.php?f=19&t=271491

If that really is the case it will be very difficult to work around.
Without this call textures are a royal pain, it puts the OpenGL support back to before 1.3, which has been around since 2001!

Unfortunately this is why I would typically avoid Intel graphics chips, their driver support for functionality is woefully lacking.

Thomas
Same problem

Hi,
I have worked for the past 3 monster borg series EVERYTIME on a Mac normally without any problems. But recently in the summer 2018 series my MacBook Pro needs a battery replacement.

They gave me an exchange device (a MacBook Pro Late 2011 with Java 1.8.0_181 and MacOs 10.12.6) and there I notice the same problem. Start light not there. But it seems to me that there are even more minor problems. So I could do only basic simulation testing.

On my Mac (MBP early 2013) I have used MacOS 10.12 and 10.13 versions without any problems and always with Java 1.8.0_xxx.

My nephew uses a Mac Mini (old but still current version, same MacOS and Java) and he has no problems too.

Thomas

autox
Time for a new simulator?

I've tried 5 platforms (below) and none work. I've been at this for days. This is extremely frustrating.

Any other suggestions?

Hardware: Mid-2010 iMac 27", macOS 10.13 (High Sierra), ATI Radeon HD 5670 (OpenGL 4.1)

OSX El Capitan, macOS High Sierra, latest JDK

Guest OS
Windows 10, Java(TM) SE Runtime Environment (build 1.8.0_191-b12), DirectX 9.0c (June 2010), OpenGL 1.1

VirtualBox on El Capitan, VMWare Fusion 11 on High Sierra

Hardware: Lenovo ThinkPad X120e, Ubuntu 16.04, OpenGL 3.1

Arron Churchill
Arron Churchill's picture
Trouble running the simulator

That is really surprising. Generally speaking Windows and Linux machines work fine...

Do you see the same errors on all of the machines, or do they show different ones?

It may also help if you can attach a screenshot of the main simulator screen looks as well.

autox
Right pane renders, left pane

Right pane renders, left pane all white. Errors generally complain about OpenGL / jogl support, either stating the version is too low, or possibly saying some function name is unavailable. High Sierra didn't have any errors at all, it just didn't render the left pane.

Arron Churchill
Arron Churchill's picture
White pane

The entirely white pane sounds like something failed very early in the rendering.

Just to check did you have the whole simulation folder and all of the sub-folders copied? I have seen that kind of error when some of the files in the img or settings folder were missing before.

autox
Ran it from the repo folder.

Ran it from the repo folder.

I'll go through it again this weekend and report the specific errors. No errors on High Sierra is odd. VMWare Fusion 11 said my iMac is too old for its 3D support and I can't find a Fusion 10 distro. It sounds like VBox simply won't support this due to demands (or lack there of) from their user base. I found a forum comment on JOGL (Linux) suggesting a known problem with a fix in a patch but I don't know when the next version (2.3.3) will be released and I *really* don't want to get in to building a custom library to pull in the patch.

autox
6th time is a charm. I dug

6th time is a charm. I dug up an old Intel NUC out of the basement and installed Win10.

I have lights, I have action, and a prompt crash on the Pi - my car drives straight through the wall at the first turn.

The Pi gets the light changes, but maybe doesn't get any frames once the race starts?

SimulationFull.py:

pi@tart:~/formulapi $ ./SimulationFull.py
Libraries loaded
Running script in directory "."
Error reading team colour
Colour: 1.00, 1.00, 1.00
>>> LED: 1.0 1.0 1.0
Image processor and Race Code Functions loaded
=== NEW SETTINGS ===

[Image setup]
Camera 160 x 120 at 30 fps
X cropped from 0 to 160
Y cropped from 60 to 120
Image processing threads: 4

[Startup]
Initial mode: 1

[Y scan lines]
60 (0)
63 (3)
66 (6)
69 (9)
72 (12)
75 (15)
78 (18)
81 (21)
84 (24)
87 (27)
90 (30)
93 (33)
96 (36)
99 (39)
102 (42)
105 (45)
108 (48)
111 (51)
114 (54)
117 (57)

[Colour identification]
Black limit: 90 100 50
Green gain: 1.10
Blue gain: 1.45
Target level for auto-gain: 200
Erosion factor for colour channels: 2
Final colour minimums: 1 1 1

[Line correction]
Colour edge gap: 32 pixels
Lane gap: 100 pixels
Offset Y calculation target 0: (15)
Corrective gain for derivative: 4.600

[Start marker detection]
Levels: Min Red = 45, Max Green = 60, Max Blue = 60
Start minimum match ratio: 90.0 %
Start crossed delay 0.10 s (3 frames)
Start re-detection delay: 10.0 s
Start detection zone X limits: 64 to 96
Start detection zone Y position: 40
[PID values]
P0: 0.100000 I0:0.000000 D0: 0.100000
P1: 0.055000 I1:0.000000 D1: 0.055000
P2: 0.000000 I2:0.000000 D2: 0.000000

[FIR filter]
Taps: 3

[Drive settings]
Maximum output: 100.0 %
Steering -200.0 % to +200.0 % (central +0.0 %)
Missing frames before stopping: 15

[Override settings]
Stuck detection threshold: 2.00
Stuck detection time: 1.00 s (30 frames)
Stuck reversing time: 0.70 s (21 frames)
Stuck hunting time: 0.40 s (12 frames)
Stuck colour detection at 80 x 48
Wrong way detection threshold: 10
Wrong way spin time: 0.80 s (24 frames)
Robot in front detection threshold: 36
Overtaking lane shift: 1.00
Overtaking time: 3.00 s (90 frames)

====================

Setup stream processor threads
06:57:06.792598 Processor thread 1 started with idle time of 0.27s

06:57:06.794833 Processor thread 2 started with idle time of 0.27s

06:57:06.796997 Processor thread 3 started with idle time of 0.27s

06:57:06.799387 Processor thread 4 started with idle time of 0.27s

Setup control loop
06:57:06.820124 Control loop thread started with idle time of 0.07s

Start Race.py
Start simulation capture thread
Press CTRL+C to quit
./SimulationFull.py:253: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
if frame == None:
/home/pi/formulapi/ImageProcessor.py:800: RuntimeWarning: divide by zero encountered in divide
adjustment = 255.0 / maximum
/home/pi/formulapi/ImageProcessor.py:874: RuntimeWarning: divide by zero encountered in divide
autoGainR = Settings.targetLevel / rAll.max()
/home/pi/formulapi/ImageProcessor.py:875: RuntimeWarning: divide by zero encountered in divide
autoGainG = Settings.targetLevel / gAll.max()
/home/pi/formulapi/ImageProcessor.py:876: RuntimeWarning: divide by zero encountered in divide
autoGainB = Settings.targetLevel / bAll.max()
/home/pi/formulapi/ImageProcessor.py:878: RuntimeWarning: invalid value encountered in multiply
red = (red - dropR) * Settings.redGain * autoGainR
/home/pi/formulapi/ImageProcessor.py:879: RuntimeWarning: invalid value encountered in multiply
green = (green - dropG) * Settings.greenGain * autoGainG
/home/pi/formulapi/ImageProcessor.py:880: RuntimeWarning: invalid value encountered in multiply
blue = (blue - dropB) * Settings.blueGain * autoGainB
06:57:07.445893 StartDetailedLoging()

06:57:07.468794 StartUserLog()

06:57:07.487113 WaitForGo()

22.1 FPS
30.0 FPS
31.0 FPS
29.3 FPS
31.0 FPS
30.4 FPS
30.4 FPS
31.4 FPS
29.6 FPS
30.0 FPS
30.0 FPS
30.8 FPS
30.9 FPS
29.4 FPS
29.7 FPS
31.0 FPS
30.7 FPS
30.9 FPS
29.2 FPS
30.9 FPS
29.4 FPS
30.8 FPS
30.2 FPS
30.5 FPS
30.1 FPS
29.8 FPS
31.1 FPS
29.9 FPS
30.3 FPS
31.6 FPS
29.3 FPS
06:57:38.334440 Lights: 1 - Green

31.0 FPS
29.2 FPS
06:57:40.266100 Lights: 2 - Red

32.2 FPS
29.5 FPS
06:57:41.924138 Lights: 3 - Green

06:57:41.954405 Lights: GO

06:57:42.057935 WaitForWaypoint(2)

06:57:42.069890 WaitForDistance(3.470)

06:57:42.118356 LapCount()

06:57:42.149509 GetDistance()

06:57:42.161210 GetDistance()

06:57:42.432389 LapCount()

30.7 FPS
06:57:42.475629 GetDistance()

./SimulationFull.py:340: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
if Globals.displayFrame != None:

(Processed:25916): Gtk-WARNING **: cannot open display:
Segmentation fault
pi@tart:~/formulapi $

Arron Churchill
Arron Churchill's picture
Simulation crashing

That is great that you have managed to get the simulator running :)

The python side of the simulation is failing because it is trying to open a GUI screen: Gtk-WARNING **: cannot open display:

You either need to run it in a graphical environment where it can display a GUI screen, such as a VNC connection, or turn the viewing options off in the SimulationFull.py script.

The settings which enable GUI output are:

ImageProcessor.writeImages = True
ImageProcessor.showProcessing = True
ImageProcessor.predatorView = True

Make sure all of these are set to False to stop the script opening GUI windows.

autox
Finally got it all working.

Finally got it all working.

Thanks for the help.

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.