MuJoCo API

simkit.simulators.mujoco.scene_composer provides the repository’s MuJoCo scene composition entrypoint and its main adapter classes.

Repository entrypoints for MuJoCo scene composition.

class simkit.simulators.mujoco.scene_composer.BodyAdapter(raw_body)[source][source]

Bases: object

Small adapter exposing stable body geometry counts for tests.

property geoms

Return the body’s geoms.

property ngeom

Return the number of geoms attached to this body.

class simkit.simulators.mujoco.scene_composer.SceneComposer(menagerie_path=None)[source][source]

Bases: object

Compose MuJoCo scenes from repository assets and optional Menagerie models.

add_g1_robot(position, name)[source][source]

Add a G1 robot to the scene by incorporating it directly

Parameters:
  • position – [x, y, z] position for the robot

  • name – Optional name for the robot

Returns:

The robot body object

add_ground(size=10, rgba=None)[source][source]

Add ground plane to the scene

Parameters:
  • size – Size of the ground plane

  • rgba – Color [r, g, b, alpha], defaults to gray

create_scene(robot_positions=None)[source][source]

Create and compile a scene with a ground plane and one or more robots.

Parameters:

robot_positions – Optional list of [x, y, z] robot base positions.

Returns:

A compiled mujoco.MjModel.

load_g1_robot()[source][source]

Load G1 robot model from MuJoCo Menagerie

Returns:

MjSpec object containing the G1 robot

save_scene(filename)[source][source]

Save the scene to an XML file

Parameters:

filename – Output XML filename

simulate(duration=10.0, render=True)[source][source]

Run simulation

Parameters:
  • duration – Simulation duration in seconds

  • render – Whether to render the simulation

view_scene(duration=None)[source][source]

View the scene using MuJoCo viewer

Parameters:

duration – Optional duration to run viewer (None = run until closed)

view_scene_interactive()[source][source]

View scene with interactive controls and key bindings

class simkit.simulators.mujoco.scene_composer.SpecAdapter(raw_spec)[source][source]

Bases: object

Small adapter exposing stable spec counts for tests.

property nbody

Return the number of bodies currently in the spec.

property ngeom

Return the number of geoms currently in the spec.

simkit.simulators.mujoco.scene_composer.main()[source][source]

Main function to demonstrate scene composition