Track 1 layout

The center line for this track is about 22.9 meters long, with an outside length of 28.6 meters and an inside length of 17.1 meters.

The standard running direction has red on the left of the robots, green on the right.

Here we have a break-down for the lengths of each section on the track.

Each of these reference points on the track also has an associated waypoint number.

The waypoint numbers can be used with our Race Code Functions to direct the YetiBorg around the track without complicated maths.

Here is our quick example for track 1:

#!/usr/bin/env python
# coding: Latin-1

### Settings for this race ###
laps = 10

### Start of the race ###
if TrackFound():
	# We can see the track, start by following the lane we are on
	trackLane = round(CurrentTrackPosition())
	AimForLane(trackLane)
else:
	# Cannot see the track, aim for the center instead (stopgap measure)
	AimForLane(0)
# Save a start-line image
photo = GetLatestImage()
SaveImage(photo, 'Start-line.jpg')
# Start logging what happens
StartUserLog()
StartDetailedLog()
# Wait for the go signal from the start/stop lights.
WaitForGo()
# Go at max speed
Speed(100)

### During the race ###
# Keep going until we have fished all of the laps
while LapCount() < laps:
	# Full speed to the first corner
	Speed(100)
	WaitForWaypoint(2)
	# Slow down, move to the inside and wait for the apex
	Speed(80)
	AimForLane(-2)
	WaitForWaypoint(3)
	# Speed up and move to the center until the S curve starts
	Speed(100)
	AimForLane(0)
	WaitForWaypoint(4)
	# Move towards the outside until the S curve changes
	AimForLane(+1)
	WaitForWaypoint(5)
	# Move towards the inside until the S curve ends
	AimForLane(-1)
	WaitForWaypoint(6)
	# Slow down and move to the inside around the corner
	Speed(70)
	AimForLane(-2)
	WaitForWaypoint(7)
	# Speed up for the back straight along the center
	Speed(100)
	AimForLane(0)
	WaitForWaypoint(8)
	# High speed for the last corner on the inside
	Speed(90)
	AimForLane(-2)
	WaitForWaypoint(9)
	# Full speed until the start/finish line along the outside
	Speed(100)
	AimForLane(+2)
	WaitForWaypoint(1)

### End of the race ###
# Save a finish-line image
photo = GetLatestImage()
SaveImage(photo, 'Finished.jpg')
# Slow the YetiBorg down gradually from 100% to 0%
for slowing in range(99, -1, -1):
	Speed(slowing)
	WaitForSeconds(0.01)
# Stop the logging
EndUserLog()
EndDetailedLog()
# End the race (will stop the robot and end the program)
FinishRace()

Comments

I am interested by your project for our Young Engineers Club at Grampian Transport Museum in Alford. However, the Github link seems to be dead and I just wondered if it is possible to download the code somewhere else?

Arron Churchill's picture

The full source code has only been made available to competitors.

We do have a camera based self-driving code example available to everyone on GitHub, MonsterBorg Self-drive, which is essentially a simplified version of the Formula Pi race code.

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.