Skip to content

Commit 2e6431d

Browse files
committed
sidebar - simulator and resources
1 parent e7bcdd6 commit 2e6431d

File tree

6 files changed

+166
-19
lines changed

6 files changed

+166
-19
lines changed

_data/sidebar_tree.yaml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ tree:
4848
title: Power Board API
4949
- url: /programming/servos
5050
title: Servo Board API
51-
- url: /programming/arduino/
52-
title: Arduino API
53-
tree:
54-
- url: /programming/arduino/custom_firmware
55-
title: Custom Firmware
5651
- url: /programming/vision/
5752
title: Vision
5853
tree:
@@ -62,22 +57,24 @@ tree:
6257
title: Position
6358
- url: /programming/vision/orientation
6459
title: Orientation
60+
- url: /programming/arduino/
61+
title: Arduino API
62+
tree:
63+
- url: /programming/arduino/custom_firmware
64+
title: Custom Firmware
6565
- url: /programming/cheat_sheet
6666
title: API Quick Reference
67+
- url: /programming/simulator_programming
68+
title: Simulator Programming
6769
- url: /rules/
6870
title: Rules
6971
tree:
7072
- url: /rules/code_of_conduct
7173
title: Code Of Conduct
72-
- url: /rules/archive
73-
title: Game Rules Archive
7474
- url: /rules/safety_regulations
7575
title: Safety Regulations
76-
- url: /simulator/
77-
title: Simulator
78-
tree:
79-
- url: /simulator/programming/
80-
title: Programming
76+
- url: /rules/archive
77+
title: Game Rules Archive
8178
- url: /troubleshooting/
8279
title: Troubleshooting
8380
tree:
@@ -90,21 +87,28 @@ tree:
9087
tree:
9188
- url: /tutorials/assembly
9289
title: Assembly
90+
- url: /tutorials/python
91+
title: Python
9392
- url: /tutorials/getting_code_on_the_robot
9493
title: Getting Code on the Robot
9594
- url: /tutorials/basic_motor_control
9695
title: Basic Motor Control
97-
- url: /tutorials/microgames
98-
title: Microgames
99-
- url: /tutorials/python
100-
title: Python
10196
- url: /tutorials/editors/
10297
title: Code Editors
10398
tree:
10499
- url: /tutorials/editors/pycharm
105100
title: PyCharm
106101
- url: /tutorials/editors/vscode
107102
title: Visual Studio Code
103+
- url: /tutorials/setting_up_simulator
104+
title: Setting up the simulator
105+
- url: /tutorials/using_the_simulator
106+
title: Using the simulator
107+
- url: /competitor_resources/
108+
title: Resources
109+
tree:
110+
- url: /competitor_resources/microgames
111+
title: Microgames
108112
- url: /team_admin/
109113
title: Team Admin
110114
tree:

competitor_resources/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
layout: page
3+
title: Resources
4+
---
5+
6+
Resources
7+
=========
8+
9+
TODO
File renamed without changes.

simulator/programming/index.md renamed to programming/simulator_programming.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
---
2-
redirect_from:
3-
- /competition-simulator/programming
42
layout: page
53
title: Simulator Programming
64
---
75

8-
# Simulator Programming
6+
Simulator Programming
7+
=====================
98

109
## Developing your code
1110

tutorials/setting_up_simulator.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
layout: page
3+
title: Setting up the simulator
4+
---
5+
6+
Setting up the simulator
7+
========================
8+
9+
### Prerequisites
10+
11+
You need to download and install [Webots](https://cyberbotics.com/#download) (the download is around 300MB).
12+
This is the platform we run our simulation in.
13+
14+
Versions "R2022b" and "R2023a" of Webots are supported.
15+
*Note*: versions of the simulation prior to sr2023.3 did not support Webots "R2023a".
16+
17+
#### Python Version
18+
19+
You will also need Python installed.
20+
21+
| Platform | Supported Python Version |
22+
|----------|--------------------------|
23+
| Windows | 3.8-3.10 (64-bit) |
24+
| macOS | 3.8-3.10 |
25+
| Linux | 3.8-3.10 |
26+
27+
There are a small number of [external libraries]({{ site.baseurl }}/programming/python/libraries#simulator)
28+
which will be available to your robot code during the competition. Note that for
29+
local development you will need to install these yourself.
30+
31+
### Installing the simulation
32+
33+
1. Create a directory, perhaps called `simulation` where you will store your robot code.
34+
2. [Download the simulation](https://github.com/srobo/competition-simulator/releases/download/sr2023.5/competition-simulator-sr2023.5.zip), the latest version is sr2023.5, released on 2023-02-22.
35+
3. Unzip the simulation as a subdirectory of the directory you created in the first step:
36+
```
37+
simulation
38+
├── competition-simulator-<version>
39+
│ ├── ...
40+
│ └─ worlds
41+
│ └── Arena.wbt
42+
└── robot.py
43+
```
44+
If there is not an existing `robot.py` an example one will be created when the simulator first runs.
45+
46+
4. Using the Webots IDE, open the `worlds/Arena.wbt` file.
47+
48+
You may receive a warning about your computer's GPU not being good enough, which can be ignored.
49+
50+
<div class="info">
51+
On recent versions of macOS you may need to give Webots permission to access the directory where you have extracted the simulation files.
52+
</div>
53+
54+
#### Changing your version of Python
55+
56+
If webots is not picking any version of Python or is picking up the wrong one then you'll need to change it.
57+
When this happens Webots will print errors to its console and your robot will not move.
58+
59+
You will need the full path to the version of Python that you want to use.
60+
This will vary based on the system you have.
61+
One way to find the path is by launching the version of Python that you want to
62+
use and running the following code:
63+
64+
~~~~~ python
65+
import sys
66+
print(sys.executable)
67+
~~~~~
68+
69+
On Windows you can set the path to the Python version to use in Webots UI via
70+
**Tools** &rarr; **Preferences** &rarr; **General** &rarr; **Python command**.
71+
Your Python path is likely similar to `C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python39\python.exe` when using Python 3.9, where `<USERNAME>` is your login.
72+
73+
On Mac you can set the path to the Python version to use via **Webots** &rarr; **Preferences** <kbd>⌘</kbd><kbd>,</kbd>.
74+
Your Python path is likely similar to `/Library/Frameworks/Python.framework/Versions/3.9/bin/python3` when using Python 3.9.
75+
76+
You'll need to ensure a matching version of Python is installed. If you're still
77+
having problems, ask for help in [`#simulator-help`][simulator-help] in
78+
[Discord][discord].
79+
80+
### Updates
81+
82+
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.
83+
84+
If you need a specific version of the simulator, or want to see what changes
85+
have been made with each version, please see the
86+
[list of releases](https://github.com/srobo/competition-simulator/releases).
87+
88+
[discord]: {{ site.baseurl }}/team_admin/discord
89+
[programming-help]: https://discord.com/channels/900501415548579842/900501416269971457
90+
[simulator-help]: https://discord.com/channels/900501415548579842/900501416269971458

tutorials/using_the_simulator.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
layout: page
3+
title: Using the simulator
4+
---
5+
6+
Using the simulator
7+
===================
8+
9+
## Overview
10+
11+
Within the Webots IDE, there are a few different panels:
12+
13+
- In the centre of your screen is the 3D simulated view of the arena
14+
- On the left is a tree hierarchy of all elements in this "world"
15+
- At the bottom is the console, where output from your robot code will be displayed
16+
- At the top are your general controls which include the time controls. Press the centre play button to run the simulation at normal speed.
17+
18+
### Useful links
19+
20+
- [Camera Controls](https://www.cyberbotics.com/doc/guide/the-3d-window#navigation-in-the-scene)
21+
- [Graphics settings](https://www.cyberbotics.com/doc/guide/preferences#opengl) (Useful if Webots is running slowly)
22+
23+
## Time
24+
25+
In the simulated environment, time advances only at the pace that the simulator
26+
is run. The relation between this time and the real passage of time depends on a
27+
couple of factors: the speed the simulation is configured to run at and the
28+
ability of the computer running the simulation to process it fast enough.
29+
30+
You can configure and observe the speed the simulator is running at from the toolbar in webots:
31+
32+
![]({{ site.baseurl }}/images/content/simulator/speed-toolbar.png)
33+
34+
Here the simulation has run for 13.28 seconds, but is currently paused (the
35+
speed multiplier shows 0.00×). You could choose to step a single time increment,
36+
run the simulator at real speed (▶), or run the simulator at various faster
37+
speeds (▶▶ and ▶▶▶).
38+
39+
These differences mean that your code will need to use a different mechanism to
40+
find the current time or to sleep within the simulation. Find out more by
41+
heading over to the [simulator programming docs](./programming).
42+
43+
## Programming
44+
45+
Once you have the simulator installed you can begin [programming your robot](./programming) in the simulator.

0 commit comments

Comments
 (0)