Skip to content

Commit 05f7e1f

Browse files
committed
vision orientation page
1 parent 2623a65 commit 05f7e1f

File tree

2 files changed

+48
-24
lines changed

2 files changed

+48
-24
lines changed

programming/vision/index.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ layout: page
33
title: Vision
44
---
55

6-
Vision
7-
======
6+
# Vision
87

98
Your robot is able to use a webcam to detect [fiducial markers](https://en.wikipedia.org/wiki/Fiducial_marker).
109
Specifically it can detect [AprilTags](https://april.eecs.umich.edu/software/apriltag), using the `36H11` marker set.
@@ -17,8 +16,8 @@ Using the marker poses and their locations, we can either calculate the location
1716

1817
For information on markers, see the [markers page](./markers).
1918

20-
[Camera](#camera) {#camera}
21-
===========================
19+
20+
## Camera
2221

2322
The interface to the vision system is through the camera, accessible through `R.camera`.
2423

@@ -69,8 +68,8 @@ frame = robot.camera.capture()
6968
flipped = cv2.flip(frame, 0)
7069
~~~~~
7170

72-
[Frame argument](#frame_args) {#frame_args}
73-
-------------------------------------------
71+
72+
### Frame argument
7473

7574
The slowest part of vision is capturing the image.
7675
You can use a frame with the other vision commands to avoid recapturing.
@@ -92,8 +91,8 @@ robot.camera.save("photo.jpg", frame=frame)
9291
# Do some other vision algorithm with the OpenCV frame here
9392
~~~~~
9493

95-
[Field of View](#fov) {#fov}
96-
----------------------------
94+
95+
### Field of View
9796

9897
The Logitech C500 has a [field of view][fov] of 72° and the C270 has a field of view of 60°.
9998

@@ -104,8 +103,8 @@ Note that the axes are all defined relative to the camera.
104103
Since we have no way to know how you've mounted your camera, you may need to account for that in your usage of the vision system's data.
105104
</div>
106105

107-
[Marker](#marker) {#marker}
108-
===========================
106+
107+
## Marker
109108

110109
A `Marker` object contains information about a *detected* marker.
111110
It has the following attributes:
@@ -117,10 +116,10 @@ size
117116
: The physical size of the marker, as the vision system expects it.
118117

119118
pixel_centre
120-
: A [`PixelCoordinates`](#PixelCoordinates) describing the position of the centre of the marker in the image.
119+
: A [`PixelCoordinates`](#pixelcoordinates) describing the position of the centre of the marker in the image.
121120

122121
pixel_corners
123-
: A list of 4 [`PixelCoordinates`](#PixelCoordinates) instances, each representing the position of a corner of the marker in the image.
122+
: A list of 4 [`PixelCoordinates`](#pixelcoordinates) instances, each representing the position of a corner of the marker in the image.
124123

125124
position
126125
: A `Position` instance describing the position of the marker.
@@ -161,10 +160,7 @@ orientation
161160
Zero values have the marker facing the camera square-on.
162161

163162

164-
<a id="Coordinate"/>
165-
166-
[`PixelCoordinates`](#PixelCoordinates) {#PixelCoordinates}
167-
---------
163+
### PixelCoordinates
168164

169165
A named tuple of `x` and `y` coordinates for the point, in pixels relative to the top left of the image.
170166

programming/vision/orientation.md

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,48 @@ layout: page
33
title: Orientation
44
---
55

6-
Orientation
7-
===========
6+
# Orientation
87

9-
TODO
8+
Orientation represents the rotation of a marker around its center.
9+
The axis and rotations follow the [aircraft principal axis](https://en.wikipedia.org/wiki/Aircraft_principal_axes) as shown in the diagram below.
1010

11+
![Yaw Pitch Roll axis](https://upload.wikimedia.org/wikipedia/commons/c/c1/Yaw_Axis_Corrected.svg "Yaw Pitch Roll axis")
1112

12-
# Examples
13+
These properties can be accessed as follows:
1314

14-
The following table visually explains what positive and negative rotations represent.
15-
The red arrow is not normally present on the marker but is used in these examples to indicate which way is up.
15+
yaw
16+
: A rotation about the vertical axis, in radians.
17+
Positive values indicate a rotation clockwise from the perspective of the marker.
18+
Zero values have the marker facing the camera square-on.
19+
20+
pitch
21+
: A rotation about the transverse axis, in radians.
22+
Positive values indicate a rotation upwards from the perspective of the marker.
23+
Zero values have the marker facing the camera square-on.
24+
25+
roll
26+
: A rotation about the longitudinal axis, in radians.
27+
Positive values indicate a rotation clockwise from the perspective of the marker.
28+
Zero values have the marker facing the camera square-on.
29+
30+
~~~~~ python
31+
markers = robot.camera.see()
1632

17-
Zero on all axis:
33+
for marker in markers:
34+
print(marker.orientation.yaw)
35+
print(marker.orientation.pitch)
36+
print(marker.orientation.roll)
37+
~~~~~
38+
39+
40+
## Examples
41+
42+
The following images visually explains what positive and negative rotations represent.
43+
The red arrow is not normally present on the marker but is used in these examples to indicate which way is up.
1844

19-
![Orientation zero all axis]({{ site.baseurl }}/images/content/vision/orientation/all0.png "All axis zero")
45+
|Zero on all axis|
46+
|---|
47+
|![Orientation zero all axis]({{ site.baseurl }}/images/content/vision/orientation/all0.png "All axis zero")|
2048

2149
| |&pi;/4 |-&pi;/4|
2250
|-------|-------|-------|

0 commit comments

Comments
 (0)