API Reference¶
- class angular_velocity.core.AngularVelocity(omega: ndarray, frame: str = 'G')[source]¶
Angular velocity_kinematics in both vector and matrix forms with frame transforms.
- frame: str = 'G'¶
- in_frame(R_to_from: ndarray) AngularVelocity[source]¶
ω^to = R_to_from * ω^from
- omega: ndarray¶
- property tilde: ndarray¶
- class angular_velocity.core.Frame(name: str, parent: Frame | None = None, T_parent_this: Transform | None = None)[source]¶
A coordinate frame label with fixed transform to a parent.
- name: str¶
- class angular_velocity.core.KinematicsEngine[source]¶
High-level façade mapping textbook identities to code. Designed for testing (pure functions + deterministic behavior).
- static planar_instantaneous_center(d_gb: ndarray, d_gb_dot: ndarray, omega_z: float) ndarray[source]¶
Return r_G0(t) in 2D: r0 = d_B - (1/ω) ḋ_B (Eq. 7.283).
- static rigid_body_point_velocity(omega_g: ndarray, r_gp: ndarray, d_gb: ndarray, d_gb_dot: ndarray) ndarray[source]¶
- class angular_velocity.core.Rotation(R: ndarray)[source]¶
SO(3) rotation_kinematics with basic differential kinematics.
- R: ndarray¶
- change_frame(R_to: ndarray) Rotation[source]¶
Transform this rotation_kinematics into a new basis: R_new = R_to * R.
- class angular_velocity.core.Screw(s: ndarray, m: ndarray, pitch: float)[source]¶
Screw axis and pitch.
- classmethod from_twist(V: ndarray) Screw[source]¶
Given spatial twist [ω; v], recover axis s, moment m, and pitch p (planar/3D).
- m: ndarray¶
- pitch: float¶
- s: ndarray¶
- class angular_velocity.core.Transform(R: ndarray, d: ndarray)[source]¶
SE(3) transform with velocity_kinematics matrix support.
- R: ndarray¶
- d: ndarray¶
Preset builders for angular_velocity-kinematics workflows.
These presets construct small, testable OOP models for common scenarios used to exercise Eq. 7.1–7.416:
Pure spin about a fixed axis (Rodrigues, (7.21–7.23))
Constant screw motion_kinematics (twist decomposition, (7.287–7.292), small-twist dT (7.367/7.373))
Rigid body with moving origin (velocity_kinematics matrix & transport theorem, (7.264–7.269), (7.351))
Spherical wrist (3R) angular_velocity-rate mapping (sum of rotating axes, (7.295–7.303), (7.319–7.320))
Planar 2R tip velocity_kinematics (illustrative 7.325–7.347 block; ω_z and v in space)
All presets are thin OOP wrappers around the kernels in angular_velocity.core and
return NumPy arrays or instances of angular_velocity.core.Rotation,
angular_velocity.core.Transform, or convenience outputs (ω, V, etc.), so you can
plug them directly into tests, the CLI façade, or notebooks.
Design notes¶
We keep these builders numeric and dependency-light (no SymPy).
Where an instantaneous mapping is well-known (e.g., spherical wrist), we compute space-frame axes and sum ω = Σ ai(q) * qd_i.
For 2R planar, we provide the tip linear velocity_kinematics in the space frame and the scalar out-of-plane ω_z, matching the block structure in 7.325–7.347.
- class angular_velocity.design.ConstantScrewMotion(twist: Sequence[float])[source]¶
Constant screw motion_kinematics described by a spatial twist V = [ω; v].
Provides: - Screw decomposition (axis s, moment m, pitch p) per (7.287–7.292) - Small-twist differential transform dT ≈ [I + dD][I + dR] (7.367/7.373)
- Parameters:
twist (Sequence[float]) – 6-vector spatial twist [ωx, ωy, ωz, vx, vy, vz] expressed in space frame.
- differential_transform(dt: float) ndarray[source]¶
Small-step differential transform for timestep dt.
- twist: Sequence[float]¶
- class angular_velocity.design.MovingOriginRigidBody(R: ndarray, d: ndarray, omega_g: ndarray, d_dot: ndarray)[source]¶
Rigid body B with space-frame origin trajectory d_B^G(t), velocity_kinematics ḋ_B^G, and angular_velocity velocity_kinematics ω^G. Computes point velocity_kinematics per (7.264–7.269) and the velocity_kinematics matrix V = Ṫ T^{-1} (7.351).
- Parameters:
R (np.ndarray) – Rotation ^G R_B (3×3).
d (np.ndarray) – Origin position d_B^G (3,).
omega_g (np.ndarray) – Angular velocity_kinematics ^G ω_B (3,).
d_dot (np.ndarray) – Origin linear velocity_kinematics ḋ_B^G (3,).
- R: ndarray¶
- d: ndarray¶
- d_dot: ndarray¶
- omega_g: ndarray¶
- class angular_velocity.design.Planar2RVelocity(l1: float, l2: float)[source]¶
Planar 2R end-effector instantaneous velocity_kinematics in the space frame.
- With link lengths (l1, l2) and joint angles (q1, q2):
x = l1 cos q1 + l2 cos(q1+q2) y = l1 sin q1 + l2 sin(q1+q2)
- The tip linear velocity_kinematics v^G = J(q) q̇ with
- J = [[-l1 sin q1 - l2 sin(q1+q2), -l2 sin(q1+q2)],
[ l1 cos q1 + l2 cos(q1+q2), l2 cos(q1+q2)]]
and out-of-plane ω_z = q̇1 + q̇2.
This corresponds to the illustrative velocity_kinematics-matrix blocks in (7.325–7.347).
- Parameters:
l1 (float) – First link length.
l2 (float) – Second link length.
- l1: float¶
- l2: float¶
- class angular_velocity.design.PureSpin(u: Sequence[float], phi: float, phi_dot: float)[source]¶
Pure rotation_kinematics about a fixed unit axis u with scalar rate phi_dot.
Provides: - SO(3) via Rodrigues (7.115–7.117) - ω and ω~ from (7.21–7.23)
- Parameters:
u (Sequence[float]) – Unit rotation_kinematics axis (3,).
phi (float) – Rotation angle (rad).
phi_dot (float) – Instantaneous angular_velocity rate (rad/s).
- phi: float¶
- phi_dot: float¶
- u: Sequence[float]¶
- class angular_velocity.design.SphericalWrist(wrist_type: int = 1)[source]¶
Ideal 3R spherical wrist with joint axes intersecting at the wrist center.
- We support three effective rotation_kinematics patterns via local-axis choices:
type 1: Z–X–Z type 2: Z–Y–Z type 3: X–Y–Z
- The instantaneous space-frame wrist angular_velocity velocity_kinematics is
ω^G(q, q̇) = a1(q) q̇1 + a2(q) q̇2 + a3(q) q̇3,
where ai(q) are the current joint axes expressed in the space frame.
- Parameters:
wrist_type ({1, 2, 3}) – Rotation-axis pattern (see above).
- axes_space(q: Sequence[float]) ndarray[source]¶
Return 3×3 matrix A(q) whose columns are the current axes [a1, a2, a3]. This is the wrist angular_velocity-velocity_kinematics Jacobian (space-frame) for unit rates.
- omega(q: Sequence[float], qd: Sequence[float]) ndarray[source]¶
ω^G = a1(q) q̇1 + a2(q) q̇2 + a3(q) q̇3 (sum of rotating axes).
- wrist_type: int = 1¶
- angular_velocity.design.constant_screw(twist6: Sequence[float]) ConstantScrewMotion[source]¶
Convenience factory for a ConstantScrewMotion scenario.
- angular_velocity.design.moving_origin_rigidbody(R: ndarray, d: ndarray, omega_g: ndarray, d_dot: ndarray) MovingOriginRigidBody[source]¶
Convenience factory for a MovingOriginRigidBody scenario.
- angular_velocity.design.planar_2r(l1: float, l2: float) Planar2RVelocity[source]¶
Convenience factory for a Planar2RVelocity scenario.
- angular_velocity.design.pure_spin_about(axis: Sequence[float], phi: float, phi_dot: float) PureSpin[source]¶
Convenience factory for a PureSpin scenario.
- angular_velocity.design.spherical_wrist(*, wrist_type: int = 1) SphericalWrist[source]¶
Convenience factory for a SphericalWrist scenario.
- class angular_velocity.io.IOManager(in_dir: Path = PosixPath('/home/runner/work/robotics/robotics/angular_velocity/in'), out_dir: Path = PosixPath('/home/runner/work/robotics/robotics/angular_velocity/out'))[source]¶
File I/O centered on angular_velocity/in and angular_velocity/out.
- in_dir: Path = PosixPath('/home/runner/work/robotics/robotics/angular_velocity/in')¶
- out_dir: Path = PosixPath('/home/runner/work/robotics/robotics/angular_velocity/out')¶
- angular_velocity.utils.adjoint(T: ndarray) ndarray[source]¶
Adjoint of SE(3) transform T (4x4) → 6x6.
- angular_velocity.utils.block44(R: ndarray, d: ndarray) ndarray[source]¶
Build 4x4 homogeneous transform from R (3x3) and d (3,).
- angular_velocity.utils.ensure_rotation(func: Callable) Callable[source]¶
Decorator: validate rotation_kinematics matrix args named ‘R’ or attributes ‘self.R’.
- angular_velocity.utils.motion_cross(V: ndarray) ndarray[source]¶
Small-adjoint (motion_kinematics cross product matrix) ad_V, 6x6.
- angular_velocity.utils.skew(omega: ndarray) ndarray[source]¶
Return the 3x3 skew-symmetric matrix (hat) of a 3-vector.
- angular_velocity.utils.vee(Omega: ndarray) ndarray[source]¶
Inverse of skew (vee) → 3-vector from 3x3 skew-symmetric matrix.
Sparkly class diagram generator for the angular_velocity-kinematics module.
Features¶
OOP façade: DiagramTool + DiagramConfig
Backends: DOT text, PlantUML text, optional Graphviz render (PNG/SVG/PDF)
JSON model export
Themed styles (light/dark), package clustering, legend, rankdir
Back-compatible helpers render_dot() and render_puml() for quick use.
CLI Examples¶
# DOT (file) and PUML (file) python -m angular_velocity.tools.diagram dot –out angular_velocity/out/classes.dot python -m angular_velocity.tools.diagram plantuml –out angular_velocity/out/classes.puml
# Graphviz (PNG) with high DPI (no size clamp) python -m angular_velocity.tools.diagram graphviz –fmt png –dpi 300 –outstem classes
# All artifacts (tries graphviz; if missing it reports ‘unavailable’) python -m angular_velocity.tools.diagram all
- class angular_velocity.tools.diagram.DiagramConfig(packages: 'Tuple[str, ...]' = ('angular_velocity.core', 'angular_velocity.io', 'angular_velocity.design', 'angular_velocity.utils', 'angular_velocity.app', 'angular_velocity.apis', 'angular_velocity.cli'), out_dir: 'Path' = PosixPath('angular_velocity/out'), theme: 'str' = 'light', rankdir: 'str' = 'LR', cluster_by_module: 'bool' = True, add_legend: 'bool' = False)[source]¶
- add_legend: bool = False¶
- cluster_by_module: bool = True¶
- out_dir: Path = PosixPath('angular_velocity/out')¶
- packages: Tuple[str, ...] = ('angular_velocity.core', 'angular_velocity.io', 'angular_velocity.design', 'angular_velocity.utils', 'angular_velocity.app', 'angular_velocity.apis', 'angular_velocity.cli')¶
- rankdir: str = 'LR'¶
- theme: str = 'light'¶
- class angular_velocity.tools.diagram.DiagramTool(config: DiagramConfig | None = None)[source]¶
Facade service for class diagrams of the angular_velocity package.
- angular_velocity.tools.diagram.render_dot(packages: Sequence[str] = ('angular_velocity.core', 'angular_velocity.io', 'angular_velocity.design', 'angular_velocity.utils', 'angular_velocity.app', 'angular_velocity.apis', 'angular_velocity.cli'), *, theme: str = 'light', rankdir: str = 'LR', cluster_by_module: bool = True, add_legend: bool = False) str[source]¶
Emit Graphviz DOT text for the given packages.
- angular_velocity.tools.diagram.render_puml(packages: Sequence[str] = ('angular_velocity.core', 'angular_velocity.io', 'angular_velocity.design', 'angular_velocity.utils', 'angular_velocity.app', 'angular_velocity.apis', 'angular_velocity.cli'), *, theme: str = 'light', cluster_by_module: bool = True, add_legend: bool = False) str[source]¶
Emit PlantUML text for the given packages.