RBDReference#
RBDReference provides CPU implementations of dynamics, kinematics, derivatives
and integration for prototyping and checking generated CUDA. It lives in
external/RBDReference; it is not the GPU runtime wrapper.
Quick start#
After the source installation, run from the GRiD repository root:
import numpy as np
from URDFParser import URDFParser
from RBDReference import RBDReference
robot = URDFParser().parse("config/robot_assets/iiwa14.urdf")
rbd = RBDReference(robot)
q = np.zeros(robot.get_num_pos()) # this example is fixed-base
qd = np.zeros(robot.get_num_vel())
tau, v, a, f = rbd.inverse_dynamics(q, qd)
M = rbd.crba(q)
qdd = rbd.forward_dynamics(q, qd, tau)
Configurations have width NQ; velocities, forces and tangent perturbations
have width NV. Floating and spherical joints use quaternions, so an
all-zero configuration is not valid for those models. Use integrate and
difference for configuration perturbations and errors.
Dynamics and derivatives#
Operation |
Call / result |
|---|---|
Inverse dynamics (RNEA) |
|
Forward dynamics |
|
Mass matrix and inverse |
|
Inverse-dynamics gradient |
|
Forward-dynamics gradient |
|
Second-order inverse dynamics |
|
Second-order forward dynamics |
|
idsva_so selects the body-frame implementation for fixed-base models
and the world-frame implementation for floating-base models. This dispatch
is not a universal performance ranking. See
IDSVA / IDSVA-SO (Inverse Dynamics, Second-Order).
Kinematics, centroidal quantities and energy#
rbd.end_effector_pose(q)returns end-effector poses;end_effector_pose_gradient(q)returns geometric Jacobians with tangent columns.end_effector_pose_hessian(q)is a finite-difference reference with tangent-space shape(6, NV, NV)per end effector; the separateend_effector_pose_hessian_analyticsupplies the analytical path.rbd.frame_jacobian(q, frame_name, reference_frame)andframe_jacobian_dot(q, qd, ...)support general frames.rbd.com(q)returns a position of shape(3,);rbd.jacobian_com(q)returns a(3, NV)Jacobian.A, h = rbd.ccrba(q, qd)returns the centroidal momentum matrix and momentum.dccrba(q)differentiates the matrix;cmm_time_variation(q, qd)returns its time derivative.Gravity, nonlinear effects, Coriolis matrix, energy and inertial-parameter regressors are described in Bias terms, centroidal quantities and energy.
State operations and plant#
integrate(q, delta) retracts a tangent perturbation; difference(q_from,
q_to) returns a tangent error. integrator(q, qd, u, dt, integrator_type=...)
supports Euler, semi-implicit Euler, constant acceleration, midpoint, Heun
(trapezoidal), and RK4. See
Integrators and the plant layer for orders, supported
derivatives and plant costs.
Source and validation#
The RBDReference README
lists the full method families and standalone installation instructions.
Signatures and per-pass helpers are in RBDReference.py and its topic
mixins. Reference availability does not imply support on every GPU surface;
check Python backend interfaces.
For tests and numerical checks, see CUDA Validation And Performance Reporting
and external/RBDReference/tests/README.md.