module documentation

Pose types with unit handling for OPC UA, plus light-weight pose math.

Based on the OPC UA Relative Spatial Location (OPC 10000-210), see https://reference.opcfoundation.org/specs/OPC-10000-210/full

Warning

The math (@, inverse(), transform()) is pure Python on Euler angles, meant for occasional use only. It is slow in bulk and accumulates rounding error when chained. Use a dedicated library (e.g. NumPy, SciPy) for anything heavier.

Euler angles are not unique, so results may differ from the inputs while describing the same rotation. Compare with isclose(), not ==.

Rotations are intrinsic z-y'-x'' (yaw, pitch, roll), equivalent to extrinsic x-y-z. a @ b expresses b in the frame of a and uses the left operand's units.

Class Orientation Angular orientation defined by A=roll (X), B=pitch (Y), C=yaw (Z).
Class Pose Pose defined by Cartesian Position and angular Orientation.
Class Position Cartesian position defined by X, Y, and Z coordinates.
Function _make_factor Undocumented
Function _matmul Undocumented
Function _matrix_of Rotation matrix R = Rz(c) @ Ry(b) @ Rx(a) (intrinsic z-y'-x'').
Function _orientation_from Inverse of _matrix_of. At pitch ±90° (gimbal lock) yaw is set to 0.
Function _require_supported Undocumented
Function _rotate Undocumented
Function _transpose Undocumented
Constant _ANGLE Undocumented
Constant _angle_factor Undocumented
Constant _GIMBAL_EPS Undocumented
Constant _LENGTH Undocumented
Constant _length_factor Undocumented
Type Alias _Mat Undocumented
Type Alias _Vec Undocumented
def _make_factor(table: dict[Unit, float]) -> Callable[[Unit, Unit], float]:

Undocumented

def _matmul(p: _Mat, q: _Mat) -> _Mat:

Undocumented

def _matrix_of(o: Orientation) -> _Mat:

Rotation matrix R = Rz(c) @ Ry(b) @ Rx(a) (intrinsic z-y'-x'').

def _orientation_from(m: _Mat, unit: Unit) -> Orientation:

Inverse of _matrix_of. At pitch ±90° (gimbal lock) yaw is set to 0.

def _require_supported(unit: Unit, table: dict[Unit, float]):

Undocumented

def _rotate(m: _Mat, v: _Vec) -> _Vec:

Undocumented

def _transpose(m: _Mat) -> _Mat:

Undocumented

_ANGLE =

Undocumented

Value
{Unit.DEGREE_UNIT_OF_ANGLE: math.pi / 180, Unit.RADIAN: 1.0}
_angle_factor =

Undocumented

Value
_make_factor(_ANGLE)
_GIMBAL_EPS: float =

Undocumented

Value
1e-12
_LENGTH =

Undocumented

Value
{Unit.MILLIMETRE: 0.001, Unit.CENTIMETRE: 0.01, Unit.METRE: 1.0}
_length_factor =

Undocumented

Value
_make_factor(_LENGTH)
_Mat =

Undocumented

Value
tuple[float, float, float, float, float, float, float, float, float]
_Vec =

Undocumented

Value
tuple[float, float, float]