WaitForWaitpoint precission

3 posts / 0 new
Last post
jorgealvaro's picture
WaitForWaitpoint precission


I'm testing my Race.py script with the simulator. I use the WaitForWaitpoint(n) call to wait for every waypoint in the race and just after that I have a log.

What I see is that the waipoint log is not written when the robot is at the proper point in the track.

Do we need to keep track on how much zig-zag we are doing to update in some way the waypoint distances? Is it just an approximation and will not be too precise? Is anyone else seeing something similar?


piborg's picture
WaitForWaitpoint precission

You are completely right about the distances being an approximation.
They are based on some calculations using the motor speeds and the position data from the camera.

The calculation is in the imageProcessor.py script in the ControlLoop class.
The function is called IncreaseDistance and it attempts to work out distance based on:

  • How fast the YetiBorg is travelling
  • What angle the track appears to be at
  • How far the YetiBorg is from the center of the track

We did find that the estimate of speed for this calculation was a bit inaccurate in the simulation.
In Settings.py there are two versions of the estimated max speed:

  1. yetiSpeed - this version is used when running an actual race
  2. simulationYetiSpeed - this version is used in the simulation

It may be that the values here are not quite right.

The best thing to do is assume the waypoints will not be perfect during an actual race, it may be worth trying WaitForDistance and figuring out what distances best match the place you wish to make changes.
Alternatively you can adjust the exact positions used for the waypoints by changing the distanceBetweenWaypoints values in Settings.py.

As for the calculation itself it is not perfect, there are some parts which can be improved:

  1. The offset from center used is not where the robot is, but a couple of robot lengths ahead
  2. It assumes the inside line is always shorter than the outside line, this is not true for the whole track
  3. The distance is assumed to be in a straight line, the actual robot curves when steering

Improvements to this calculation will likely give more accurate distance reporting.

jorgealvaro's picture
WaitForWaitpoint precission

Ok, thanks for the clarifications. I'll see how I can use that.

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