How to use
- Copy the installation command and review the source package before installing it in your own agent environment.
- Check the source document for required tools, credentials and supported hosts.
- Describe your input and desired deliverable; review the output against the source material.
npx skills add https://github.com/google-deepmind/robotics-antigravity-plugin --skill mujoco-playground-rlBefore you start
- Installation does not include a model subscription, API allowance or permission to access your files.
- Repository stars and installation counts describe activity, not an independent quality or security test.
Rendered from the source repository. Headings, examples, code, tables, links, and referenced images are preserved.
MuJoCo Playground RL Task Authoring & Training (`rl_task_check.py`)
Create, interactively verify in MuJoCo Studio, audit, train (Impl.WARP + RSL-RL), and deploy new RL tasks on any mujoco_menagerie robot (floating-base quadrupeds/humanoids or fixed-base arms) in mujoco_playground:
- Workspace & Accelerator Setup:
- Clone and sync:
git clone https://github.com/google-deepmind/mujoco_playground.git && cd mujoco_playground && make sync(ormake sync-cu12on Linux CUDA 12 drivers< 580, ormake sync-cpuon macOS for authoring, Studio inspection, CPU smoke tests, and checkpoint playback; pass--default-index https://pypi.org/simpletouvand--no-synctouv run).
- Robot Scene, MuJoCo Studio Inspection, & `DeviceLayer` (`mujoco_playground/robots/<robot>/sim/{device,scene}.py`):
- Load
spec = asset.get("github:google-deepmind/mujoco_menagerie/<dir>/<file>.xml").spec(). Name unnamed geoms (f"{body.name}_geom_{i}"), ensure any freejoint is named ("root"), add a"terrain"plane geom onworldbodyif absent, setspec.option.timestep = 0.004(control_timestep = 0.02,decimation = 5) andmjINT_IMPLICITFAST, and sizecfg.sim.nconmax/cfg.sim.njmax(tolerance = 1e-8,ls_tolerance = 0.01, keeping default solver iteration caps). - Replace torque
<motor>s with PD position servos (for a in list(spec.actuators): spec.delete(a),add_actuator(name=j, target=j)withtrntype=mjTRN_JOINT,gaintype=mjGAIN_FIXED,biastype=mjBIAS_AFFINE,gainprm[0]=kp,biasprm[1]=-kp,biasprm[2]=-kd,ctrllimited=False,forcelimited=True,forcerange=[-effort, effort]; e.g.kp=25.0, kd=0.5, armature=0.01for quadrupeds), lower high passive torque-model jointdamping/frictionloss(e.g.damping=0.1, frictionloss=0.0), filter self-collisions viacontype/conaffinitybitmasks, and add an"init_state"standing keyframe. - **Interactive Studio Verification (
mujoco-studio-sidecar+
mujoco-studio): Load mujoco-studio-sidecar and mujoco-studio** to inspect and hot-reload the robot MjSpec (publishing the spec from SimPlugin.on_load_model in <workspace_dir>/sim_plugin.py, checking standing keyframe stability, PD gains, contacts, and custom ViewerPlugins) in [MuJoCo Studio](sidecar://robotics/mujoco_studio/) by launching <mujoco-studio-sidecar>/scripts/studiod.py --workspace_dir=<dir> with <playground_dir>/.venv/bin/python (IsDaemon: true, checking /_studio/status after edits) before batch training.
- Wire
reaf.simulation.torch(reaf_sim) devices viaflat_scene.Component(never passname=,nworld=, orxpu_device=): reaf_sim.ActuatorDevice(targets=list(JOINT_NAMES), measurements=["joint_pos", "joint_vel"])("robot"->"robot/ctrl","robot/joint_pos","robot/joint_vel").- Floating base:
reaf_sim.FreeDevice(body_name="base", joint_name="root", measurements=["xpos", "xquat", "joint_vel"])("base"->"base/xpos","base/xquat"[w,x,y,z], and"base/joint_vel"where[:, :3]is world linear velocity ->reaf_sim.math.quat_rotate_inverse(quat, vel[:, :3]), while[:, 3:6]is already body-frame angular velocity). - Contacts:
flat_scene.Component(reaf_sim.ContactSensorDevice, fields=("found", "force"), history_length=decimation).configure_spec(objtype="geom", objname=..., reftype="geom", refname="terrain")on feet and body/limb geoms.
- Sync-Free `TaskLayer` (`mujoco_playground/tasks/<category>/<task>/{task,mdp}.py`):
- Actions:
command_feature_producers={"action_history": flat_scene.Component(reaf_sim.ActionHistory, key="action", feature_shape=(num_joints,), history_length=1)}(f["action"]isa_t,f["action_history"][:, 0]isa_{t-1}) andcommand_processors={"action_scale": flat_scene.Component(reaf_sim.TransformActions, input_key="action", output_key="robot/ctrl", scale=0.25, offset=DEFAULT_JOINT_POS)}. - Stateful Producers & Observations: Subclass
reaf_sim.FeatureProducerimplementingname,produced_features_spec(per-world shapes withoutnworld),required_features_keys(consume"time"and step timers bydt = (t - self._last_time).clamp(min=0.0)so partial resets are idempotent),produce_features, andreset; wrap reward/critic-only producers with.mark_privileged()somake_deployment_configprunes them. - Sync-Free GPU Rules: Never call
.item(),.cpu(),.numpy(),.new_tensor(),bool(),.any(), or.all()insidestep/obs_*/reward_*; build gravity viag = torch.zeros((n, 3), device=q.device, dtype=q.dtype); g[:, 2] = -1.0and cache CPUflat_scene.Obstensor kwargs per(device, dtype). ConfigureObsGroups ("policy"noisy,"critic"clean) with.configure(output_shape=(D,))on everyflat_scene.Obs(actor: bodyang_vel,projected_gravity,command,joint_pos - default_pos,joint_vel,action; critic adds bodylin_vel). - Rewards, Terminations, & Reset: Combine
exp(-||v_xy - cmd_xy||^2 / 0.25)(1.5),exp(-(w_z - cmd_wz)^2 / 0.25)(0.75),v_z^2(-2.0),||w_xy||^2(-0.05),||g_proj_xy||^2(-2.5),||a_t - a_{t-1}||^2(-0.01),||qvel||^2(-1e-4), stand-still||q - q_def||_1 * (||cmd|| < 0.05)(-0.5), and undesired contacts (-1.0);FunctionalRewardProvidermultiplies terms bycontrol_dt, so divide touchdown impulses bycontrol_dt. Terminate on falls (g_proj[:, 2] > -0.3orz < min_z) viatorch.where(..., TerminationResult.TERMINATE, TerminationResult.DO_NOT_TERMINATE), and reset standingqpos/qvelinEnvironmentReset.on_resetviatorch.where(env_mask.unsqueeze(1), ...).
- Register, Validate, Train, Preview in Studio, & Deploy:
- Add an
RslRlOnPolicyRunnerCfgdataclass in_src/rl/rsl_rl/env_rl_config.py(obs_groups={"actor": ["policy"], "critic": ["critic"]},vecenv_wrapper_cfg=RslRlVecEnvWrappercfg(is_finite_horizon=False),nworld=4096,num_steps_per_env=24,actor/critic.hidden_dims=(256, 128, 128),obs_normalization=True) and register an uncalledenv_cfg_fnin_src/rl/env_registry.py. - Audit & smoke-test (CPU +
torch.cuda.set_sync_debug_mode("error")Impl.WARP+make_deployment_config):uv run --no-sync python <skill_dir>/scripts/rl_task_check.py --repo_root=. --task_dir=mujoco_playground/tasks/<category>/<task> --env_id=<EnvId>. - Train & preview in MuJoCo Studio:
WP_CACHE_PATH=/tmp/wp_cache uv run --no-sync python -m mujoco_playground.rl.rsl_rl.train --env=<EnvId> --wp_kernel_cache_dir=/tmp/wp_cache --logdir=/tmp/rslrl_logs/<run>. Preview checkpoints interactively in MuJoCo Studio viauv run --no-sync python -m mujoco_playground.rl.rsl_rl.play --env=<EnvId> --resume_path=... --gfx=web --hot_reload=plugins(or--gfx=""for native desktop Studio, authoring customViewerPlugins permujoco-studio), or deploy withflat_scene.make_deployment_config(cfg, observation_groups=("policy",))+wrapper.TorchDeviceLayerWrapper.