Skip to content

Bind the batched simulation API from mjbatch.h - #19

Merged
jcant0n merged 1 commit into
mainfrom
feat/mjbatch
Dec 2, 2026
Merged

jcant0n merged 1 commit into
mainfrom
feat/mjbatch

Conversation

@jcant0n

@jcant0n jcant0n commented Dec 2, 2026

Copy link
Copy Markdown
Member

Adds the 25 mjb_* functions of MuJoCo's batch API (many simulations of one model on a thread pool), plus mjBatchConfig, mjBatchRecord, the opaque mjBatch handle and the mjfBatchFunc delegate.

Changes

  • mujoco_capi.h includes mujoco/mjbatch.h. mujoco.h does not include it, so the generator never reached it.
  • Generator change: mjBatch is the first struct MuJoCo only forward-declares. CppAst gives such a struct no source location and lists it only as the element of its typedef, so it was filtered out and every mjBatch* failed to compile. GenerateStructs now emits forward-declared structs reached through a MuJoCo typedef as empty structs.
  • Test runs the same drop as four simulations on two threads and checks each lands where the single mjData did.

API delta

Additive only: no existing line of Generated/ changes.

Verification

  • All four native libraries in runtimes/ contain the 25 mjb_* symbol names.
  • Test passes on win-x64, including the new batch checks. LowLevelDemo builds.
  • Not run on Linux or macOS.

After merging

CD will publish on its own, since the generated code changed: either dispatch it or wait for Monday's scheduled run.

mujoco.h does not include mjbatch.h, so the translation unit now does. mjBatch is the first struct MuJoCo only forward-declares; the generator emits it as an empty struct.
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

API gate: additive

Every symbol that existed still exists, unchanged. Nothing that compiled before stops compiling.

Target framework Added Removed
net10.0 +38 -0

Enum and constant values are part of the measured surface: a renumbering keeps compiling and sends the wrong number to the driver, so it counts as a removal.

@jcant0n
jcant0n merged commit 14996fd into main Dec 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant