API Reference

rotation_kinematics.rot_cli

Command-line interface for rotation_kinematics.rot_cli.

The CLI supports two usage styles:

  1. Modern subcommand form:

    python -m rotation_kinematics.rot_cli compose global zyx "30,20,10" --degrees
    python -m rotation_kinematics.rot_cli sphinx-skel rotation_kinematics/docs
    
  2. Historical no-subcommand form for the common compose workflow:

    python -m rotation_kinematics.rot_cli global zyx "30,20,10" --degrees
    

The sphinx-skel helper generates a conservative, GitHub Pages friendly Sphinx documentation skeleton with dynamic RST heading underline lengths, tracked support directories, and an API page that includes only modules that are actually importable in the current Python environment.

rotation_kinematics.rot_cli.build_parser()[source]

Build the command-line parser.

Return type:

ArgumentParser

rotation_kinematics.rot_cli.cli(argv=None)[source]

Run the rotation-kinematics command-line interface.

Parameters:

argv (List[str] | None)

Return type:

int

rotation_kinematics.rot_core

rotation_kinematics.rot_core.align_body_x(u)[source]

Return a Rotation that aligns the body x-axis with vector u (right-handed).

Parameters:

u (Sequence[float])

Return type:

scipy.spatial.transform.Rotation

rotation_kinematics.rot_core.angvel_from_rates(seq, angles, rates, convention='global', degrees=False, frame='body')[source]

Map generalized angle rates q̇ -> angular_velocity velocity_kinematics ω.

Parameters:
  • seq (str) – Proper Euler / Tait-Bryan sequence (e.g., ‘zyx’, ‘zyz’, ‘xyz’, …).

  • angles ((3,)) – Angles (deg if degrees=True, else rad).

  • rates ((3,)) – Angle rates q̇ (deg/s if degrees=True, else rad/s).

  • convention ({'global','local'}) – ‘global’ for extrinsic rotations, ‘local’ for intrinsic rotations.

  • degrees (bool) – Interpret angles and rates in degrees/deg/s when True.

  • frame ({'space','body'}) – Frame of ω. ‘space’ returns ω in global frame; ‘body’ in body frame.

Returns:

ω – Angular velocity_kinematics (deg/s if degrees=True, else rad/s).

Return type:

(3,)

rotation_kinematics.rot_core.build_matrix(mode, seq, angles, degrees=False)[source]

Build a scipy Rotation for a given convention (‘global’|’local’), sequence, and angles. Angles are interpreted in degrees if degrees=True, otherwise radians.

Parameters:
  • mode (str)

  • seq (str)

  • angles (Sequence[float])

  • degrees (bool)

Return type:

scipy.spatial.transform.Rotation

rotation_kinematics.rot_core.check_matrix(Robj)[source]

Return orthogonality diagnostics for a Rotation.

Parameters:

Robj (scipy.spatial.transform.Rotation)

Return type:

Dict

rotation_kinematics.rot_core.passive_transform(Robj, vecs)[source]

Passive change of coordinates (global -> body): multiply by R^T. Implemented via Rotation.inv().apply on row-stacked vectors.

Parameters:
  • Robj (scipy.spatial.transform.Rotation)

  • vecs (Sequence[Sequence[float]])

Return type:

numpy.ndarray

rotation_kinematics.rot_core.rates_from_angvel(seq, angles, omega, convention='global', degrees=False, frame='body', rcond=1e-12)[source]

Map angular_velocity velocity_kinematics ω -> generalized rates q̇ using a pseudoinverse.

Parameters:
  • omega ((3,)) – Angular velocity_kinematics (deg/s if degrees=True, else rad/s).

  • rcond (float) – Cutoff for small singular values in the pseudoinverse; helps near singularities.

  • seq (str)

  • angles (Sequence[float])

  • convention (str)

  • degrees (bool)

  • frame (str)

Returns:

q̇ – Angle rates (deg/s if degrees=True, else rad/s).

Return type:

(3,)

rotation_kinematics.rot_core.repeat_rotation(Robj, m)[source]

Return R^m using the logarithm/exponential map (stable for integer m).

Parameters:
  • Robj (scipy.spatial.transform.Rotation)

  • m (int)

Return type:

scipy.spatial.transform.Rotation

rotation_kinematics.rot_core.save_R(path, Robj)[source]

Save a rotation_kinematics matrix to CSV at rotation_kinematics/out/<path_planning>.

Parameters:
  • path (str)

  • Robj (scipy.spatial.transform.Rotation)

Return type:

None

rotation_kinematics.rot_core.save_series(path, t, data, header)[source]

Save a time series (t, data[*,3]) to CSV at rotation_kinematics/out/<path_planning> with a header.

Parameters:
  • path (str)

  • t (numpy.ndarray)

  • data (numpy.ndarray)

  • header (str)

Return type:

None

rotation_kinematics.rot_core.transform_points(Robj, pts)[source]

Active transform of row-stacked points/vectors using Rotation.apply.

Parameters:
  • Robj (scipy.spatial.transform.Rotation)

  • pts (Sequence[Sequence[float]])

Return type:

numpy.ndarray

rotation_kinematics.rot_design

Design-time constants and small helpers for the CLI. Covers: the 12 global (Tait–Bryan) and 6 proper Euler sequences, local/global mapping, and a few named presets from the chapter examples.

rotation_kinematics.rot_io

rotation_kinematics.rot_io.read_job(path)[source]
Read a batch job file:
  • .json : JSON

  • .yaml/.yml : YAML (requires PyYAML)

Returns a dict with at least {“tasks”: […]}.

Parameters:

path (str)

Return type:

Dict[str, Any]

rotation_kinematics.rot_io.read_points_csv(path)[source]
Parameters:

path (str)

Return type:

numpy.ndarray

rotation_kinematics.rot_io.write_points_csv(path, arr)[source]
Parameters:
  • path (str)

  • arr (numpy.ndarray)

Return type:

None

rotation_kinematics.rot_utils

rotation_kinematics.rot_utils.align_x_to_vector(u)[source]
Parameters:

u (Sequence[float])

Return type:

scipy.spatial.transform.Rotation

rotation_kinematics.rot_utils.build_rate_map(seq, angles, convention='global', degrees=False, frame='body')[source]

Return M(q) so that ω = M(q) q̇.

Parameters:
  • seq (str)

  • angles (Sequence[float])

  • convention (str)

  • degrees (bool)

  • frame (str)

Return type:

numpy.ndarray

rotation_kinematics.rot_utils.compose_global(seq, angles, degrees=False)[source]

Extrinsic (fixed axes).

Parameters:
  • seq (str)

  • angles (Sequence[float])

  • degrees (bool)

Return type:

scipy.spatial.transform.Rotation

rotation_kinematics.rot_utils.compose_local(seq, angles, degrees=False)[source]

Intrinsic (moving axes) — SciPy uppercase.

Parameters:
  • seq (str)

  • angles (Sequence[float])

  • degrees (bool)

Return type:

scipy.spatial.transform.Rotation

rotation_kinematics.rot_utils.decompose(Robj, seq, convention='global', degrees=False)[source]

Mirror compose_* for extraction.

Parameters:
  • Robj (scipy.spatial.transform.Rotation)

  • seq (str)

  • convention (str)

  • degrees (bool)

Return type:

numpy.ndarray

rotation_kinematics.rot_utils.ensure_dir(p)[source]
Parameters:

p (str)

Return type:

None

rotation_kinematics.rot_utils.hat(v)[source]
Parameters:

v (numpy.typing.ArrayLike)

Return type:

numpy.ndarray

rotation_kinematics.rot_utils.is_rotmat(Rm, tol=1e-08)[source]
Parameters:
  • Rm (numpy.typing.ArrayLike)

  • tol (float)

Return type:

Tuple[bool, dict]

rotation_kinematics.rot_utils.omega_from_rates(seq, angles, rates, convention='global', degrees=False, frame='body')[source]
Parameters:
  • seq (str)

  • angles (Sequence[float])

  • rates (Sequence[float])

  • convention (str)

  • degrees (bool)

  • frame (str)

Return type:

numpy.ndarray

rotation_kinematics.rot_utils.parse_floats(csv)[source]
Parameters:

csv (str | Sequence[float])

Return type:

List[float]

rotation_kinematics.rot_utils.rates_from_omega(seq, angles, omega, convention='global', degrees=False, frame='body')[source]
Parameters:
  • seq (str)

  • angles (Sequence[float])

  • omega (Sequence[float])

  • convention (str)

  • degrees (bool)

  • frame (str)

Return type:

numpy.ndarray

rotation_kinematics.rot_utils.rotation_power(Robj, m)[source]
Parameters:
  • Robj (scipy.spatial.transform.Rotation)

  • m (int)

Return type:

scipy.spatial.transform.Rotation

rotation_kinematics.rot_utils.save_matrix_csv(path, Robj)[source]
Parameters:
  • path (str)

  • Robj (scipy.spatial.transform.Rotation)

Return type:

None

rotation_kinematics.rot_utils.save_series_csv(path, t, data, header='t, a1, a2, a3')[source]
Parameters:
  • path (str)

  • t (numpy.ndarray)

  • data (numpy.ndarray)

  • header (str)

Return type:

None

rotation_kinematics.rot_utils.vee(M)[source]
Parameters:

M (numpy.typing.ArrayLike)

Return type:

numpy.ndarray

rotation_kinematics.rot_closedform

rotation_kinematics.rot_closedform.E_matrix(seq, convention='local', frame='body', simplify=True)[source]

Return symbolic E(q) such that ω = E(q) q̇ for a 3-angle sequence.

  • convention: ‘local’ (intrinsic) uses RIGHT-multiplication: R = R_a1(q1) R_a2(q2) R_a3(q3) ‘global’ (extrinsic) is mapped via the standard identity:

    global(seq, a1,a2,a3) == local(seq[::-1], a3,a2,a1)

  • frame: ‘body’ uses Ω_b = Rᵀ Ṙ, ‘space’ uses Ω_s = Ṙ Rᵀ

  • columns of E are in the SAME order as (a1,a2,a3) for the input seq.

Parameters:
  • seq (str)

  • convention (str)

  • frame (str)

  • simplify (bool)

Return type:

Tuple[sympy.Matrix, Tuple[sympy.Symbol, sympy.Symbol, sympy.Symbol]]

rotation_kinematics.rot_closedform.E_matrix_proper(seq, convention='local', frame='body', simplify=True)[source]

Convenience wrapper for proper Euler sequences (zxz, zyz, xyx, xzx, yxy, yzy).

Parameters:
  • seq (str)

  • convention (str)

  • frame (str)

  • simplify (bool)

Return type:

Tuple[sympy.Matrix, Tuple[sympy.Symbol, sympy.Symbol, sympy.Symbol]]

rotation_kinematics.rot_closedform.E_matrix_rpy_zyx_body(convention='local', simplify=True)[source]
Return BOTH:
  1. E in sequence order [a1=ψ (z), a2=θ (y), a3=φ (x)]

  2. E reindexed to classic RPY order [φ, θ, ψ] (columns aligned to [φ̇, θ̇, ψ̇])

Parameters:
  • convention (str)

  • simplify (bool)

Return type:

Tuple[sympy.Matrix, Tuple[sympy.Symbol, sympy.Symbol, sympy.Symbol], sympy.Matrix, Tuple[sympy.Symbol, sympy.Symbol, sympy.Symbol]]

rotation_kinematics.arch_ascii

rotation_kinematics.arch_ascii.find_internal_imports(py_path)[source]
Parameters:

py_path (str)

Return type:

set[str]

rotation_kinematics.arch_ascii.main()[source]