Skip to content

Commit 78c96e8

Browse files
committed
Update the vision docs to match reality
Even before the changes in the Dec 1st kit update these docs were wildly different to how the vision system actually behaved. This update brings these to parity with the default behaviour of the kit (and soon the simulator). Ideally we would have some diagrams to show how the axes work, however the diagrams we have are substantially incorrect and will need replacing. Dropping them clarifies that work is needed before they can be brought back (though recreating them from scratch might be easier as we don't seem to have the source files).
1 parent 2121018 commit 78c96e8

File tree

3 files changed

+58
-36
lines changed

3 files changed

+58
-36
lines changed

images/content/vision/spherical.png

-41.2 KB
Binary file not shown.
-29.2 KB
Binary file not shown.

programming/sr/vision/index.md

Lines changed: 58 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ size
134134
: The physical size of the marker, as the vision system expects it.
135135

136136
pixel_centre
137-
: A [`Coordinate`](#Coordinate) describing the position of the centre of the marker.
137+
: A [`PixelCoordinates`](#PixelCoordinates) describing the position of the centre of the marker.
138138

139139
pixel_corners
140-
: A list of 4 [`Coordinate`](#Coordinate) instances, each representing the position of the corners of the marker.
140+
: A list of 4 [`PixelCoordinates`](#PixelCoordinates) instances, each representing the position of the corners of the marker.
141141

142142
distance
143143
: The distance between the camera and the centre of the marker, in millimetres.
@@ -146,20 +146,33 @@ orientation
146146
: An [`Orientation`](#Orientation) instance describing the orientation of the marker.
147147

148148
spherical
149-
: A [`Spherical`](#Spherical) instance describing the position relative to the camera.
149+
: A [`SphericalCoordinate`](#SphericalCoordinate) instance describing the position relative to the camera.
150150

151151
cartesian
152-
: A [`ThreeDCoordinate`](#ThreeDCoordinate) instance describing the absolute position of the marker relative to the camera.
152+
: A [`CartesianCoordinates`](#CartesianCoordinates) instance describing the absolute position of the marker relative to the camera.
153153

154-
[`Coordinate`](#Coordinate) {#Coordinate}
154+
<a id="Coordinate"/>
155+
156+
[`PixelCoordinates`](#PixelCoordinates) {#PixelCoordinates}
155157
---------
156158

157-
A `Coordinate` object contains an `x` and `y` attribute. The exact meaning and unit of these attributes depends on its source.
159+
A named tuple of `x` and `y` coordinates for the point, in pixels relative to the top left of the image.
160+
161+
~~~~~ python
162+
print(marker.pixel_centre.x, marker.pixel_centre.y)
163+
~~~~~
158164

159-
[`ThreeDCoordinate`](#ThreeDCoordinate) {#ThreeDCoordinate}
165+
<a id="ThreeDCoordinate"/>
166+
167+
[`CartesianCoordinates`](#CartesianCoordinates) {#CartesianCoordinates}
160168
---------
161169

162-
A `ThreeDCoordinate` object contains an `x`, `y` and `z` attribute. The exact meaning and unit of these attributes depends on its source.
170+
A named tuple of `x`, `y` and `z` coordinates for the point, in millimeters relative to the camera.
171+
Increasing values are to the right, below and away from the camera respectively.
172+
173+
~~~~~ python
174+
print(marker.cartesian.x, marker.cartesian.y, marker.cartesian.z)
175+
~~~~~
163176

164177
[`Orientation`](#Orientation) {#Orientation}
165178
---------------
@@ -171,62 +184,71 @@ One (possibly both) of them may change to resolve this.
171184

172185
An `Orientation` object describes the orientation of a marker.
173186

174-
![A visual representation of how the orientation axes work. Source: SourceBots]({{ site.baseurl }}/images/content/vision/yaw-pitch-roll.png)
175-
176-
pitch
187+
rot_x
177188
: Rotation of the marker about the cartesian x-axis, in radians.
178189

179-
Leaning a marker away from the camera increases the value of `rot_x`, while
180-
leaning it towards the camera decreases it. A value of 0 indicates that the
181-
marker is upright.
190+
Leaning a marker towards the camera increases the value of `rot_x`, while
191+
leaning it away from the camera decreases it. A value of π or -π indicates
192+
that the marker is upright.
182193

183-
yaw
194+
rot_y
184195
: Rotation of the marker about the cartesian y-axis, in radians.
185196

186-
Turning a marker clockwise (as viewed from above) increases the value of
187-
`rot_y`, while turning it anticlockwise decreases it. A value of 0 means
197+
Turning a marker clockwise (as viewed from above) decreases the value of
198+
`rot_y`, while turning it anticlockwise increases it. A value of 0 means
188199
that the marker is perpendicular to the line of sight of the camera.
189200

190-
roll
201+
rot_z
191202
: Rotation of the marker about the cartesian z-axis, in radians.
192203

193204
Turning a marker anticlockwise (as viewed from the camera) increases the
194-
value of `rot_z`, while turning it clockwise decreases it. A value of 0
195-
indicates that the marker is upright.
205+
value of `rot_z`, while turning it clockwise decreases it. A value of π
206+
or -π indicates that the marker is upright.
196207

197-
rot_x
198-
: An alias for `pitch`.
208+
roll
209+
: An alias for `rot_x`.
199210

200-
rot_y
201-
: An alias for `yaw`.
211+
pitch
212+
: An alias for `rot_y`.
202213

203-
rot_z
204-
: An alias for `roll`.
214+
yaw
215+
: An alias for `rot_z`.
205216

206217
rotation_matrix
207218
: The rotation matrix represented by this orientation. A list of 3 lists, each with 3 items.
208219

209220
quaternion
210221
: The [Quarternion](https://kieranwynn.github.io/pyquaternion/#quaternion-features) instance represented by this orientation.
211222

212-
[`Spherical`](#Spherical) {#Spherical}
223+
<a id="Spherical"/>
224+
225+
[`SphericalCoordinate`](#SphericalCoordinate) {#SphericalCoordinate}
213226
---------------
214227

215228
The spherical coordinates system has three values to specify a specific point in space.
216229

217-
![A visual representation of Spherical coordinates. Source: SourceBots]({{ site.baseurl }}/images/content/vision/spherical.png)
230+
distance
231+
: The radial distance, the distance from the origin to the point, in millimetres.
232+
233+
theta
234+
: This is the angle from directly in front of the camera to the vector which
235+
points to the location in the horizontal plane. A positive value indicates a
236+
counter-clockwise rotation. Zero is at the centre of the image.
237+
238+
phi
239+
: The polar angle from the y-axis of the camera "down" to the vector which
240+
points to the location, in radians. Zero is directly upward.
218241

219-
- r - The radial distance, the distance from the origin to the point, in millimetres.
220-
- θ (theta) - The angle from the azimuth to the point, in radians.
221-
- φ (phi) - The polar angle from the plane of the camera to the point, in radians.
242+
Also available are two computed angles which express the same location slightly differently:
222243

223244
rot_x
224-
: Rotation around the X-axis, in radians, corresponding to `theta` on the diagram.
245+
: Approximate rotation around the X-axis, in radians.
246+
This is the angle from the camera's horizontal plane to the vector which
247+
points to the location. Zero is at the centre of the image. Values increase
248+
towards the bottom of the image.
225249

226250
rot_y
227-
: Rotation around the Y-axis, in radians, corresponding to `phi` on the diagram.
228-
229-
dist
230-
: Distance, in millimetres, corresponding to `r` on the diagram.
251+
: Rotation around the Y-axis, in radians. This is similar to `theta`, however
252+
values increase towards the right of the image. Zero is at the centre of the image.
231253

232254
The camera is located at the origin, where the coordinates are (0, 0, 0).

0 commit comments

Comments
 (0)