#3597·mujoco

Delayed multi-input actuators use uninitialized control slots

Author: peachtree0222Created Sep 15, 2026Updated Sep 15, 2026
Labelsbug

Intro

Hi!

I am testing the interaction between current multi-input actuators and actuator history/delay. The control-history path remains scalar and leaves the remaining inputs of a delayed actuator uninitialized.

My setup

  • MuJoCo source build from main at 10124d5d9dca411ec3c8988aa1e3b619103d71bb
  • C API, double precision
  • Ubuntu 24.04.5 LTS, Linux 7.0.0-28-generic x86_64
  • CMake 3.28.3 and GCC 11.5.0

What's happening? What did you expect?

A PID actuator with input="pos vel ff" owns three control values. With live controls [1, 2, 3], its force is 6. I expected the delayed path to record and later use the same complete control block.

Actuator history allocation, insertion, mj_readCtrl, and mj_initCtrlHistory are hard-coded to dimension one. During actuation, a local array of all nu controls is allocated, but a delayed actuator assigns only ctrl[adr]. The remaining two slots are consumed by the PID gain without initialization.

The minimal reproduction reuses MuJoCo's stack allocation with canaries so the omitted slots are deterministic:

nu=3 delayed-force=501.0 direct-force=6.0

The delayed path uses the recorded first input 1 plus stale stack values 200 and 300. Disabling only delay uses the live complete block and produces 6.

Relevant source and documentation:

Steps for reproduction

  1. Check out and build the commit above.
  2. Compile poc/reproducer.cc using poc/README.md.
  3. Run it and compare delayed force with the direct-control causal control.

Reproduction package:

multi-input-actuator-delay-history-poc.zip

Minimal model for reproduction

The complete MJCF is embedded in the C++ file and contains one slider, one sphere, and one delayed three-input PID. No assets are required.

Code required for reproduction

See poc/reproducer.cc. A complete patch needs a block-aware history layout and API decision, so I have included a fix design rather than a partial one-line change.

Confirmations