File size: 1,179 Bytes
4b7148d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""GIF: fallen flat (legs folded) -> legs up -> over to the V/bridge -> close the V. Shows what actually happens."""
import math
import v_liedown  # noqa: F401
from v_liedown import M, TarsSim, s_curve
from render2 import Recorder
from confirm_all import SC09

def quat_x(deg):
    a = math.radians(deg) / 2
    return [math.cos(a), math.sin(a), 0, 0]

for face, sign, name in (("front", +1, "fall_attempt_A"), ("front", -1, "fall_attempt_B")):
    p = M.Params(mu=0.8, **SC09); s = TarsSim(p)
    s.d.qpos[3:7] = quat_x(90 if face == "front" else -90); s.d.qpos[2] = p.D / 2 + 0.002
    rec = Recorder(s, [("side view", 0, -6, 0.8), ("3/4 view", 135, -18, 0.85)])
    rec.caption = "1. Fallen flat, legs folded"; s.run(1.0)
    rec.caption = "2. Raise both legs up (90 deg)"; s_curve(s, dict(sL=sign * 90, sR=sign * 90), 2.5); s.run(0.5)
    rec.caption = "3. Keep swinging legs over to make the V (170 deg)"; s_curve(s, dict(sL=sign * 170, sR=sign * 170), 2.5); s.run(0.5)
    rec.caption = "4. Close the V (try to stand up)"; s_curve(s, dict(sL=0, sR=0), 6.0); s.run(1.0)
    rec.save(f"../results/{name}.gif", speedup=2)
    print(name, "final tilt", round(s.tilt_deg(), 1))