Tin

Examples · policies · 334 of 339

walk

A humanoid walking on a learned policy: the holosoma ONNX checkpoint on the Unitree G1, in MuJoCo.

examples/policies/walk.tintin run examples/policies/walk.tin
// A humanoid walking on a learned policy: the holosoma ONNX checkpoint on the Unitree G1, in MuJoCo.
// The weights download once from the publisher's Hugging Face repo at a pinned commit and must hash to
// the pinned SHA-256; they are never bundled. Needs the optional onnxruntime-node and @mujoco/mujoco.
robot Body = g1 { world: mujoco }

fn main() {
  var g1 = Body()
  let start = g1.base().unwrap()
  let stand = g1.run(onnx("holosoma"), 2s, 50Hz)
  let r = g1.run(onnx("holosoma?vx=0.5"), 8s, 50Hz)
  let b = g1.base().unwrap()
  print("stood {stand.steps} ticks, walked {r.steps} ticks, stopped by {r.stoppedBy}")
  print("pelvis at {round(b.z * 100.0) / 100.0} m, {round((b.x - start.x) * 10.0) / 10.0} m forward")
}