You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Measured on Apple M2 (16 GB), Julia 1.12, Python 3.13. Julia timings are median values from BenchmarkTools.jl.*
17
17
18
18
## Analysis
19
19
20
20
Forward kinematics and Jacobian computation are **~3x faster than Pinocchio** thanks to Julia's StaticArrays, which eliminate heap allocations for small fixed-size matrices (4×4, 6×6). The in-place variants (`forward_kinematics_space!`, `jacobian_space!`, etc.) achieve **zero allocations**.
21
21
22
-
The remaining gap in dynamics functions comes from algorithmic differences:
22
+
The remaining gap in dynamics functions comes from allocation overhead in the RNEA (inverse dynamics) implementation, which uses heap-allocated workspace arrays. The algorithmic gap has been largely closed:
23
23
24
24
### Algorithms
25
25
26
-
-**Mass matrix**: ModernRoboticsBook.jl calls `inverse_dynamics`*n* times with unit accelerations (the textbook approach). Pinocchio uses the **Composite Rigid Body Algorithm (CRBA)**, which computes the full matrix in a single pass.
27
-
-**Forward dynamics**: ModernRoboticsBook.jl explicitly forms and inverts the mass matrix. Pinocchio uses the **Articulated Body Algorithm (ABA)**, which solves for joint accelerations in O(n) without forming the mass matrix.
26
+
-**Mass matrix**: Uses the **Composite Rigid Body Algorithm (CRBA)**, which computes the full matrix in a single backward pass over composite spatial inertias — the same algorithm as Pinocchio. The in-place variant achieves zero allocations and is within ~1.4x of Pinocchio.
27
+
-**Forward dynamics**: Computes `M \ (τ - RNEA(q, dq, 0, g, F))` using CRBA for the mass matrix and a single RNEA call for the bias forces. Pinocchio uses the **Articulated Body Algorithm (ABA)**, which solves for joint accelerations in O(n) without forming the mass matrix.
28
+
-**Inverse dynamics / gravity forces**: Uses the Recursive Newton-Euler Algorithm (RNEA), the same O(n) algorithm as Pinocchio. The ~6x gap is due to allocation overhead in the current implementation.
0 commit comments