tars-mini / sim /render_b.py
tuanhqv123's picture
TARS mini: CAD, MuJoCo sim, trained policies and 5-action demo
4b7148d verified
Raw History Blame Contribute Delete
1.05 kB
"""Final demo GIF for design B: 2x ST3215-7.4V (legs, 360 deg) + 2x MG90S (height), 5 V, 1x18650."""
from cheap_designs import M, TarsSim, s_curve, cpg_walk, turn_left, turn_right, DESIGNS
from render2 import Recorder
s = TarsSim(M.Params(mu=0.8, **DESIGNS["B"]))
rec = Recorder(s, [("3/4 view", 135, -18, 0.95), ("side view", 0, -6, 0.95)])
rec.caption = "Design B ($78): 1. Walk"; s.run(0.5); cpg_walk(s, T=2.4, cycles=2)
rec.caption = "2. Turn left"; turn_left(s); turn_left(s)
rec.caption = "3. Turn right"; turn_right(s); turn_right(s)
rec.caption = "4. Lie down: open the V, fold legs over the top"; s.ramp(1.0, hL=0.0, hR=0.0); s.run(0.3)
s_curve(s, dict(sL=170, sR=170), 6.0); s_curve(s, dict(sL=360, sR=360), 5.0); s.run(0.8)
rec.caption = "5. Stand up: legs back over the top, close the V"; s_curve(s, dict(sL=170, sR=170), 5.0); s_curve(s, dict(sL=0, sR=0), 6.0); s.run(0.5)
rec.caption = "Walk again"; cpg_walk(s, T=2.4, cycles=1); s.run(0.5)
rec.save("../results/final_design_B.gif", speedup=3)
print("final tilt", round(s.tilt_deg(), 1))