State authority と concurrency
MuJoCo の active mjData を複数 thread から自由に読む設計にすると、read-only access でも physics update と競合して coherent snapshot を保証できません。
Fibril Simulation は active state の owner を一つに固定し、owner thread 外には copied value または ingress API だけを渡します。
Execution owner の責務
SimulationInstance を作った thread が active state の execution owner です。
step()、snapshot capture、state injection、owner-only drain API などはこの ownership を前提にします。
ROS callback や renderer worker が active mjData を直接参照する API は public boundary に置きません。
必要な state は immutable copy を渡します。
ExternalInput mailbox の扱い
外部 thread からの入力は enqueue_external_input() で mailbox に入れます。
enqueue は thread-safe ですが、その時点で controller-visible state は変わりません。
ExternalInputCommit の開始時に accepted ingress set を cut し、その cut に入った input だけを current boundary の候補にします。
cut 後に producer が enqueue した input は次以降の boundary に残ります。
ordering key は effective time、source ID、source sequence、run-unique acceptance sequence を含みます。 recorded replay でも acceptance identity と commit tick を保持するため、単なる arrival order の再現より強い causal contract を持ちます。
Read-only view と immutable snapshot
SimulationSnapshot は qpos、qvel、sensordata を active state から copy した value object です。
owner thread 外へ state を渡す場合や、呼び出し後も state を保持する場合に使います。
Interaction と Observer は SimulationInstance::step() の owner thread 上で同期実行されるため、completed boundary の const mjModel と const mjData を参照する MujocoReadView を受け取ります。
この view は callback 中だけ有効な non-owning read-only view であり、mutable mjData を公開せずに per-step の full-state copy を避けます。
renderer も同じ原則に従います。
fibril_sim/rendered_camera は private copied mjData で offscreen rendering を行い、owner-thread state を rendering context に貸し出しません。
StateClaim の用途
StateClaim は complete logical resource に対する continuous authority を表します。
baseline の resource は JointKinematics、MocapPose、ActuatorActivation です。
現在の Manifest schema 3.3 では利用者が StateClaim を低レベル field として直接列挙しません。
PrescribedState runtime など、authority を実際に実装する capability が claim を生成します。
この制約は metadata だけで authority を宣言することを防ぎます。 claim が存在するなら、その enforcement mechanism も construction で検証できなければなりません。
Prescribed mocap state の扱い
baseline の continuous prescribed authority は MuJoCo mocap body を使います。
physics interval の開始側で t の pose を確立し、integration 後には t + dt の authoritative pose を再確立してから P_(n+1) snapshot を公開します。
このため prescribed source に接続された physical child は motion に反応できますが、completed boundary の prescribed source 自体は一 tick 遅れません。
PreStepOverwrite のように dynamic state を毎 step 書き潰すだけの方式は baseline authority として受理しません。
KinematicModelVariant は equivalent one-way enforcement を construction が証明できる capability が実装されるまで schema-level promise にしません。
State injection の制約
diagnostic 用の instantaneous injection は joint_kinematics、mocap_pose、actuator_activation の complete logical resource を対象にします。
write 後は MuJoCo derived state を再計算し、coherent snapshot を返します。
MujocoPhysicsStateSnapshot は mj_getState と mj_setState を使って qpos、qvel、actuator activation を扱いますが、Fibril Simulation runtime checkpoint ではありません。
clock、Device/ActuatorDriver queue、committed ingress、domain state、RNG、trace state は保存も rewind もしません。