File size: 1,203 Bytes
4b7148d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Final demo GIF, ST3215 build: walk, turn left, turn right, lie down (V + fold legs over), stand up (unfold + close V)."""
import full360  # noqa: F401  (360-deg legs)
from full360 import M, TarsSim, s_curve
from render2 import Recorder
from cpg_gait import cpg_walk
from tarsai_gaits import turn_left, turn_right
from st3215_tune import ST

s = TarsSim(M.Params(mu=0.8, **ST))
rec = Recorder(s, [("3/4 view", 135, -18, 0.95), ("side view", 0, -6, 0.95)])
rec.caption = "1. Walk"; s.run(0.5); cpg_walk(s, T=2.8, 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, then 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), 4.0); s.run(0.8)
rec.caption = "5. Stand up: legs back over the top, then close the V"; s_curve(s, dict(sL=170, sR=170), 4.0); s_curve(s, dict(sL=0, sR=0), 6.0); s.run(0.5)
rec.caption = "Walk again"; cpg_walk(s, T=2.8, cycles=1); s.run(0.5)
rec.save("../results/final_5_actions.gif", speedup=3)
print("final tilt", round(s.tilt_deg(), 1), "| sim time", round(s.d.time, 1), "s")