udaan.manif.S2 module

class udaan.manif.S2.S2[source]

Bases: object

Unit vector on the 2-sphere S2.

Wraps a 3-vector (unit norm). Supports:

q1 - q2 -> TS2 (configuration error as tangent vector) q + w -> S2 (geodesic step via exponential map, w is a TS2)

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

Plain numpy array (copy).

config_error(other)[source]

Scalar configuration error: 1 - q^T q_other.

Return type:

float

error_vec(other, version=2)[source]

Configuration error vector on the tangent space.

Parameters:
  • other – The other S2 point.

  • version – Error formula variant. 2 (default): hat(q)^2 @ q_other 1: q_other x q (cross product)

Return type:

ndarray

static from_spherical(phi=0.0, th=0.0)[source]

Point on S2 from spherical coordinates (azimuth phi, polar th).

step(omega_dt=None)[source]

Geodesic step on S2 via the exponential map.

Parameters:

omega_dt – angular velocity scaled by dt (3-vector).

Returns a new S2 element: q_next = expm(hat(omega_dt)) @ q.

class udaan.manif.S2.TS2[source]

Bases: object

Tangent vector to the 2-sphere S2.

Wraps a 3-vector representing angular velocity or configuration error on the sphere. Supports:

v1 - v2 -> TS2 (tangent vector difference) v1 + v2 -> TS2 (tangent vector sum) v * s -> TS2 (scalar multiplication) v.transport(q) -> TS2 (project onto tangent space at q)

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

Plain numpy array (copy).

property norm: float

Magnitude of the tangent vector.

transport(q)[source]

Transport this tangent vector to the tangent space at q.

Computes -hat(q)^2 @ self, which projects self onto T_q S2 with the correct sign so that ew = w - wd.transport(q).

Return type:

TS2

property vector: ndarray

Raw 3-vector as a plain np.ndarray.