mujoco_set_state
Set specific physics quantities (qpos, qvel, ctrl, time) in a MuJoCo session, then update derived values so body poses and sensors match. Use it to define initial conditions or restore states for visual replay.
Instructions
Overwrite parts of a session's state (qpos, qvel, ctrl, time), then recompute derived quantities.
Only provided fields change. Runs mj_forward so sensors/body poses reflect the new state
without advancing time. Returns the resulting state JSON. Useful for setting initial
conditions or visual replay. Use snapshots, not rounded state views, for exact continuation.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"session_id": "<session_id>"
},
"name": "mujoco_set_state"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ctrl | No | Actuator controls: full vector in actuator order, or {actuator_name: value} for a subset. Persists on the session until changed. | |
| qpos | No | Full generalized positions, length nq; free-joint quaternions must be unit norm | |
| qvel | No | Full generalized velocities, length nv | |
| time | No | Override simulation clock (seconds) | |
| precision | No | Decimal places for returned floats | |
| session_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |