Notes about my Java winning code

3 posts / 0 new
Last post
Thomas
Notes about my Java winning code

Hi all,

I want to make a few notes about my Java winning code (winning summer & winter series 2017) :-)

  • I will give a talk about FormulaPi and my implementation at the next company event
  • Beforehand I will create a couple of slides. I will post the link here
  • It should not be too hard to port the main features back to python. Wait for the slides...
  • my already published code is not very clean. Sorry! After already taking a little too much risk in the races before the final I decided not to go with a complete new implementation in the final race
  • I think the code is memory leak free. Don't know if the nicer in-place openCV calls are okay
  • In the final it took me about 3 minutes for the first 8 laps. Quite good given the massive crash area
  • In the last 3 minutes I didn't complete any laps. See bug below
  • Regards,

    Thomas
    lambda.p.racing

    BUG:

    After a few races I had to drive in FLIPPED mode in race 3 again. And it didn't work at all.
    Watch a few seconds of https://youtu.be/_eLOVaq0tTI?t=5m40s
    I am 5th!

    To fix this I changed one line of code. After a crash I now set the ImageMode to Globals.getLastImageMode(), the image mode before
    the crash, the same way the python standard code does. The code before the change was setImageMode(FOLLOW_TRACK);

    The hope was that the FLIP check will then change it to FLIPPED if necessary. Normally it will work, but not if there is too fast another crash.

    In the final race this fix causes another problem and is the reason that I didn't finish any laps in the last 3 minutes.
    Watch a few seconds of https://youtu.be/8P2mM5XHjpM?t=25m17s.

    The problem is quite simple. There is code changing the imageMode without changing the lastImageMode. I haven't used lastImageMode before race 3 so it was not
    updated with newer code. So the last 3 minutes I drove permanently in CRASHED mode.

    There are 3 implementations of setImageMode: in Globals, ImageProcessor and ControlLoop.
    The method in Globals does not call setLastImageMode and this method is used in the ImageProcessor, ups!

    Of course it is not good to implement this 3 times, there should only be the corrected version in Globals.

    Thomas
    Presentation was yesterday

    I gave yesterday the talk I mentioned in the above post at my company.
    Just need to translate the slides now to English.

    Thomas
    Slides

    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.