ouster.sdk.util.extrinsics module

Miscellaneous utilities.

fov_vertical(info)[source]
Return type:

float

fov_horizontal(info)[source]
Return type:

float

img_aspect_ratio(info)[source]

Returns 2D image aspect ratio based on sensor FOV angles.

Return type:

float

Uses the order:

img_aspect_ratio = FOV_vertical / FOV_horizontal

quaternion_to_rotation_matrix(q)[source]

Converts Quaternion [w, x, y, z] to Rotation [3x3] matrix.

Return type:

ndarray

rotation_matrix_to_quaternion(R)[source]

Converts a Rotation [3x3] matrix to Quaternion [w, x, y, z].

Return type:

ndarray

position_quaternion_to_transform(p, q)[source]

Converts Quaternion + Pose [7] vector to homogeneous [4x4] matrix.

Return type:

ndarray

euler_to_rotation_matrix(roll, pitch, yaw)[source]

Convert Euler angles (roll, pitch, yaw) to a 3D rotation matrix.

Parameters:
  • roll – Rotation about the x-axis (rad)

  • pitch – Rotation about the y-axis (rad)

  • yaw – Rotation about the z-axis (rad)

Returns:

3x3 rotation matrix

Return type:

R

xyzrpy_to_matrix(px, py, pz, r, p, y)[source]

A method that takes position + euler angles (rad) and produces an equivalent 4x4 transform.

Parameters:
  • px – position

  • py – position

  • pz – position

  • r – rotation expressed in euler angles (rad)

  • p – rotation expressed in euler angles (rad)

  • y – rotation expressed in euler angles (rad)

Returns:

4x4 transformation matrix

Return type:

R

xyzq_to_matrix(px, py, pz, qx, qy, qz, qw)[source]

A method that takes position + quaternion (rad) and produces an equivalent 4x4 transform.

Parameters:
  • px – position

  • py – position

  • pz – position

  • qx – rotation expressed in a quaternion

  • qy – rotation expressed in a quaternion

  • qz – rotation expressed in a quaternion

  • qw – rotation expressed in a quaternion

Returns:

4x4 transformation matrix

Return type:

R

parse_extrinsics_from_string(extrinsics, degrees=True)[source]

A utility method to parse extrinsics in multiple formats.

Parameters:
  • extrinsics (- A json with containing a per sensor) – a string representing a file or extrinsics in a supported format

  • degrees – whether angles should be parsed as degress (True by default)

  • formats (Acceptale extrinsics) –

  • extrinsics

  • identity (- identity ; Use this to override any stored extrinsics with) –

  • angles (- X Y Z R P Y ; 'R P Y' represent euler) –

  • ; (- X Y Z QX QY QZ QW) –

  • order (- n1 n2 .. n16 ; 16 floats representing a 2D array in a row-major) –

Returns:

4x4 transformation matrix or a filename

Return type:

R