Begging...

13 posts / 0 new
Last post
Geoff Riley
Geoff Riley's picture
Begging...

Hi,

I had an accident in London on Thursday and have only just had an opportunity to upload my code... if it is at all possible to update my code, please could you do so. I'm heading back to the hospital now, so I won't have chance to check back before tonight; I see I've been drawn to go in the first race!

Thank you in hope with fingers crossed and a frightful pain in the head.

Geoff — Car 16...

piborg
piborg's picture
Late submission

We have a really busy day today, but given the circumstances I will try and get the SD card re-written for you (no promises).

All the best and we hope you get better soon :)

Geoff Riley
Geoff Riley's picture
...and I'm back

Well, what a day: what a few days. I was very rushed when I typed this morning, if you have managed to rewrite the SD, then thank you so very much, if not: well no harm done... but my car will probably stop early as it was set to just do 5 laps in the trial. :)

I had gone down to London after winning a couple of tickets to the Spirit of Christmas exhibition at Olympia: Granddaughter number one had sorted out a nice hotel for us and we were going out for a meal in the evening... we were crossing the road just outside the hotel when I passed out, for reasons unknown, and the pavement smashed into me (with great amount of malice aforethought!)... well we had safety officers and ambulances and all sorts of things going on around me, and I left two nice puddles of blood in Knightsbridge. I got parcelled up and sent to bed for rest. The next day I was woosy and had to go to the Earls Court walk-in centre to get bandaged and bloods tested again... thankfully blood pressure was back to normal. Eventually made it to the exhibition looking like a cricketer with the white sun protection on nose... except mine was a bandage. Bought a new teddy bear from Merrythought (from whom I had won the tickets in the first place). Wandered around for a while. Started to feel ill again... and returned in the pouring rain to the hotel. It seemed that everyone from the bell boy to the manager knew about my little accident and they were all concerned... very much the opposite of the image that is often presented of London folk. Finally came home via the granddaughters, who booked 'Uber's to ferry us from place to place—that was a new experience, "Just look for registration..." and there it was! Then on the way up made appointments at the doctors and the hospital.

Good news is... the worst physical thing that I'm suffering from seems to be whiplash.

Bad news is... it's triggering my migraines like there's no tomorrow!!

Now I'll stop bothering you and keep my fingers crossed that I have a good race.... and not spend the whole time upside down on the first corner like on the practice run. :D

Geoff

piborg
piborg's picture
Good news

Good news, we did manage to squeeze the update and it seemed to run well :)

Logs will be uploaded soon.

Geoff Riley
Geoff Riley's picture
Great run

Indeed, I could tell that the update had been applied: some of those algorithms clearly worked better than others. The Simulator is wonderful but doesn't give any indication as to what might happen if you hit the wall. Starting in lane 1 is a somewhat different twist for one particular algorithm, so that was a lot of fun. :)

Thank you so very much for your assistance... I would rather have been able to upload on Friday as originally planned: I had everything with me to demonstrate to granddaughter number one... but the computer never got chance to be unpacked.

Looking forward to seeing tomorrows heats.

Geoff Riley
Geoff Riley's picture
I couldn't make this up...

I nearly didn't get to send my update... I think Thursdays have got it in for me.

I'm now typing very slowly with my left hand alone! Today... or rather, yesterday I had another little accident. I was going to the dentist, and my wife, Carole, dropped me off at the end of the road before going to look for a place to park. Sadly I didn't notice that my coat was caught in the door!

I had, what I am calling, a Woodbine moment: Carole set off... and I had a drag. Well, ambwlens and hospital followed and after four hours or so I got an x-ray. Broken right humorous. They can do nothing more than give me a sling for it though... and it's murder.

Still... it could have been a lot worse: and my wonderful Tilley hat protected my head remarkably well!

I'm sure glad that the Yetiborgs are driving themselves... I think I'm be dead by now. LOL

All the best, good luck for the second round everyone.
Geoff #16

PS: has my lid arrived with you yet, it only dawned on me when I rewatched the last heats that you had given me a blue arrow... as nice as it was, it wasn't the one I did. ;)

piborg
piborg's picture
Ouch!

Ouch, broken bones are not much fun. We are all hoping you get better soon!

It does illustrate the best part of robot racing though, injuries are much easier to fix.
We certainly had more than a few lost wheels when we were developing the code :)

We have not received your YetiLid back yet, so far only six have returned back to us.
It would be nice to know how many are stuck in the mail somewhere...

Geoff Riley
Geoff Riley's picture
Lid..

I sent my lid back on 26th October as I recall... posted at WHSmiths in Altrincham, as that's where the Alty Post Office ended up after the closed down the beautiful old building that it had been in since Adam was a lad. ;)

It went ordinary letter post, so there shouldn't have been any complications with it in parcel offices.

In the inimitable words of Pooh: bother.

Geoff.

Geoff Riley
Geoff Riley's picture
Dagnabbit!!

I actually managed to break a car??

I'll have to see what the logs say, but I have a nasty feeling that it's a little something that I couldn't test in the simulator... self righting code. I didn't think it would actually do very much, but the idea was, if the car detects being upside down: run at the wall and try to flip back. Grr... less than effective it would appear.

Back to the old drawing board.

Geoff.

Geoff Riley
Geoff Riley's picture
...I blame...

...my broken arm...

It obviously distracted me; and all this left hand typing is wearing out my brain.

Big sorry.

Geoff

Geoff Riley
Geoff Riley's picture
Hmm... In the words of the Rev Charles Dodgson:

"Curiouser and curiouser," said Alice.

It does not appear that I was under programatic control when my car began it's headbanging routine. Would it be possible to just do a test run with my code unaltered to see how it behaves at that first corner please?

The log shows correctly that it set off, but abruptly cuts after only one second of race time, this is a combination of both system and user log... and is all there is:

 14:28:15.158057 [BASE TIME]
 +:00:00.000000 StartUserLog()
 +:00:00.013439 WaitForGo()
 +:02:15.344605 Lights: 1 - Green
 +:02:26.145289 Lights: 2 - Red
 +:02:31.160313 Lights: 3 - Green
 +:02:31.332798 Lights: GO
 +:02:31.522461 GetLatestImage()
 +:02:31.548192 SaveImage(<image>, "20161108142814.00755-1.Start")
 +:02:31.611201 CurrentTrackPosition()
 +:02:31.632897 LapCount()
 +:02:31.657690 LapCount()
 +:02:31.680411 <module>(***** LAP 0 *****)
 +:02:31.709451 LapCount()
 +:02:31.744789 GetLatestImage()
 +:02:31.783310 SaveImage(<image>, "20161108142814.00757-3.0.LapStart")
 +:02:31.154363 GetDistance()
 +:02:31.102729 CurrentTrackPosition()
 +:02:31.044919 aim_wait(target{wp: 4.00; ln: 0.00; spd: 95.00; secs: -1.00}; current{dist: 0.00; lane: 0.91; speed: 10000.00})
 +:02:31.005799 Speed(95.000)
 +:02:32.046850 AimForLane(0.000)
 +:02:32.087663 WaitForDistance(8.470)
 +:02:32.127216 LapCount()
 +:02:32.174184 GetDistance()
 +:02:32.233407 GetDistance()
 +:02:32.420087 Using line 2 (blue | red)
     line = 1.000, d0 = -0.059, d1 = -0.298, d2 = 0.006
 +:02:32.445342 Motors: +0.950, +0.950
 +:02:32.522239 LapCount()
 +:02:32.597816 GetDistance()

Had the car been under programatic control, the would have at least been a load of "LapCount(); GetDistance()" calls from the main drive code.

Additionally only a single debug image was stored, and that was of the starting line. (Attached)

All things considered I think this adds up to a hardware fault—the standard programmers excuse. :)

...and if that is the case doing a quick test should quickly show whether or not it is so... then I throw myself at the mercy of the judges to be included in a later heat.

Note, I do not wish to change any code.

Kind regards,
Geoff

Comment Images: 
piborg
piborg's picture
Unexpected problem

It looks like something in your code is trying to create a graphical output...

We tried running your code on the bench.
After flashing the camera with the start lights the code starts fine, but gets stuck with an error:
(Processed:591): Gtk-WARNING **: cannot open display:

Running the same code via SSH:

Libraries loaded
Running script in directory "/home/pi/formulapi"
Loading ZeroBorg on bus 1, address 40
Found ZeroBorg at 40
ZeroBorg loaded on bus 1
Image processor and Race Code Functions loaded
=== NEW SETTINGS ===

[Image setup]
Camera 160 x 120 at 5 fps
X cropped from 0 to 160
Y cropped from 54 to 120
Image processing threads: 1

[Startup]
Initial mode: 1

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

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

[Line correction]
Colour edge gap: 24 pixels
Lane gap: 85 pixels
Offset Y calculation target 0: (16)
Corrective gain for derivative: 6.200

[Start marker detection]
Levels: Min Red = 45, Max Green = 50, Max Blue = 50
Start minimum match ratio: 90.0 %
Start crossed delay 0.50 s (2 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.160000        I0:0.000000     D0: 0.200000
    P1: 0.004000        I1:0.000000     D1: 0.004000
    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: 2

[Override settings]
Stuck detection threshold: 2.00
Stuck detection time: 1.00 s (5 frames)
Stuck reversing time: 1.50 s (7 frames)
Stuck hunting time: 0.80 s (4 frames)
Stuck colour detection at 80 x 54
Wrong way detection threshold: 10
Wrong way spin time: 1.20 s (6 frames)
Robot in front detection threshold: 40
Overtaking lane shift: 1.50
Overtaking time: 5.00 s (25 frames)

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

Setup stream processor threads
13:09:03.310836 Processor thread 1 started with idle time of 0.40s

Setup control loop
13:09:03.314956 Control loop thread started with idle time of 0.40s

Wait ...
Start Race.py
Press CTRL+C to quit
13:09:05.424206 StartDetailedLoging()

13:09:05.429996 StartUserLog()

13:09:05.435404 WaitForGo()

1.4 FPS
5.1 FPS
5.1 FPS
4.9 FPS
5.1 FPS
4.9 FPS
5.1 FPS
4.9 FPS
5.1 FPS
4.9 FPS
5.1 FPS
5.1 FPS
4.9 FPS
5.1 FPS
4.9 FPS
5.1 FPS
4.9 FPS
13:09:23.503395 Lights: 1 - Green

5.1 FPS
13:09:24.316189 Lights: 2 - Red

5.1 FPS
4.9 FPS
5.1 FPS
4.9 FPS
5.1 FPS
4.9 FPS
13:09:29.904544 Lights: 3 - Green

13:09:30.120400 Lights: GO

13:09:30.221502 GetLatestImage()

13:09:30.229033 SaveImage(, "20161122130905.00122-1.Start")

13:09:30.243999 CurrentTrackPosition()

13:09:30.249221 LapCount()

13:09:30.254293 LapCount()

13:09:30.258882 (***** LAP 0 *****)

13:09:30.263923 LapCount()

13:09:30.271250 GetLatestImage()

13:09:30.278570 SaveImage(, "20161122130905.00122-3.0.LapStart")

13:09:30.293561 GetDistance()

13:09:30.303206 CurrentTrackPosition()

13:09:30.312649 aim_wait(target{wp: 4.00; ln: 0.00; spd: 95.00; secs: -1.00}; current{dist: 0.00; lane: 0.00; speed: 10000.00})

13:09:30.322097 Speed(95.000)

13:09:30.332220 AimForLane(0.000)

13:09:30.352006 WaitForDistance(8.470)

13:09:30.366048 LapCount()

13:09:30.380612 GetDistance()

13:09:30.394433 GetDistance()

13:09:30.664973 LapCount()

13:09:30.676171 GetDistance()

5.0 FPS
PuTTY X11 proxy: wrong authorisation protocol attempted
(Processed:785): Gtk-WARNING **: cannot open display: localhost:10.0

Enabling the X11 forwarding and re-running the script it looks like the processing display is running.
Basically it appears to be behaving as though ImageProcessor.showProcessing is set to True.
This will fail as X11 is not running on the Raspberry Pi.

Looking further into your code the culprit appears to be:
ImageProcessor.writeImages = True
Put simply this starts building the output display, which the script sees and tries to display, causing the error.
I think we must have only tried that line when already looking at the display :P

This can be fixed in Formula.py by swapping this line:

        if Globals.displayFrame != None:

for this one:

        if (Globals.displayFrame != None) and (ImageProcessor.showProcessing):
Geoff Riley
Geoff Riley's picture
Aha!

Thank you so very much... for trying that out, you went far further than I ever hoped that you might.

Yes indeedy I was trying to get the final processing images as it went along: mostly in an effort to detect when false laps were being counted and to see if I could do anything about it, as well as to try to get a handle on the triggering of the overtake override when the wall is approached too obliquely.

I'm not quite sure how that error caused it to start running constantly into the wall, but there you go. :)

I had not realised the ramifications: I use an ssh tunnel with X-forwarding anyway to allow me to simply open multiple terminals, that means that in my tests it didn't occur to me that the windows appearing were from the PiZero and not the Simulator... Doh!

I think a little judicial editing of Formula.py is in order before the next round, to make sure that nothing else like that is going to bite.

Thanks again... I wonder: how many in the office muttered something along the lines of 'typical programmer blaming the hardware'? :)

Kind regards,
Geoff

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.