MuJoCo Physics & Terrain System
MH-FLOCKE uses MuJoCo for physics simulation. The Unitree Go2 model comes from the MuJoCo Menagerie. Terrain, balls, and scent sources are injected into the scene based on the natural language task description.
MuJoCoWorld
Wrapper around MuJoCo that handles: MJCF loading (from XML path or string), sensor extraction (position, velocity, orientation, joint angles/velocities), actuator control, and physics stepping.
Terrain System
Heightfield generation supports multiple types:
- Flat — No heightfield (default for ball scenes)
- Hills — Perlin noise with configurable amplitude and frequency
- Steps — Discrete height changes for stair climbing
- Mixed — Combination terrain for robustness training
Ball Injection
Ball scenes inject a sphere at a specified distance and angle offset. The ball is a free-body with friction — it moves when touched. Ball position is tracked every 10 steps in FLOG creature frames.
Sensory Environment
Optional olfactory and auditory channels: scent sources with position/strength/decay, sound events with direction/intensity. Currently used for drive computation (smell_strength feeds into exploration drive).
API Reference
MuJoCoWorld(render=False)
load_from_xml_path(path) / load_from_xml_string(xml)
get_sensor_data(body_name) → dict
Returns position, velocity, orientation_euler, height, upright, forward_velocity, joint_angles, joint_velocities, angular_velocity.