Position

Your robot supports three different coordinates systems for position:

  • Cartesian
  • Spherical
  • Cylindrical

The latter are both variants of a Polar Coordinates system.

Cartesian

The cartesian coordinates system

The cartesian coordinates system

The cartesian coordinates system has three principal axes that are perpendicular to each other.

The value of each coordinate indicates the distance travelled along the axis to the point.

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

markers = r.camera.see()

for m in markers:
    print(m.position.cartesian.x)  # Displacement from the origin in metres, along x axis.
    print(m.position.cartesian.y)  # Displacement from the origin in metres, along y axis.
    print(m.position.cartesian.z)  # Displacement from the origin in metres, along z axis.

Hint

The y axis decreases as you go up. This matches convention for computer vision systems.

Spherical

The spherical coordinates system

The spherical coordinates system

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

  • r - The radial distance, the distance from the origin to the point, in metres.
  • θ (theta) - The angle from the azimuth to the point, in radians.
  • φ (phi) - The polar angle from the plane of the camera to the point, in radians.

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

markers = r.camera.see()

for m in markers:
    print(m.position.spherical.r)  # Distance from the origin in metres
    print(m.position.spherical.theta)  # The angle from the azimuth to the point, in radians.
    print(m.position.spherical.phi)  # The polar angle from the plane of the camera to the point, in radians.

Hint

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

Note

When searching for spherical coordinates, you may find a references with phi and theta the other way around. This is due to there being two conventions for this. We use the ISO 80000-2 16.3 system, as often found in physics.

Cylindrical

The cylindrical coordinates system

The cylindrical coordinates system

The cylindrical coordinates system has three values to specify a point in space.

  • ρ (rho) - The axial distance from the origin, in metres.
  • φ (phi) - The polar angle from the plane of the camera to the point, in radians.
  • z - The height of the point from the plane of the camera.
markers = r.camera.see()

for m in markers:
    print(m.position.cylindrical.p)  # The axial distance from the origin.
    print(m.position.cylindrical.phi)  # The polar angle from the plane of the camera to the point, in radians.
    print(m.position.cylindrical.z)  # The height of the point from the plane of the camera, in metres.

Note

Whilst ρ is technically rho, we denote it as p in the API to make it easier to type.