udaan.manif.SO3 module

udaan.manif.SO3.Rot2Eul(R)[source]
class udaan.manif.SO3.SO3[source]

Bases: object

Rotation matrix on the Special Orthogonal group SO(3).

Wraps a 3x3 rotation matrix. Supports:

R1 @ R2 -> SO3 (group composition, if both SO3) R @ v -> ndarray (rotate a vector) R1 - R2 -> TSO3 (configuration error in the Lie algebra) R + w -> SO3 (exponential map step, w is a TSO3) R.T -> SO3 (transpose, preserves type)

property T: SO3

Transpose (same as inverse for SO3).

__init__(R=None)[source]
property arr: ndarray

Plain numpy array (copy).

config_error(other)[source]

Scalar configuration error: 0.5 * tr(I - other^T @ self).

Returns 0 when self == other, approaches 2 for 180-degree error.

Return type:

float

static from_angle_axis(eta)[source]

Construct SO3 from an angle-axis vector via the exponential map.

Parameters:

eta (ndarray) – 3-vector whose direction is the rotation axis and magnitude is the rotation angle (radians).

Return type:

SO3

static from_tilt_yaw(tilt, yaw)[source]

Construct SO3 from a tilt vector and a yaw angle.

Parameters:
  • tilt (ndarray) – 3-vector (angle-axis) applied to the upright orientation. The resulting b3 axis is expm(hat(tilt)) @ e3.

  • yaw (float) – heading angle in radians. b1 hint is [cos(yaw), sin(yaw), 0].

Return type:

SO3

static from_two_vectors(b3, b1)[source]

Construct SO3 from a primary axis (b3) and a heading hint (b1).

Builds an orthonormal frame [b1’, b2, b3] where b3 is preserved exactly, b1’ is the closest vector to b1 orthogonal to b3, and b2 = b3 x b1’. Handles the singularity when b3 is parallel to b1.

This is the standard construction for desired attitude from thrust direction (b3) and heading direction (b1).

Return type:

SO3

inv()[source]

Inverse rotation (transpose, since R^{-1} = R^T for SO(3)).

Return type:

SO3

step(Omega_dt=None)[source]

Integrate angular velocity via the exponential map.

Parameters:

Omega_dt – angular velocity scaled by dt (3-vector or TSO3).

Returns a new SO3 element: R_next = R @ expm(hat(Omega_dt)).

class udaan.manif.SO3.TSO3[source]

Bases: object

Element of the Lie algebra so(3) — tangent vector to SO(3).

Wraps a 3-vector representing angular velocity or rotation error. Supports:

w1 - w2 -> TSO3 (tangent vector difference) w1 + w2 -> TSO3 (tangent vector sum) w * s -> TSO3 (scalar multiplication) w.hat() -> 3x3 (skew-symmetric matrix in so(3)) w.transport(R_from, R_to) -> TSO3 (frame transport)

__init__(vector=None)[source]
property arr: ndarray

Plain numpy array (copy).

hat()[source]

Return the 3x3 skew-symmetric matrix in so(3).

Return type:

ndarray

property norm: float

Magnitude of the tangent vector.

transport(R_from, R_to)[source]

Transport this tangent vector from R_from’s body frame to R_to’s.

Computes R_to^T @ R_from @ self, which maps an angular velocity (self) expressed in R_from’s frame into R_to’s frame.

Return type:

TSO3

Example

eOm = Om - Omd.transport(Rd, R) # angular velocity error

property vector: ndarray

Raw 3-vector as a plain np.ndarray.