Tin

Examples · mujoco · 327 of 339

wave

The same wave as examples/robots/wave.tin, in real physics: one word picks the world.

examples/mujoco/wave.tintin run examples/mujoco/wave.tin
// The same wave as examples/robots/wave.tin, in real physics: one word picks the world.
// MuJoCo (Google DeepMind's WebAssembly build) loads on first use, and the SO-101's model files
// come from MuJoCo Menagerie, checked by hash. In the playground the canvas shows it live.
robot Arm = so101 { world: mujoco }

fn wave(o: Observation): Option<Pose> => Some(Pose { shoulder_pan: 0.5rad * sin(o.t / 1s * 2.0), elbow_flex: -0.6rad })

fn main() {
  var arm = Arm()
  let r = arm.run(policy(wave), 4s, 50Hz)
  let o = arm.observe()
  print("{r.steps} steps in {o.t}")
  print("shoulder_pan {o.at("shoulder_pan")}, elbow_flex {o.at("elbow_flex")}")
}