Skip to content

Commit cc82022

Browse files
committed
Merge branch 'make-simulated-robots-more-helpful'
2 parents 404b586 + 6197f37 commit cc82022

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

simulator/simulated_robot.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ The main differences are:
2626

2727
## Motors
2828

29-
Your robot has one motor board attached, the left wheel is connected to the first port, and the right wheel to the second.
29+
Your robot has one motor board attached, the motor on the left wheel is connected to the "Motor 0" port, and the right wheel to "Motor 1". These can be referenced with `robot.motor_board.motors[0]`, and `robot.motor_board.motors[1]`, respectively.
30+
See [the motor board programming docs]({{ site.baseurl }}/programming/motors) for how to control these.
3031

31-
The motor board has the part code `srABC1`, since only a single motor board is attached it can be referenced as `robot.motor_board`.
32+
If you want to reference the motor board by its the part code, you can use the part code `srABC1`.
3233

3334
## Servos
3435

35-
Your robot has one servo board attached, the jaws of the robot are controlled by a pair of servos:
36+
Your robot has one servo board attached, the jaws of the robot and the lifter are all controlled by servos.
3637

3738
| Servo | Location |
3839
|-------|-----------|
@@ -44,31 +45,33 @@ Setting each servo to -1 fully opens the respective jaw, setting them to 1 fully
4445

4546
Setting the lifter to -1 fully lowers the lifter, setting it to 1 fully raises it.
4647

47-
The servo board has the part code `srXYZ2`, but since only a single servo board is attached it can be referenced as `robot.servo_board`.
48+
You can access the servos with `robot.servo_board.servos[N]` where N is the number of the servo from the table above. Read more at [the servo board programming docs]({{ site.baseurl }}/programming/servos).
49+
50+
If you want to reference the servo board by its the part code, you can use the part code `srXYZ2`.
4851

4952
## Arduino
5053

51-
Your robot has a microswitch and six distance sensors, attached to the digital and analog pins respectively. These are all attached to a single arduino.
54+
Your robot has an arduino board, with one microswitch and six distance sensors, attached to the digital and analog pins respectively.
5255

53-
The simulated arduino behaves like one with the ordinary SR Firmware and does not offer any of the extended or custom arduino behaviours.
56+
The simulated arduino behaves like one with the ordinary SR Firmware, the simulator doesn't support any [extended firmware]({{ site.baseurl }}/programming/arduino/extended_sr_firmware) or [custom arduino firmware]({{ site.baseurl }}/programming/arduino/custom_firmware). Read below for details on the individual sensors.
5457

5558
Make sure you have set the correct [pin_mode]({{ site.baseurl }}/programming/arduino/sr_firmware#setting-pin-modes), depending on what device you're using.
5659

5760
### Microswitches
5861

59-
The rear of the robot has a wide microswitch.
62+
The rear of the robot has a wide bump sensor attached to a microswitch.
6063

6164
The microswitch is attached to digital pin 2:
6265

6366
| Pin | Location | Required Mode |
6467
|-----|----------|---------------|
6568
| 2 | Back | `INPUT` |
6669

67-
This is shown as a red coloured block on the robot. Using the `digital_read` method, you'll receive a `bool` telling you whether the switch is currently actuated.
70+
This is shown as a red coloured block on the robot. You can access the servo using `robot.arduino.pins[2]`. Make sure you set the pin mode to `INPUT`. The `digital_read` method will return a `bool` telling you whether the switch is currently being pressed. You can read more in the [arduino programming docs page][arduino-programming].
6871

6972
### Distance Sensors
7073

71-
Analogous to ultrasound sensors, distance sensors allow you to retrieve the distance between your robot and an object. These are attached to analog pins A0-A5:
74+
Analogous to [ultrasound sensors](https://robocraze.com/blogs/post/what-is-ultrasonic-sensor), distance sensors allow you to retrieve the distance between your robot and an object. These are attached to analog pins A0-A5:
7275

7376
| Pin | Location | Required Mode |
7477
|-----|-------------|---------------|
@@ -79,18 +82,22 @@ Analogous to ultrasound sensors, distance sensors allow you to retrieve the dist
7982
| A4 | Front | `INPUT` |
8083
| A5 | Back | `INPUT` |
8184

82-
These are shown as blue boards with silver transceivers on the robot. The `analog_read` method will return the distance in metres. They can see in a narrow cone up to a maximum of about 2m away.
85+
These are shown as blue boards with silver transceivers on the robot. They can see in a narrow cone up to a maximum of about 5m away.
8386
Since these sensors rely on echoes being reflected back from objects, if the angle of incidence between the sensor's pulse and the contacted surface exceeds 22.5 degrees then the sensor will be unable to detect the object.
8487

88+
You can access the ultrasound sensors using `robot.arduino.pins[AX]`, where '`AX`' is between `A0` and `A5`. Make sure you set the pin mode to `INPUT`. The `analog_read` method will return the distance in metres. You can read more in the [arduino programming docs page][arduino-programming].
89+
8590
### LEDs
8691

87-
The LEDs are attached to digital pins 3-4:
92+
Your robot has two LEDs mounted in clearly visible points on the robot. The LEDs are attached to digital pins 3-4:
8893

8994
| Pin | Location | Required Mode |
9095
|-----|---------------|---------------|
9196
| 3 | Red (lower) | `OUTPUT` |
9297
| 4 | Green (upper) | `OUTPUT` |
9398

99+
You can access the LEDs using `robot.arduino.pins[3]` or `robot.arduino.pins[4]`. For the red or green LED, respectively. Make sure you set the pin mode to `OUTPUT`. You can read more in the [arduino programming docs page][arduino-programming].
100+
94101
Using the `digital_write` method, you can set these to `True` (On) or `False` (Off).
95102

96103
## Vision
@@ -99,6 +106,6 @@ The simulated robot has a camera which provides position and orientation
99106
information about other objects within the simulation. This simulates the
100107
system of fiducial markers which the physical robot's camera can detect.
101108

102-
The simulated vision system matches the physical robot's
103-
[vision API]({{ site.baseurl }}/programming/vision/), with small differences as
104-
noted in the vision docs.
109+
You can access the camera with `robot.camera`. The simulated vision system matches the physical robot's vision API, so please use the [vision programming docs page]({{ site.baseurl }}/programming/vision/) as a reference. There are a few small differences between the simulator and the physical kit which are noted on that page.
110+
111+
[arduino-programming]: {{ site.baseurl }}/programming/arduino/sr_firmware

0 commit comments

Comments
 (0)