Skip to main content

Module symbolic

Module symbolic 

Source
Expand description

Symbolic Jacobian computation via tang-expr.

Traces the Articulated Body Algorithm (ABA) and semi-implicit Euler step symbolically using ExprId as the scalar type, then differentiates the output expressions w.r.t. all input variables. The resulting derivatives are simplified and compiled to fast closures.

§How it works

  1. Model topology (parent indices, joint types, axes, inertias) is read from the concrete Model at compile time.
  2. State variables (q, v, ctrl) become ExprId::var(i) in the expression graph. Gravity and timestep become ExprId::from_f64(...) literals.
  3. We re-implement the single-DOF ABA path using tang’s generic spatial algebra types (SpatialVec<ExprId>, SpatialMat<ExprId>, etc.).
  4. The output accelerations are combined with semi-implicit Euler to produce (q’, v’) expressions. We differentiate each output w.r.t. each input, simplify, and compile to closures.

§Limitations

  • Only single-DOF joints (revolute, prismatic) are supported. Multi-DOF joints (spherical, free) require symbolic matrix inversion which is not yet implemented.
  • The compiled closures are specialized to a specific model topology. If the model changes, recompile.

Structs§

CompiledStepJacobians
Compiled symbolic step Jacobians.

Functions§

symbolic_step_jacobians
Convenience: compute symbolic step Jacobians for a given model and state.