You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: simulator/simulated_robot.md
+21-14Lines changed: 21 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,13 +26,14 @@ The main differences are:
26
26
27
27
## Motors
28
28
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.
30
31
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`.
32
33
33
34
## Servos
34
35
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.
36
37
37
38
| Servo | Location |
38
39
|-------|-----------|
@@ -44,31 +45,33 @@ Setting each servo to -1 fully opens the respective jaw, setting them to 1 fully
44
45
45
46
Setting the lifter to -1 fully lowers the lifter, setting it to 1 fully raises it.
46
47
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`.
48
51
49
52
## Arduino
50
53
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.
52
55
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.
54
57
55
58
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.
56
59
57
60
### Microswitches
58
61
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.
60
63
61
64
The microswitch is attached to digital pin 2:
62
65
63
66
| Pin | Location | Required Mode |
64
67
|-----|----------|---------------|
65
68
| 2 | Back |`INPUT`|
66
69
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].
68
71
69
72
### Distance Sensors
70
73
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:
72
75
73
76
| Pin | Location | Required Mode |
74
77
|-----|-------------|---------------|
@@ -79,18 +82,22 @@ Analogous to ultrasound sensors, distance sensors allow you to retrieve the dist
79
82
| A4 | Front |`INPUT`|
80
83
| A5 | Back |`INPUT`|
81
84
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.
83
86
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.
84
87
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
+
85
90
### LEDs
86
91
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:
88
93
89
94
| Pin | Location | Required Mode |
90
95
|-----|---------------|---------------|
91
96
| 3 | Red (lower) |`OUTPUT`|
92
97
| 4 | Green (upper) |`OUTPUT`|
93
98
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
+
94
101
Using the `digital_write` method, you can set these to `True` (On) or `False` (Off).
95
102
96
103
## Vision
@@ -99,6 +106,6 @@ The simulated robot has a camera which provides position and orientation
99
106
information about other objects within the simulation. This simulates the
100
107
system of fiducial markers which the physical robot's camera can detect.
101
108
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.
0 commit comments