tars-mini / sim /render_v.py
tuanhqv123's picture
TARS mini: CAD, MuJoCo sim, trained policies and 5-action demo
4b7148d verified
Raw History Blame Contribute Delete
892 Bytes
"""GIF: inverted-V lie-down -> power off -> stand up -> walk."""
import v_liedown # noqa: F401 (patches leg range to 200 deg)
from v_liedown import M, TarsSim, s_curve
from render2 import Recorder
from cpg_gait import cpg_walk
s = TarsSim(M.Params(mu=0.8, cells=0.046, ups=0.013))
rec = Recorder(s, [("side view", 0, -6, 0.75), ("3/4 view", 135, -18, 0.8)])
rec.caption = "1. Standing"; s.run(1.0)
rec.caption = "2. Lying down: inverted-V opens slowly (8 s)"; s_curve(s, dict(sL=170, sR=170), 8.0); s.run(0.5)
rec.caption = "3. Lying FLAT - power OFF"; s.limp = True; s.run(3.0); s.limp = False
rec.caption = "4. Power ON - closing the V: standing up (8 s)"; s_curve(s, dict(sL=0, sR=0), 8.0); s.run(0.8)
rec.caption = "5. Standing - walking"; cpg_walk(s, T=1.4, cycles=3); s.run(0.5)
rec.save("../results/lie_flat_and_stand_up.gif", speedup=2)
print("final tilt", round(s.tilt_deg(), 1))