Simulation woes

10 posts / 0 new
Last post
ubuntu_guy
Simulation woes

Hi everyone, I'm new here and really looking forward to taking part. Firstly apologies if I'm rushing in and missing anything but it seems I really don't have much time left to hit the ground running and between work and a demanding toddler I genuinely do only have a few hours to work on this until the first deadline.

I am firstly attempting to get the simulation to run before I start modifying anything. Is it possible to get both parts to run on the same computer? I am running Ubuntu and it would be great if I could do rough working on my laptop as dragging a PI around with keyboard, mouse, screen etc is just not as practical.

I have attempted to run the java file, nothing happened. Attempting to run SimulationFull.py produces the following output:

Libraries loaded
Traceback (most recent call last):
File "SimulationFull.py", line 34, in
os.chdir(scriptDir)
OSError: [Errno 2] No such file or directory: ''

Any help appreciated.
Thanks.

Thomas
simple solution

I had the same problem running both parts on a mac. A simple solution is to hard code the value,
something like:
scriptDir = '/Users/thomas/.....formulapi'

ubuntu_guy
Great, so I need /home/gareth

Great, so I need /home/gareth/Documents/Personal\ Files/Programming/Python/Formula\ PI/formulapi

Not a mouthful at all!
I wonder why though, both Ubuntu and Raspbian are debian based so what differs?

ubuntu_guy
Working....sort of

So the SimulationFull.py works fine now and the java file runs but it quits saying it can't detect the stream. Anyone have any idea how to configure this? The .py is already set for localhost.

Arron Churchill
Arron Churchill's picture
Streaming images

Did you start the streaming before running SimulationFull.py?

If you did check the terminal output from the Java program for errors. You may need to run the Java part using sudo permissions to allow it to open the network port for streaming.

Comment Images: 
ubuntu_guy
All correct.

Yes I start java first and have now tried with sudo. It shows the following then several sets of bot settings:
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]

It does load the gui fine. I have tried both 127.0.0.1 and my actual IP address in the py script but no luck.

Arron Churchill
Arron Churchill's picture
Do you see these lines after you press start?

After you press start you should see these two lines:

Starting Server
After Bind

Do you see these lines, or any others?

If that appears to work try opening this URL in your web browser: http://127.0.0.1:10000/view.png
If everything is working you should see the same image as shown in the top left of the simulator.

ubuntu_guy
It does not say this at all.

It does not say this at all. Below is the text in full:

Screen: [1920x1080]
Loading File: [file:///home/gareth/Documents/Personal%20Files/Programming/Python/Formula%20PI/formulapi/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]

Arron Churchill
Arron Churchill's picture
Not creating stream

That is very odd, it sounds like it is not creating the stream for some reason.

Can you take a screenshot / photo of the simulator GUI after you have pressed the start button?

ubuntu_guy
Once upon a time I lived for

Once upon a time I lived for coding and techhie projects, I could spend an entire weekend working on something and crack it in one go. Now I have a family and a young son with suspected autism, I go to work, I get home, I have to deal with bedtime, tidying up etc. By the time my days are done and I have some me time I'm shattered and my focus is not what it was. I can be so keen to get into something I miss the obvious. Didn't know I had to push the start button. Doh!

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.