Analytical FK Backward
forward_kinematics_tensor now uses an analytical geometric Jacobian for the backward pass by default, computing d(transform)/d(joint_angles) directly from joint axes and the kinematic tree structure instead of replaying forward ops through autograd.
- ~9x faster backward pass on GPU for large batch sizes
- Compatible with
torch.compile(fullgraph=True)— both forward and backward are fully traced - Compatible with
torch.vmap - Escape hatch:
analytical_grad=Falsefor higher-order gradients (create_graph=True) or gradients w.r.t. chain parameters (e.g. link offsets for calibration)
chain = pk.build_serial_chain_from_urdf(open("robot.urdf").read(), "end_link")
th = torch.randn(1000, 7, requires_grad=True)
T_all = chain.forward_kinematics_tensor(th) # analytical backward by default
loss = T_all.sum()
loss.backward() # ~9x faster than autograd on GPUOther changes
- Add
--visualizeCLI flag and fixwindow_recorderfallback on macOS