arXiv:2610.25476cs.ROOct 2026

Manuscript Offprint

arXiv:2610.25476

CusADi2: Latency-Optimized Batch Computation of Robot Kinematics, Jacobians, and Hessians on the GPU

John Viljoen, Lasse Peters, Masayoshi Tomizuka, Negar Mehr

John Viljoen 1^{1}, Lasse Peters 1^{1}, Masayoshi Tomizuka 1^{1}, and Negar Mehr 1^{1}

Figure

UR5e

Franka FR3

I2RT YAM

Unitree Go2

Shadow Hand

Unitree G1

degrees of freedom

Fig. 1. CusADi2 evaluates batches of dynamical-system functions, such as robot kinematics, Jacobians, and Hessians, on the GPU with low latency. Here, we show the latency of batched forward kinematics (B = 256 rollouts of 8 time steps) for all 67 robots in the MuJoCo Menagerie, sorted by degrees of freedom, with common platforms labeled. CusADi2 is fastest on all but two low-DOF robots and evaluates common platforms in under 40 μ\mus.

Abstract—Trajectory optimization methods, from sampling-based zero-order to gradient-based first- and second-order approaches, require many evaluations of dynamical system functions, i.e., functions derived from a robot's dynamical model, such as forward kinematics and their Jacobians and Hessians. These evaluations are largely independent, e.g., across sampled trajectories or time steps, and can thus be evaluated in parallel as a batch. When used to make decisions online, these methods require low latency, i.e., each batch must complete in as little wall-clock time as possible. Existing frameworks utilize modern GPU hardware primarily to parallelize across batch instances, thereby optimizing throughput but not latency. We present CusADi2, a software library that reduces the batch evaluation latency by additionally parallelizing computation within each batch instance. We benchmark forward kinematics, Jacobians, and Hessians for all 67 robots in the MuJoCo Menagerie, including arms, hands, quadrupeds, humanoids, and biomechanical models, against MuJoCo XLA, MuJoCo Warp, frax, CusADi, and CasADi. CusADi2 achieves lower latency than all baselines at batch sizes of 64 to 4096, while matching them at larger batch sizes. We also demonstrate the performance advantage of CusADi2 in a sampling-based control application. All code is open-source at: https://github.com/johnviljoen/cusadi2.

I. INTRODUCTION

Modern robotics algorithms often make decisions by repeatedly evaluating dynamical system functions, i.e., functions derived from a robot's dynamical model, such as forward kinematics and their Jacobians and Hessians [1, 2]. In some cases, this dependence on a model is explicit. For example, model-based online planning techniques, whether zero-order (sampling-based) [3, 4] or first- and second-order (gradient-based) [5], all repeatedly evaluate a model to predict the effect of their actions on the environment [1]. In other cases, the dependence on a model may be implicit. For example, model-free techniques such as Reinforcement Learning (RL) usually rely on a simulator to generate sufficient training data [2]. Approaches that evaluate the model offline, such as RL, require high throughput. Therefore, modern GPU tools [6, 7, 8, 9] have been optimized for this criterion. However, techniques that evaluate the model online require a different criterion, namely low latency, which remains a secondary concern for these tools. Sampling-based methods evaluate batches of hundreds of rollouts for every control action, and gradient-based methods evaluate Jacobians and Hessians along the trajectory at every iteration. In both cases, the latency of these evaluations directly limits the achievable control rate. These online methods thus directly benefit from low-latency evaluation of dynamical system functions.

In this paper, we fill this gap by introducing CusADi2, a software library for low-latency batched evaluation of dynamical system functions on the GPU. To be broadly applicable in online planning, CusADi2 supports not only forward kinematics but also Jacobians and Hessians. It exploits the structure of each function's computational graph to parallelize its evaluation. Two further optimizations reuse one schedule across trajectory stages and group same-type operations, which GPUs execute more efficiently. It thus achieves lower latency than prior methods such as MuJoCo.

1^{1}J. Viljoen, L. Peters, M. Tomizuka, and N. Mehr are with the Department of Mechanical Engineering, University of California, Berkeley, CA, USA. {john_viljoen, lasse.peters, tomizuka, negar}@berkeley.edu

This work has been submitted to the IEEE for possible publication. Copyright may be transferred without notice, after which this version may no longer be accessible.

Warp [7], MuJoCo XLA [6], and CusADi [9]. For 256 forward kinematics evaluations, existing GPU frameworks need at least 100 μ\mus on nearly every MuJoCo Menagerie [10] robot, whereas CusADi2 needs under 40 μ\mus on common platforms (Figure 1). Across all 67 robots, from dexterous hands to humanoids, this advantage is largest for batches of 64 to 4096, with no throughput loss beyond. Finally, we demonstrate a 50 Hz safe sampling-based planner for a Franka Panda arm, with a Higher-Order Control Barrier Function (HOCBF) [11] safety filter per sampled trajectory.

References (26)