Start lights sequence bug

Over the last couple of days we've been tuning some parameters on the coming Raptor class of robot. On Monday, we hit a snag which left us head scratching for some time.


We had a look at the code and we found a mistake!

When the lights turn green, we have the robots drive straight for a random amount of time. After that amount of time, we then switch to track following.

We did this very early on. This time delay was originally set between 2 and 4 seconds, and it is supposed to make sure that the robots have passed the point where there are horrible light reflections from the start lights, before the robots go in to track following mode. To explain that in pictures, consider these two images.

From lane -1.5

From lane 0.5

You can see the horrible reflections that could be interpreted as a different lane. We make the robots drive straight for a period of time before switching over to track following. We put a random value in there, to reduce the likelihood of a collision caused by all the robots going for the same lane at the same time

The same lanes, about 40cm further on...
From lane -1.5

From lane 0.5

The mistake we made was in multiplying the time delay by the frame rate. Instead of multiplying all of the delay we only scaled the random part.

If we picked the longest possible delay we calculated the following:

firstStraightTicks = 1.0 * 30
firstStraightTicks *= (4.0 - 2.0)
firstStraightTicks += 2.0

which works out as (30 × 2) + 2 = 62. Instead of 4 seconds we get 62 frames, about 2.07 seconds.

If we picked the shortest possible delay we calculated this instead:

firstStraightTicks = 0.0 * 30
firstStraightTicks *= (4.0 - 2.0)
firstStraightTicks += 2.0

which works out as (0 × 2) + 2 = 2. Instead of 2 seconds we get 2 frames, about 0.07 seconds :(

Here's an example that probably fell foul of the code bug. See XStatic on lane -1

Apologies to XStatic, but I think you won that round anyway :)

Here's an example that probably didn't!

Even though they look the same, it's likely that was a tracking mistake after the handover. This could be due to the auto white balance not having settled, shadows, avoidance/overtaking code or many other possibilities.

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.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.