Documentation

Simulator

Installation

Prerequisites

You need to download and install Webots (the download is around 1.5GB). This is the platform we run our simulation in. Whilst we recommend version “R2021a” of Webots, and will be running competition simulations using it, “R2020b-rev1” should still work.

Python Version

You will also need Python installed.

Platform Supported Python Version
Windows 3.7 - 3.8 (64-bit)
macOS 3.7 - 3.8
Linux 3.7 - 3.8

In the competition, Python 3.7 will be used.

There are a small number of external libraries which will be available to your robot code during the competition. Note that for local development you will need to install these yourself.

If there are other libraries you would like included, please let us know in #programming-help on the Discord and include a link to the package on PyPI.

Installing the simulation

  1. Download the simulation, and unzip it somewhere on your computer.
  2. Using the Webots IDE, open the worlds/Arena.wbt file.

You may receive a warning about your computer’s GPU not being good enough, which can be ignored.

Changing your version of Python

If webots is picking up the incorrect version of Python, you’ll need to change it. This can be done using Tools > Preferences > General > Python command. You’ll need to ensure a matching version of Python is installed. If you’re still having problems, ask for help in #simulator-help in Discord.

Updates

Occasionally, we may release an update to the simulation. To update, you will need to delete the competition-simulator-<version> directory, and re-download it using the above link.

If you need a specific version of the simulator, or want to see what changes have been made with each version, please see the list of releases.

Overview

Within the Webots IDE, there are a few different panels:

  • In the centre of your screen is the 3D simulated view of the arena
  • On the left is a tree hierarchy of all elements in this “world”
  • At the bottom is the console, where output from your robot code will be displayed
  • At the top are your general controls which include the time controls. Press the centre play button to run the simulation at normal speed.

Robot

This is the pre-built robot used in the simulator, with an interface similar to the SR API.

The robot has an array of sensors which can be programmed, along with a compass and a radio system.

Other robots

There is another robot in the arena, in its starting zone. By default, this robot will not move.

To control the other robot, you will need to provide its code:

Create the robot code in zone-1/robot.py. Your code at robot.py will be used for zone 0, though you are encouraged to move your code to zone-0/robot.py when running multiple robots. Robots which do not have any robot code in their zone-x directory will not do anything.

.
├── competition-simulator-<version>
│   ├── ...
│   └─ worlds
│       └── Arena.wbt
├── zone-1
|   └─ robot.py
└── robot.py

Time

In the simulated environment, time advances only at the pace that the simulator is run. The relation between this time and the real passage of time depends on a couple of factors: the speed the simulation is configured to run at and the ability of the computer running the simulation to process it fast enough.

You can configure and observe the speed the simulator is running at from the toolbar in webots:

Here the simulation has run for 13.28 seconds, but is currently paused (the speed multiplier shows 0.00×). You could choose to step a single time increment, run the simulator at real speed (▶), or run the simulator at various faster speeds (▶▶ and ▶▶▶).

These differences mean that your code will need to use a different mechanism to find the current time or to sleep within the simulation. Find out more by heading over to the programming docs on time.