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/simulator_programming.md
+27-40Lines changed: 27 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,53 +73,58 @@ Your robot has one servo board attached, the jaws of the robot are controlled by
73
73
|-------|-----------|
74
74
| 0 | Left Jaw |
75
75
| 1 | Right Jaw |
76
+
| 2 | Lifter |
76
77
77
-
Setting each servo to -1 fully opens the respective jaw.
78
+
Setting each servo to -1 fully opens the respective jaw, setting them to 1 fully opens them.
79
+
80
+
Setting the lifter to -1 fully lowers the lifter, setting it to 1 fully raises it.
78
81
79
82
The servo board has the part code `srXYZ2`, but since only a single servo board is attached it can be referenced as `R.servo_board`.
80
83
81
-
### Ruggeduino
84
+
### Arduino
82
85
83
-
Your robot has a microswitch and six distance sensors, attached to the digital and analogue pins respectively. These are all attached to a single ruggeduino.
86
+
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.
84
87
85
-
Because these sensors are pre-attached to the ruggeduino, you do not need to set its `pin_mode`.
88
+
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.
86
89
87
90
#### Microswitches
88
91
92
+
The rear of the robot has a wide microswitch.
93
+
89
94
The microswitch is attached to digital pin 2:
90
95
91
-
| Pin | Location |
92
-
|-----|----------|
93
-
| 2 | Back |
96
+
| Pin | Location | Required Mode |
97
+
|-----|----------|---------------|
98
+
| 2 | Back |`INPUT`|
94
99
95
100
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.
96
101
97
102
#### Distance Sensors
98
103
99
-
Analogous to ultrasound sensors, distance sensors allow you to retrieve the distance between your robot and an object. These are attached to analogue pins A0-A5:
104
+
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:
100
105
101
-
| Pin | Location |
102
-
|-----|----------|
103
-
| A0 | Front Left |
104
-
| A1 | Front Right |
105
-
| A2 | Left |
106
-
| A3 | Right |
107
-
| A4 | Front |
108
-
| A5 | Back |
106
+
| Pin | Location | Required Mode |
107
+
|-----|-------------|---------------|
108
+
| A0 | Front Left |`INPUT`|
109
+
| A1 | Front Right |`INPUT`|
110
+
| A2 | Left |`INPUT`|
111
+
| A3 | Right |`INPUT`|
112
+
| A4 | Front |`INPUT`|
113
+
| A5 | Back |`INPUT`|
109
114
110
-
These are shown as blue boards with silver transceivers on the robot. The `analogue_read` method will return the distance in metres. They can see in a narrow cone up to a maximum of about 2m away.
115
+
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.
111
116
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.
112
117
113
118
#### LEDs
114
119
115
120
The LEDs are attached to digital pins 3-4:
116
121
117
-
| Pin | Location |
118
-
|-----|----------|
119
-
| 3 | Red (Left)|
120
-
| 4 | Green (right)|
122
+
| Pin | Location | Required Mode |
123
+
|-----|---------------|---------------|
124
+
| 3 | Red (lower) |`OUTPUT`|
125
+
| 4 | Green (upper) |`OUTPUT`|
121
126
122
-
Using the `digital_write` method, you can set these to True (On) or False (Off).
127
+
Using the `digital_write` method, you can set these to `True` (On) or `False` (Off).
123
128
124
129
### Vision
125
130
@@ -131,24 +136,6 @@ The information returned by the simulated vision API is similar to the physical
131
136
robot's [vision API](/docs/programming/vision/), however there are a number
132
137
of differences as are noted in the vision docs.
133
138
134
-
### Pressure sensing
135
-
136
-
Your simulated robot has two deployable 'fingers' that are able to lift the front of the robot up. These fingers have pressure sensors on their tips, with these you can determine the weight of an object your robot is carrying.
137
-
138
-
The servos to move the fingers are attached to servo pins 2 and 3 in the servo board:
139
-
140
-
| Servo | Location |
141
-
|-------|--------------------|
142
-
| 2 | Left finger servo |
143
-
| 3 | Right finger servo |
144
-
145
-
Once the fingers are deployed, your robot will have reduced manoeuvrability, but you will be able to sense the total pressure on the front of the robot. The pressure measuring devices on the end of the fingers are available as analogue inputs on A6 and A7. They are meant to emulate sensors that output a value proportional to pressure, the higher the pressure the higher the voltage reading.
146
-
147
-
| Pin | Location |
148
-
|-----|------------------------------|
149
-
| A6 | Left finger pressure sensor |
150
-
| A7 | Right finger pressure sensor |
151
-
152
139
## Simulated Time
153
140
154
141
In the simulated environment, time advances only at the pace that the simulator
0 commit comments