Skip to main content

Position

Position represents the location of a marker in 3D space, relative to the camera.

These properties can be accessed as follows:

distance
The distance between the camera and the centre of the marker, in millimetres.
horizontal_angle
Horizontal angle from the centre of the camera’s view to the marker, in radians. Ranges -π to π. Directly in front is zero, positive to the right.
vertical_angle
Vertical angle from the centre of the camera’s view to the marker, in radians. Ranges -π to π. Directly in front is zero, positive values upwards.
from sbot import *

robot = Robot()

markers = robot.camera.see()

for marker in markers:
print(marker.position.distance)
print(marker.position.horizontal_angle)
print(marker.position.vertical_angle)
tip

You can use the math.degrees function to convert from radians to degrees.

Examples

The following images visually explains what positive and negative angles represent.

horizontal_anglevertical_angle
00Position centre
00.2Position up
0.20Position right
0-0.2Position down
-0.20Position left