Subagent: Two-handed longsword clips

agent (cont.)

+19:00
  • Bashcd ~/Projects/lowmarch-fable52/tools/whole && python3 - <<'EOF'

    command

    cd ~/Projects/lowmarch-fable52/tools/whole && python3 - <<'EOF'
    import re
    s=open('clips2h.py').read()
    rep=[
    ("poleR=(0.7, -1.0, 0.3), poleL=(-0.8, -1.0, 0.2), gaze=-0.06)","poleR=(1.0, -0.7, 0.25), poleL=(-0.8, -1.0, 0.2), gaze=-0.06)"),
    ("fist=(0.03, -0.20, -0.32), blade=(-0.05, 0.45, -0.89),","fist=(0.05, -0.20, -0.32), blade=(-0.05, 0.45, -0.89),"),
    ("BREATH = dict(drop=0.075, lean=8.5, fist=(0.03, -0.212, -0.315)","BREATH = dict(drop=0.075, lean=8.5, fist=(0.05, -0.212, -0.315)"),
    ("fist=(-0.02, -0.02, -0.52),\n               blade=(-0.30, -0.10, -0.95))","fist=(0.0, -0.02, -0.48),\n               blade=(-0.30, -0.10, -0.95))"),
    ("""(0.62, key(drop=0.12, fwd=0.17, hip=13.0, turn=28.0, lean=16.0, lead=0.30, fist=(-0.14, -0.25, -0.45),""","""(0.62, key(drop=0.12, fwd=0.17, hip=15.0, turn=34.0, lean=16.0, lead=0.30, fist=(-0.08, -0.22, -0.50),"""),
    ("""(0.68, key(drop=0.12, fwd=0.17, hip=14.0, turn=30.0, lean=16.0, lead=0.30, fist=(-0.22, -0.40, -0.28),
                   blade=(-0.55, -0.70, 0.45),""","""(0.68, key(drop=0.12, fwd=0.17, hip=18.0, turn=42.0, lean=16.0, lead=0.30, fist=(-0.12, -0.36, -0.42),
                   blade=(-0.60, -0.70, 0.30),"""),
    ]
    for a,b in rep:
        assert s.count(a)==1,a; s=s.replace(a,b)
    a="""key(drop=0.11, fwd=0.16, hip=12.0, turn=27.0, lean=14.0, lead=0.30, fist=(-0.20, -0.36, -0.30),"""
    assert s.count(a)==2
    s=s.replace(a,"""key(drop=0.11, fwd=0.16, hip=16.0, turn=38.0, lean=14.0, lead=0.30, fist=(-0.11, -0.33, -0.42),""")
    s=s.replace("blade=(-0.55, -0.62, 0.50)","blade=(-0.60, -0.62, 0.36)")
    a="turn=0.0, lean=9.0, lead=0.14, lift=0.04, fist=(-0.06, -0.28, -0.36),"
    assert s.count(a)==1; s=s.replace(a,"turn=10.0, lean=9.0, lead=0.14, lift=0.04, fist=(-0.02, -0.26, -0.40),")
    open('clips2h.py','w').write(s)
    EOF
    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && time OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 timeout 900 python3 t.py attack 2>&1 | cut -c1-260

    result, 72 lines

    solve 9.5s (setup 0.2s)
    wren: 34 keyframes checked; 14 with an arm through the body, 17 with an arm resting on it
      ! wren, attack at 0.32 s: left upper arm 2.7 cm inside the body; left forearm 1.6 cm inside the body
      ! wren, attack at 0.38 s: left upper arm 4.3 cm inside the body; left forearm 1.5 cm inside the body
      ! wren, attack at 0.44 s: left upper arm 4.8 cm inside the body; left forearm 1.6 cm inside the body
      ! wren, attack at 0.59 s: left upper arm 2.5 cm inside the body
      ! wren, attack at 0.62 s: left upper arm 3.6 cm inside the body; right upper arm 1.3 cm from the body
      ! wren, attack at 0.65 s: left upper arm 5.7 cm inside the body; right upper arm 0.1 cm from the body; left forearm 1.5 cm from the body
      ! wren, attack at 0.68 s: left upper arm 6.7 cm inside the body; right upper arm 0.6 cm inside the body; left forearm 0.3 cm inside the body
      ! wren, attack at 0.78 s: left upper arm 6.9 cm inside the body; right upper arm 1.0 cm inside the body; left forearm 0.4 cm inside the body
      ! wren, attack at 0.90 s: left upper arm 6.6 cm inside the body; right upper arm 1.1 cm inside the body; left forearm 0.1 cm from the body
      ! wren, attack at 1.05 s: left upper arm 6.6 cm inside the body; right upper arm 1.1 cm inside the body; left forearm 0.1 cm from the body
      ! wren, attack at 1.15 s: left upper arm 6.9 cm inside the body; right upper arm 1.9 cm inside the body
      ! wren, attack at 1.25 s: left upper arm 3.1 cm inside the body; right upper arm 3.0 cm inside the body
      ! wren, attack at 1.35 s: right upper arm 2.7 cm inside the body; left upper arm 0.5 cm inside the body
      ! wren, attack at 1.42 s: right upper arm 1.4 cm inside the body; left upper arm 1.0 cm from the body
      ~ wren, idle at 0.00 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
      ~ wren, idle at 0.20 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
      ~ wren, idle at 0.40 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
      ~ wren, idle at 0.60 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
      ~ wren, idle at 0.80 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
      ~ wren, idle at 1.00 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
      ~ wren, idle at 1.20 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
      ~ wren, idle at 1.40 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
      ~ wren, idle at 1.60 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
      ~ wren, idle at 1.80 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
      ~ wren, idle at 2.00 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
      ~ wren, attack at 0.00 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
      ~ wren, attack at 0.20 s: left upper arm 1.3 cm from the body
      ~ wren, attack at 0.26 s: left forearm 0.5 cm from the body; left upper arm 0.5 cm from the body
      ~ wren, attack at 0.47 s: left upper arm 0.7 cm inside the body; left forearm 1.3 cm from the body
      ~ wren, attack at 0.56 s: left upper arm 0.0 cm inside the body
      ~ wren, attack at 1.50 s: right upper arm 1.0 cm inside the body; left upper arm 1.4 cm from the body
    idle 0.00 span   9.5 off  0.2 | head/hair: blade  45.7 grip+hands  36.8 forearm  24.3 | paul  33.2 | legs  39.1 | tip y  1.34 | clear R_UpperArm -1.0 | elbow R 130 L 108 | hipext L -35 R -14 | toe y L0.057 R0.036 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [-0.05 
    idle 0.20 span   9.5 off  0.2 | head/hair: blade  45.7 grip+hands  36.8 forearm  24.3 | paul  33.2 | legs  39.1 | tip y  1.35 | clear R_UpperArm -1.0 | elbow R 130 L 108 | hipext L -34 R -14 | toe y L0.057 R0.036 ank L0.113 | gaze [-0.   -0.06 -1.  ] d [-0.05 
    idle 0.40 span   9.5 off  0.2 | head/hair: blade  45.6 grip+hands  37.0 forearm  24.6 | paul  33.1 | legs  39.2 | tip y  1.36 | clear R_UpperArm -1.0 | elbow R 130 L 108 | hipext L -33 R -12 | toe y L0.057 R0.036 ank L0.113 | gaze [-0.   -0.06 -1.  ] d [-0.05 
    idle 0.60 span   9.5 off  0.2 | head/hair: blade  45.4 grip+hands  37.4 forearm  24.9 | paul  33.0 | legs  39.4 | tip y  1.39 | clear R_UpperArm -1.0 | elbow R 130 L 108 | hipext L -31 R -11 | toe y L0.057 R0.036 ank L0.113 | gaze [-0.   -0.06 -1.  ] d [-0.05 
    idle 0.80 span   9.5 off  0.2 | head/hair: blade  45.2 grip+hands  37.8 forearm  25.1 | paul  32.9 | legs  39.6 | tip y  1.41 | clear R_UpperArm -1.0 | elbow R 129 L 108 | hipext L -30 R  -9 | toe y L0.057 R0.036 ank L0.113 | gaze [-0.   -0.06 -1.  ] d [-0.05 
    idle 1.00 span   9.5 off  0.2 | head/hair: blade  45.2 grip+hands  37.8 forearm  25.1 | paul  32.9 | legs  39.6 | tip y  1.42 | clear R_UpperArm -1.0 | elbow R 129 L 108 | hipext L -30 R  -9 | toe y L0.057 R0.036 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [-0.05 
    idle 1.20 span   9.5 off  0.2 | head/hair: blade  45.2 grip+hands  37.8 forearm  25.1 | paul  33.0 | legs  39.6 | tip y  1.42 | clear R_UpperArm -1.0 | elbow R 129 L 108 | hipext L -30 R  -9 | toe y L0.057 R0.036 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [-0.05 
    idle 1.40 span   9.5 off  0.2 | head/hair: blade  45.3 grip+hands  37.3 forearm  24.5 | paul  33.1 | legs  39.3 | tip y  1.39 | clear R_UpperArm -1.0 | elbow R 130 L 109 | hipext L -33 R -12 | toe y L0.057 R0.036 ank L0.113 | gaze [-0.   -0.06 -1.  ] d [-0.05 
    idle 1.60 span   9.5 off  0.2 | head/hair: blade  45.6 grip+hands  36.9 forearm  24.3 | paul  33.2 | legs  39.1 | tip y  1.35 | clear R_UpperArm -1.0 | elbow R 130 L 108 | hipext L -35 R -14 | toe y L0.057 R0.036 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [-0.05 
    idle 1.80 span   9.5 off  0.2 | head/hair: blade  45.7 grip+hands  36.8 forearm  24.3 | paul  33.2 | legs  39.1 | tip y  1.34 | clear R_UpperArm -1.0 | elbow R 130 L 108 | hipext L -35 R -14 | toe y L0.057 R0.036 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [-0.05 
    idle 2.00 span   9.5 off  0.2 | head/hair: blade  45.7 grip+hands  36.8 forearm  24.3 | paul  33.2 | legs  39.1 | tip y  1.34 | clear R_UpperArm -1.0 | elbow R 130 L 108 | hipext L -35 R -14 | toe y L0.057 R0.036 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [-0.05 
    attack 0.00 span   9.5 off  0.2 | head/hair: blade  45.7 grip+hands  36.8 forearm  24.3 | paul  33.2 | legs  39.1 | tip y  1.34 | clear R_UpperArm -1.0 | elbow R 130 L 108 | hipext L -35 R -14 | toe y L0.057 R0.036 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [-0.0
    attack 0.10 span   9.5 off  0.2 | head/hair: blade  35.6 grip+hands  35.3 forearm  22.7 | paul  28.0 | legs  41.1 | tip y  1.72 | clear L_UpperArm  1.6 | elbow R 103 L  99 | hipext L -32 R -13 | toe y L0.057 R0.036 ank L0.113 | gaze [-0.   -0.06 -1.  ] d [ 0.0
    attack 0.20 span   9.5 off  0.0 | head/hair: blade  15.5 grip+hands  19.6 forearm  18.6 | paul  19.0 | legs  47.4 | tip y  2.08 | clear L_UpperArm  1.3 | elbow R  70 L  79 | hipext L -28 R -12 | toe y L0.057 R0.036 ank L0.113 | gaze [-0.   -0.06 -1.  ] d [ 0.1
    attack 0.26 span   9.5 off  0.1 | head/hair: blade  11.7 grip+hands  13.4 forearm  17.1 | paul  17.5 | legs  48.8 | tip y  2.09 | clear L_LowerArm  0.5 | elbow R  54 L  66 | hipext L -26 R -14 | toe y L0.057 R0.036 ank L0.113 | gaze [-0.   -0.06 -1.  ] d [0.23
    attack 0.32 span   9.5 off  0.1 | head/hair: blade  10.8 grip+hands  10.9 forearm  15.7 | paul  19.8 | legs  50.8 | tip y  1.92 | clear L_UpperArm -2.7 | elbow R  48 L  61 | hipext L -26 R -16 | toe y L0.057 R0.036 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [0.3 
    attack 0.38 span   9.5 off  0.1 | head/hair: blade  10.7 grip+hands   9.9 forearm  14.8 | paul  19.2 | legs  51.5 | tip y  1.83 | clear L_UpperArm -4.3 | elbow R  46 L  61 | hipext L -26 R -18 | toe y L0.057 R0.036 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [0.32
    attack 0.44 span   9.5 off  0.1 | head/hair: blade  10.6 grip+hands   9.2 forearm  14.5 | paul  18.8 | legs  51.3 | tip y  1.79 | clear L_UpperArm -4.8 | elbow R  46 L  60 | hipext L -26 R -18 | toe y L0.057 R0.036 ank L0.113 | gaze [-0.   -0.06 -1.  ] d [0.32
    attack 0.47 span   9.5 off  0.1 | head/hair: blade  13.2 grip+hands  12.1 forearm  20.0 | paul  18.1 | legs  57.2 | tip y  2.13 | clear L_UpperArm -0.7 | elbow R  52 L  62 | hipext L -39 R -11 | toe y L0.087 R0.036 ank L0.143 | gaze [-0.   -0.06 -1.  ] d [0.32
    attack 0.50 span   9.5 off  0.1 | head/hair: blade  23.8 grip+hands  20.3 forearm  28.3 | paul  22.3 | legs  65.3 | tip y  2.15 | clear L_UpperArm  1.7 | elbow R  77 L  81 | hipext L -51 R   6 | toe y L0.117 R0.036 ank L0.173 | gaze [-0.   -0.06 -1.  ] d [ 0.1
    attack 0.53 span   9.5 off  0.0 | head/hair: blade  37.3 grip+hands  24.9 forearm  24.8 | paul  23.0 | legs  65.2 | tip y  1.70 | clear L_UpperArm  1.5 | elbow R 104 L 102 | hipext L -53 R  15 | toe y L0.091 R0.036 ank L0.147 | gaze [ 0.   -0.06 -1.  ] d [-0.0
    attack 0.56 span   9.5 off  0.0 | head/hair: blade  48.8 grip+hands  29.2 forearm  19.4 | paul  22.3 | legs  63.2 | tip y  1.02 | clear L_UpperArm -0.0 | elbow R 142 L 138 | hipext L -50 R  22 | toe y L0.057 R0.040 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [-0.3
    attack 0.59 span  10.1 off  0.4 | head/hair: blade  54.5 grip+hands  33.9 forearm  17.4 | paul  26.2 | legs  56.3 | tip y  0.67 | clear L_UpperArm -2.5 | elbow R 178 L 178 | hipext L -51 R  23 | toe y L0.054 R0.042 ank L0.110 | gaze [ 0.   -0.06 -1.  ] d [-0.4
    attack 0.62 span  10.3 off  0.7 | head/hair: blade  57.0 grip+hands  36.0 forearm  19.7 | paul  34.5 | legs  45.0 | tip y  0.39 | clear L_UpperArm -3.6 | elbow R 178 L 178 | hipext L -54 R  23 | toe y L0.057 R0.041 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [-0.5
    attack 0.65 span  10.6 off  2.6 | head/hair: blade  56.1 grip+hands  37.3 forearm  21.2 | paul  43.1 | legs  29.8 | tip y  0.15 | clear L_UpperArm -5.7 | elbow R 178 L 178 | hipext L -54 R  23 | toe y L0.057 R0.042 ank L0.113 | gaze [-0.   -0.06 -1.  ] d [-0.6
    attack 0.68 span   9.9 off  5.7 | head/hair: blade  51.7 grip+hands  38.2 forearm  21.2 | paul  48.4 | legs  17.1 | tip y  0.14 | clear L_UpperArm -6.7 | elbow R 178 L 178 | hipext L -53 R  23 | toe y L0.057 R0.043 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [-0.6
    attack 0.78 span   9.1 off  6.8 | head/hair: blade  50.5 grip+hands  38.4 forearm  21.6 | paul  46.6 | legs  15.5 | tip y  0.19 | clear L_UpperArm -6.9 | elbow R 178 L 178 | hipext L -51 R  23 | toe y L0.057 R0.044 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [-0.6
    attack 0.90 span   9.0 off  6.5 | head/hair: blade  51.3 grip+hands  38.1 forearm  22.1 | paul  45.6 | legs  18.5 | tip y  0.22 | clear L_UpperArm -6.6 | elbow R 178 L 178 | hipext L -49 R  23 | toe y L0.057 R0.045 ank L0.113 | gaze [-0.   -0.06 -1.  ] d [-0.6
    attack 1.05 span   9.0 off  6.5 | head/hair: blade  51.3 grip+hands  38.1 forearm  22.1 | paul  45.6 | legs  18.5 | tip y  0.22 | clear L_UpperArm -6.6 | elbow R 178 L 178 | hipext L -49 R  23 | toe y L0.057 R0.045 ank L0.113 | gaze [-0.   -0.06 -1.  ] d [-0.6
    attack 1.15 span   9.5 off  0.1 | head/hair: blade  55.1 grip+hands  40.4 forearm  23.7 | paul  43.6 | legs  29.3 | tip y  0.44 | clear L_UpperArm -6.9 | elbow R 178 L 178 | hipext L -52 R  14 | toe y L0.077 R0.036 ank L0.133 | gaze [ 0.   -0.06 -1.  ] d [-0.8
    attack 1.25 span   9.5 off  0.1 | head/hair: blade  54.6 grip+hands  41.9 forearm  23.1 | paul  41.3 | legs  37.0 | tip y  1.02 | clear L_UpperArm -3.1 | elbow R 178 L 140 | hipext L -50 R   0 | toe y L0.097 R0.036 ank L0.153 | gaze [ 0.   -0.06 -1.  ] d [-0.4
    attack 1.35 span   9.5 off  0.1 | head/hair: blade  51.4 grip+hands  40.9 forearm  24.8 | paul  38.8 | legs  38.8 | tip y  1.20 | clear R_UpperArm -2.7 | elbow R 158 L 125 | hipext L -43 R  -8 | toe y L0.083 R0.036 ank L0.139 | gaze [-0.   -0.06 -1.  ] d [-0.2
    attack 1.42 span   9.5 off  0.2 | head/hair: blade  47.6 grip+hands  38.2 forearm  25.7 | paul  34.9 | legs  39.0 | tip y  1.30 | clear R_UpperArm -1.4 | elbow R 137 L 113 | hipext L -38 R -12 | toe y L0.067 R0.036 ank L0.123 | gaze [ 0.   -0.06 -1.  ] d [-0.1
    attack 1.50 span   9.5 off  0.2 | head/hair: blade  45.7 grip+hands  36.8 forearm  24.3 | paul  33.2 | legs  39.1 | tip y  1.34 | clear R_UpperArm -1.0 | elbow R 130 L 108 | hipext L -35 R -14 | toe y L0.057 R0.036 ank L0.113 | gaze [ 0.   -0.06 -1.  ] d [-0.0
    total 14s
    
    real	0m14.432s
    user	0m13.386s
    sys	0m0.370s
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && python3 - <<'EOF'

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && python3 - <<'EOF'
    s=open('t.py').read()
    a='''        print(f"{clip} {t:4.2f} span'''
    b='''        reach = {}
            for s_ in "RL":
                S_ = rig.pos(pose, f"J_Bip_{s_}_UpperArm")
                fp = rig.held(pose, f"J_Bip_{s_}_Hand", P.BUST, f.ref[f"fist_{s_}"])
                reach[s_] = np.linalg.norm(fp - S_)
            cls = " ".join(f"{k[0]}{k[2:5]}{v_ * 100:4.1f}" for k, v_ in cl_.items() if v_ < 0.03)
            if SHORT:
                print(f"{clip} {t:4.2f} span {along * 100:5.1f} off {off * 100:4.1f} | hd {db * 100:4.1f} {dg * 100:4.1f} {da * 100:4.1f} paul {dp * 100:4.1f} legs {dl * 100:4.1f} tip {tip:4.2f} "
                      f"| elb R{elb['R']:4.0f} L{elb['L']:4.0f} reach R{reach['R']:.2f} L{reach['L']:.2f} | hipext R{ext['R']:3.0f} | {cls}")
                continue
            print(f"{clip} {t:4.2f} span'''
    s=s.replace(a,b)
    s=s.replace('import h\n','import h\nSHORT = True\n')
    open('t.py','w').write(s)
    EOF
    grep -n "fist=\|blade=\|key(" ~/Projects/lowmarch-fable52/tools/whole/clips2h.py | head -40

    result, 25 lines

    34:             fist=(0.05, -0.20, -0.32), blade=(-0.05, 0.45, -0.89),
    36:BREATH = dict(drop=0.075, lean=8.5, fist=(0.05, -0.212, -0.315), blade=(-0.05, 0.40, -0.91))   # the low end
    42:def key(**kw):
    48:    (0.0, key(), True),
    49:    (0.2, key(drop=0.065, fwd=-0.02, hip=-26.0, turn=-26.0, lean=3.0, fist=(0.12, -0.04, -0.20),
    50:              blade=(0.12, 0.98, -0.12)), False),
    51:    (0.32, key(drop=0.07, fwd=-0.05, hip=-30.0, turn=-38.0, lean=0.0, fist=(0.20, 0.08, -0.06),
    52:               blade=(0.30, 0.70, 0.65), poleR=(1.0, -0.6, 0.2)), False),
    53:    (0.44, key(drop=0.08, fwd=-0.06, hip=-32.0, turn=-42.0, lean=-1.0, fist=(0.21, 0.10, -0.02),
    54:               blade=(0.32, 0.55, 0.77), poleR=(1.0, -0.6, 0.2)), True),
    55:    (0.5, key(drop=0.08, fwd=0.06, hip=-4.0, turn=-10.0, lean=4.0, lead=0.15, lift=0.06, fist=(0.12, 0.12, -0.30),
    56:              blade=(0.15, 0.90, -0.40)), False),
    57:    (0.56, key(drop=0.11, fwd=0.16, hip=10.0, turn=22.0, lean=14.0, lead=0.30, fist=(0.0, -0.02, -0.48),
    58:               blade=(-0.30, -0.10, -0.95)), False),
    59:    (0.62, key(drop=0.12, fwd=0.17, hip=15.0, turn=34.0, lean=16.0, lead=0.30, fist=(-0.08, -0.22, -0.50),
    60:               blade=(-0.50, -0.55, -0.60)), False),
    61:    (0.68, key(drop=0.12, fwd=0.17, hip=18.0, turn=42.0, lean=16.0, lead=0.30, fist=(-0.12, -0.36, -0.42),
    62:               blade=(-0.60, -0.70, 0.30), poleR=(0.4, -1.0, -0.3)), False),
    63:    (0.9, key(drop=0.11, fwd=0.16, hip=16.0, turn=38.0, lean=14.0, lead=0.30, fist=(-0.11, -0.33, -0.42),
    64:              blade=(-0.60, -0.62, 0.36), poleR=(0.4, -1.0, -0.3)), True),
    65:    (1.05, key(drop=0.11, fwd=0.16, hip=16.0, turn=38.0, lean=14.0, lead=0.30, fist=(-0.11, -0.33, -0.42),
    66:               blade=(-0.60, -0.62, 0.36), poleR=(0.4, -1.0, -0.3)), True),
    67:    (1.25, key(drop=0.08, fwd=0.06, hip=-8.0, turn=10.0, lean=9.0, lead=0.14, lift=0.04, fist=(-0.02, -0.26, -0.40),
    68:               blade=(-0.45, 0.10, -0.85)), False),
    69:    (1.5, key(), True),
  • Write~/Projects/lowmarch-fable52/review/out/whole-clips/shots.sh

    input

    ~/Projects/lowmarch-fable52/review/out/whole-clips/shots.sh
    
    #!/bin/bash
    # build her into the test site, then shoot the given clip:time pairs (default: the contact sheet's eight)
    cd ~/Projects/lowmarch-fable52
    export OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1
    if [ "$NOBUILD" != 1 ]; then
      t0=$(date +%s)
      LOWMARCH_SITE=whole-clips WHOLE_STANCE=longsword python3 tools/whole/build.py arm_f_slender wren 2>&1 | grep -v "^\s*$" | tail -40
      echo "build $(( $(date +%s) - t0 ))s"
    fi
    D=review/out/whole-clips/shots
    TAG=${TAG:-s}
    pairs=${@:-idle:0.0 idle:1.0 attack:0.20 attack:0.38 attack:0.56 attack:0.68 attack:0.90 attack:1.30}
    t0=$(date +%s)
    for p in $pairs; do
      c=${p%%:*}; t=${p##*:}
      python3 - "$c" "$t" "$D/${TAG}_${c}_${t}.json" <<'EOF'
    import json, sys, os
    s = json.load(open('tools/whole/frame.json'))
    s.update(w=960, h=540, scale=1)
    s['clips'] = {"wren": [sys.argv[1], float(sys.argv[2])], "mob_soldier": ["idle", 0.0]}
    for k, v in json.loads(os.environ.get("SPEC", "{}")).items():
        s[k] = v
    json.dump(s, open(sys.argv[3], 'w'), indent=1)
    EOF
      WHOLE_SITE=$PWD/review/out/whole-clips/site python3 tools/whole/shoot.py "$D/${TAG}_${c}_${t}.json" "$D/${TAG}_${c}_${t}.png" &
    done
    wait
    echo "shoot $(( $(date +%s) - t0 ))s"
    

    result, 1 line

    File created successfully at: ~/Projects/lowmarch-fable52/review/out/whole-clips/shots.sh (file state is current in your context — no need to Read it back)
  • Bashchmod +x ~/Projects/lowmarch-fable52/review/out/whole-clips/shots.sh && TAG=a ~/Projects/lowmarch-fable52/review/out/whole-clips/shots.sh 2>&1 | tail -30

    command

    chmod +x ~/Projects/lowmarch-fable52/review/out/whole-clips/shots.sh && TAG=a ~/Projects/lowmarch-fable52/review/out/whole-clips/shots.sh 2>&1 | tail -30

    result, 27 lines

    wren.glb 4.5 MB, 57s
      wren: 34 keyframes checked; 14 with an arm through the body, 17 with an arm resting on it
        ! wren, attack at 0.32 s: left upper arm 2.7 cm inside the body; left forearm 1.6 cm inside the body
        ! wren, attack at 0.38 s: left upper arm 4.3 cm inside the body; left forearm 1.5 cm inside the body
        ! wren, attack at 0.44 s: left upper arm 4.8 cm inside the body; left forearm 1.6 cm inside the body
        ! wren, attack at 0.59 s: left upper arm 2.5 cm inside the body
        ! wren, attack at 0.62 s: left upper arm 3.6 cm inside the body; right upper arm 1.3 cm from the body
        ! wren, attack at 0.65 s: left upper arm 5.7 cm inside the body; right upper arm 0.1 cm from the body; left forearm 1.5 cm from the body
        ! wren, attack at 0.68 s: left upper arm 6.7 cm inside the body; right upper arm 0.6 cm inside the body; left forearm 0.3 cm inside the body
        ! wren, attack at 0.78 s: left upper arm 6.9 cm inside the body; right upper arm 1.0 cm inside the body; left forearm 0.4 cm inside the body
        ! wren, attack at 0.90 s: left upper arm 6.6 cm inside the body; right upper arm 1.1 cm inside the body; left forearm 0.1 cm from the body
        ! wren, attack at 1.05 s: left upper arm 6.6 cm inside the body; right upper arm 1.1 cm inside the body; left forearm 0.1 cm from the body
        ! wren, attack at 1.15 s: left upper arm 6.9 cm inside the body; right upper arm 1.9 cm inside the body
        ! wren, attack at 1.25 s: left upper arm 3.1 cm inside the body; right upper arm 3.0 cm inside the body
        ! wren, attack at 1.35 s: right upper arm 2.7 cm inside the body; left upper arm 0.5 cm inside the body
        ! wren, attack at 1.42 s: right upper arm 1.4 cm inside the body; left upper arm 1.0 cm from the body
    -> ~/Projects/lowmarch-fable52/review/out/whole-clips/site  57s
    build 58s
    review/out/whole-clips/shots/a_attack_1.30.png 21s
    review/out/whole-clips/shots/a_idle_1.0.png 22s
    review/out/whole-clips/shots/a_attack_0.68.png 22s
    review/out/whole-clips/shots/a_idle_0.0.png 23s
    review/out/whole-clips/shots/a_attack_0.20.png 23s
    review/out/whole-clips/shots/a_attack_0.90.png 23s
    review/out/whole-clips/shots/a_attack_0.38.png 23s
    review/out/whole-clips/shots/a_attack_0.56.png 24s
    shoot 24s
  • Write~/Projects/lowmarch-fable52/review/out/whole-clips/sheet.py

    input

    ~/Projects/lowmarch-fable52/review/out/whole-clips/sheet.py
    
    """Contact sheet: python3 sheet.py TAG OUT.png [scale] -> the eight tiles TAG_<clip>_<t>.png in a 2x4 grid, labelled."""
    import sys
    
    from PIL import Image, ImageDraw
    
    D = "~/Projects/lowmarch-fable52/review/out/whole-clips/shots"
    tag, out = sys.argv[1], sys.argv[2]
    sc = float(sys.argv[3]) if len(sys.argv) > 3 else 1.0
    tiles = [("idle", "0.0"), ("idle", "1.0"), ("attack", "0.20"), ("attack", "0.38"), ("attack", "0.56"),
             ("attack", "0.68"), ("attack", "0.90"), ("attack", "1.30")]
    w, h = int(960 * sc), int(540 * sc)
    sheet = Image.new("RGB", (2 * w + 6, 4 * h + 18), "#222")
    d = ImageDraw.Draw(sheet)
    for i, (c, t) in enumerate(tiles):
        im = Image.open(f"{D}/{tag}_{c}_{t}.png").resize((w, h), Image.LANCZOS)
        x, y = (i % 2) * (w + 6), (i // 2) * (h + 6)
        sheet.paste(im, (x, y))
        d.rectangle((x + 8, y + 8, x + 150, y + 34), fill="#000a")
        d.text((x + 14, y + 13), f"{c} {float(t):.2f} s", fill="white", font_size=int(18 * max(sc, 0.6)))
    sheet.save(out)
    print(out, sheet.size)
    

    result, 1 line

    File created successfully at: ~/Projects/lowmarch-fable52/review/out/whole-clips/sheet.py (file state is current in your context — no need to Read it back)
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && python3 sheet.py a shots/a_sheet.png 0.6

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && python3 sheet.py a shots/a_sheet.png 0.6

    result, 1 line

    shots/a_sheet.png (1158, 1314)
  • Read~/Projects/lowmarch-fable52/review/out/whole-clips/shots/a_sheet.png

    input

    {
      "file_path": "~/Projects/lowmarch-fable52/review/out/whole-clips/shots/a_sheet.png"
    }

    result

    no output

    a_sheet.jpg
    a_sheet.jpg
  • Write~/Projects/lowmarch-fable52/review/out/whole-clips/k.py

    input

    ~/Projects/lowmarch-fable52/review/out/whole-clips/k.py
    
    """Try variations of one attack time: python3 k.py T 'dict-of-overrides' ['dict' ...] -> clearance, reach, elbows."""
    import sys
    
    import numpy as np
    
    import h
    
    v, shape = h.load()
    sys.path.insert(0, f"{h.ROOT}/tools/whole")
    import clips2h
    import poses as P
    
    f = clips2h.Fighter(v, shape)
    rig = f.rig
    t = float(sys.argv[1])
    base = clips2h.hermite(clips2h.ATTACK, t) if t > 0 else clips2h.guard_at(0.0)
    for ov in sys.argv[2:] or ["{}"]:
        k = dict(base, **eval(ov))
        pose = f.solve(k)
        cl = f.body.clearance(pose)
        a, d = f.sword(pose)
        lf = rig.held(pose, "J_Bip_L_Hand", P.BUST, f.ref["fist_L"])
        off = np.linalg.norm((lf - a) - d * ((lf - a) @ d))
        out = []
        for s in "RL":
            S, E, W = (rig.pos(pose, f"J_Bip_{s}_{b}") for b in ("UpperArm", "LowerArm", "Hand"))
            u1, u2 = S - E, W - E
            out.append(f"elb{s} {np.degrees(np.arccos(u1 @ u2 / np.linalg.norm(u1) / np.linalg.norm(u2))):3.0f} E{(E - S).round(2)}")
        print(f"{ov[:90]:90s} | " + " ".join(f"{n[0]}{n[2:5]}{c * 100:5.1f}" for n, c in cl.items()) + f" | off {off * 100:.1f} | " + " ".join(out))
    

    result, 1 line

    File created successfully at: ~/Projects/lowmarch-fable52/review/out/whole-clips/k.py (file state is current in your context — no need to Read it back)
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 k.py 0.38 "{}" "dict(poleL=(-0.2,-0.6,-1))" "dict(poleL=(-0.6,-0.6,-1))" "dict(poleL=(-0.2,-1,-0.6))" "dict(fist=(0.20,0.08,-0.16))" "dict(fist=(0.20,0.08,-0.16),poleL=(-0.2,-0.8,-1))" "dict(fist=(0.22,0.06,-0.14), turn=-55)" "dict(fist=(0.22,0.06,-0.14), turn=-55, poleL=(-0.2,-0.8,-1))" 2>&1 | tail -9

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 k.py 0.38 "{}" "dict(poleL=(-0.2,-0.6,-1))" "dict(poleL=(-0.6,-0.6,-1))" "dict(poleL=(-0.2,-1,-0.6))" "dict(fist=(0.20,0.08,-0.16))" "dict(fist=(0.20,0.08,-0.16),poleL=(-0.2,-0.8,-1))" "dict(fist=(0.22,0.06,-0.14), turn=-55)" "dict(fist=(0.22,0.06,-0.14), turn=-55, poleL=(-0.2,-0.8,-1))" 2>&1 | tail -9

    result, 4 lines

    Traceback (most recent call last):
      File "~/Projects/lowmarch-fable52/review/out/whole-clips/k.py", line 15, in <module>
        t = float(sys.argv[1])
    IndexError: list index out of range
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && sed -i 's/^import h$/ARGV = list(sys.argv)\nimport h/; s/sys.argv\[1\]/ARGV[1]/; s/sys.argv\[2:\]/ARGV[2:]/' k.py && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 k.py 0.38 "{}" "dict(poleL=(-0.2,-0.6,-1))" "dict(poleL=(-0.6,-0.6,-1))" "dict(poleL=(-0.2,-1,-0.6))" "dict(fist=(0.20,0.08,-0.16))" "dict(fist=(0.20,0.08,-0.16),poleL=(-0.2,-0.8,-1))" "dict(fist=(0.22,0.06,-0.14), turn=-55)" "dict(fist=(0.22,0.06,-0.14), turn=-55, poleL=(-0.2,-0.8,-1))" 2>&1 | tail -9

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && sed -i 's/^import h$/ARGV = list(sys.argv)\nimport h/; s/sys.argv\[1\]/ARGV[1]/; s/sys.argv\[2:\]/ARGV[2:]/' k.py && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 k.py 0.38 "{}" "dict(poleL=(-0.2,-0.6,-1))" "dict(poleL=(-0.6,-0.6,-1))" "dict(poleL=(-0.2,-1,-0.6))" "dict(fist=(0.20,0.08,-0.16))" "dict(fist=(0.20,0.08,-0.16),poleL=(-0.2,-0.8,-1))" "dict(fist=(0.22,0.06,-0.14), turn=-55)" "dict(fist=(0.22,0.06,-0.14), turn=-55, poleL=(-0.2,-0.8,-1))" 2>&1 | tail -9

    result, 9 lines

    {}                                                                                         | RUpp  6.3 RLow  7.4 RHan  6.1 LUpp -4.3 LLow -1.5 LHan  4.4 | off 0.1 | elbR  46 E[ 0.2  -0.13  0.06] elbL  61 E[ 0.14 -0.19 -0.08]
    dict(poleL=(-0.2,-0.6,-1))                                                                 | RUpp  6.3 RLow  7.4 RHan  6.1 LUpp -0.1 LLow  4.1 LHan  4.9 | off 0.1 | elbR  46 E[ 0.2  -0.13  0.06] elbL  64 E[ 0.14 -0.1  -0.18]
    dict(poleL=(-0.6,-0.6,-1))                                                                 | RUpp  6.3 RLow  7.4 RHan  6.1 LUpp  0.1 LLow  4.4 LHan  4.9 | off 0.1 | elbR  46 E[ 0.2  -0.13  0.06] elbL  64 E[ 0.14 -0.09 -0.19]
    dict(poleL=(-0.2,-1,-0.6))                                                                 | RUpp  6.3 RLow  7.4 RHan  6.1 LUpp -3.6 LLow -0.6 LHan  4.5 | off 0.1 | elbR  46 E[ 0.2  -0.13  0.06] elbL  61 E[ 0.14 -0.17 -0.11]
    dict(fist=(0.20,0.08,-0.16))                                                               | RUpp  4.0 RLow  9.1 RHan 11.6 LUpp  1.1 LLow  3.6 LHan  8.4 | off 0.1 | elbR  76 E[ 0.21 -0.11 -0.06] elbL  66 E[ 0.05 -0.18 -0.17]
    dict(fist=(0.20,0.08,-0.16),poleL=(-0.2,-0.8,-1))                                          | RUpp  4.0 RLow  9.1 RHan 11.6 LUpp  2.9 LLow  5.6 LHan  8.9 | off 0.1 | elbR  76 E[ 0.21 -0.11 -0.06] elbL  67 E[ 0.04 -0.14 -0.2 ]
    dict(fist=(0.22,0.06,-0.14), turn=-55)                                                     | RUpp  2.7 RLow  8.1 RHan 11.6 LUpp  1.0 LLow  2.2 LHan  6.0 | off 0.1 | elbR  84 E[ 0.22 -0.11 -0.04] elbL  61 E[ 0.06 -0.21 -0.12]
    dict(fist=(0.22,0.06,-0.14), turn=-55, poleL=(-0.2,-0.8,-1))                               | RUpp  2.7 RLow  8.1 RHan 11.6 LUpp  3.9 LLow  5.2 LHan  7.3 | off 0.0 | elbR  84 E[ 0.22 -0.11 -0.04] elbL  62 E[ 0.05 -0.15 -0.19]
    [This command modified 1 file you've previously read: ../../whole-clips/k.py. Call Read before editing.]
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 k.py 0.68 "{}" "dict(fist=(-0.08,-0.30,-0.28),blade=(-0.45,-0.55,0.70))" "dict(fist=(-0.08,-0.30,-0.28),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4))" "dict(fist=(-0.12,-0.32,-0.24),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4))" "dict(fist=(-0.12,-0.32,-0.24),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.6,0.0), turn=50)" "dict(fist=(-0.04,-0.30,-0.30),blade=(-0.40,-0.55,0.73),poleL=(-1,-0.4,0.4), turn=50)" "dict(fist=(-0.04,-0.30,-0.30),blade=(-0.40,-0.55,0.73),poleL=(-1,-0.4,0.4), poleR=(0.2,-1,-0.6), turn=50)" 2>&1 | tail -7

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 k.py 0.68 "{}" "dict(fist=(-0.08,-0.30,-0.28),blade=(-0.45,-0.55,0.70))" "dict(fist=(-0.08,-0.30,-0.28),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4))" "dict(fist=(-0.12,-0.32,-0.24),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4))" "dict(fist=(-0.12,-0.32,-0.24),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.6,0.0), turn=50)" "dict(fist=(-0.04,-0.30,-0.30),blade=(-0.40,-0.55,0.73),poleL=(-1,-0.4,0.4), turn=50)" "dict(fist=(-0.04,-0.30,-0.30),blade=(-0.40,-0.55,0.73),poleL=(-1,-0.4,0.4), poleR=(0.2,-1,-0.6), turn=50)" 2>&1 | tail -7

    result, 7 lines

    {}                                                                                         | RUpp -0.6 RLow  6.5 RHan 27.7 LUpp -6.7 LLow -0.3 LHan 15.6 | off 5.7 | elbR 178 E[-0.11 -0.18 -0.13] elbL 178 E[ 0.03 -0.14 -0.2 ]
    dict(fist=(-0.08,-0.30,-0.28),blade=(-0.45,-0.55,0.70))                                    | RUpp  1.6 RLow  8.8 RHan 18.3 LUpp -7.8 LLow -1.7 LHan 14.9 | off 3.0 | elbR 118 E[ 0.01 -0.24 -0.08] elbL 178 E[ 0.05 -0.16 -0.19]
    dict(fist=(-0.08,-0.30,-0.28),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4))                | RUpp  1.6 RLow  8.8 RHan 18.3 LUpp -7.8 LLow -1.7 LHan 14.9 | off 3.0 | elbR 118 E[ 0.01 -0.24 -0.08] elbL 178 E[ 0.05 -0.16 -0.19]
    dict(fist=(-0.12,-0.32,-0.24),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4))                | RUpp -0.3 RLow  6.1 RHan 18.7 LUpp -8.0 LLow -0.1 LHan 16.0 | off 0.4 | elbR 133 E[-0.05 -0.23 -0.08] elbL 178 E[ 0.03 -0.17 -0.18]
    dict(fist=(-0.12,-0.32,-0.24),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.6,0.0), turn=50)       | RUpp  1.1 RLow  7.9 RHan 18.3 LUpp -8.5 LLow -1.5 LHan 14.3 | off 1.3 | elbR 125 E[-0.02 -0.24 -0.07] elbL 178 E[ 0.02 -0.17 -0.18]
    dict(fist=(-0.04,-0.30,-0.30),blade=(-0.40,-0.55,0.73),poleL=(-1,-0.4,0.4), turn=50)       | RUpp  3.3 RLow 11.0 RHan 18.7 LUpp -8.4 LLow -5.6 LHan 14.0 | off 6.2 | elbR 108 E[ 0.06 -0.23 -0.07] elbL 178 E[ 0.06 -0.15 -0.19]
    dict(fist=(-0.04,-0.30,-0.30),blade=(-0.40,-0.55,0.73),poleL=(-1,-0.4,0.4), poleR=(0.2,-1, | RUpp  4.7 RLow 14.1 RHan 18.8 LUpp -8.4 LLow -5.5 LHan 14.0 | off 6.2 | elbR 108 E[ 0.06 -0.21 -0.13] elbL 178 E[ 0.06 -0.15 -0.19]
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && B="fist=(-0.08,-0.30,-0.22),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4)"; OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 k.py 0.68 "dict($B, turn=20, hip=10)" "dict($B, turn=28, hip=12)" "dict($B, turn=35, hip=14)" "dict($B, turn=28, hip=12, lean=24)" "dict($B, turn=28, hip=12, fwd=0.10)" "dict(fist=(-0.12,-0.34,-0.20),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4), turn=28, hip=12)" 2>&1 | tail -6

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && B="fist=(-0.08,-0.30,-0.22),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4)"; OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 k.py 0.68 "dict($B, turn=20, hip=10)" "dict($B, turn=28, hip=12)" "dict($B, turn=35, hip=14)" "dict($B, turn=28, hip=12, lean=24)" "dict($B, turn=28, hip=12, fwd=0.10)" "dict(fist=(-0.12,-0.34,-0.20),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4), turn=28, hip=12)" 2>&1 | tail -6

    result, 6 lines

    dict(fist=(-0.08,-0.30,-0.22),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4), turn=20, hip=1 | RUpp -1.7 RLow  4.0 RHan 14.6 LUpp -7.6 LLow  1.1 LHan 15.9 | off 5.3 | elbR 128 E[-0.03 -0.23 -0.08] elbL 178 E[ 0.07 -0.18 -0.15]
    dict(fist=(-0.08,-0.30,-0.22),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4), turn=28, hip=1 | RUpp -0.1 RLow  6.1 RHan 14.5 LUpp -8.5 LLow -0.7 LHan 15.7 | off 2.3 | elbR 121 E[-0.01 -0.23 -0.09] elbL 178 E[ 0.07 -0.18 -0.16]
    dict(fist=(-0.08,-0.30,-0.22),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4), turn=35, hip=1 | RUpp  0.9 RLow  6.9 RHan 14.3 LUpp -8.4 LLow -0.3 LHan 14.2 | off 0.3 | elbR 116 E[-0.   -0.24 -0.08] elbL 164 E[ 0.04 -0.18 -0.16]
    dict(fist=(-0.08,-0.30,-0.22),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4), turn=28, hip=1 | RUpp  0.4 RLow  7.8 RHan 16.0 LUpp -7.3 LLow  1.0 LHan 16.9 | off 1.6 | elbR 117 E[-0.01 -0.23 -0.08] elbL 178 E[ 0.07 -0.18 -0.15]
    dict(fist=(-0.08,-0.30,-0.22),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4), turn=28, hip=1 | RUpp -0.1 RLow  6.1 RHan 14.5 LUpp -8.5 LLow -0.7 LHan 15.7 | off 2.3 | elbR 121 E[-0.01 -0.23 -0.09] elbL 178 E[ 0.07 -0.18 -0.16]
    dict(fist=(-0.12,-0.34,-0.20),blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4), turn=28, hip=1 | RUpp -6.6 RLow  0.5 RHan 17.4 LUpp -8.6 LLow -0.8 LHan 15.7 | off 1.2 | elbR 178 E[-0.14 -0.2  -0.05] elbL 178 E[ 0.05 -0.2  -0.14]
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 - <<'EOF' 2>&1 | tail

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 - <<'EOF' 2>&1 | tail
    import sys, h, numpy as np
    v,shape=h.load(); sys.path.insert(0,h.ROOT+'/tools/whole')
    import clips2h, poses as P
    f=clips2h.Fighter(v,shape); r=f.rig
    for s in "RL":
        S,E,W=(r.pos(P.BUST,f"J_Bip_{s}_{b}") for b in ("UpperArm","LowerArm","Hand"))
        print(s, 'upper',np.linalg.norm(E-S).round(3),'lower',np.linalg.norm(W-E).round(3),'fist from wrist',np.linalg.norm(f.ref[f'fist_{s}']-W).round(3),'S->fist',np.linalg.norm(f.ref[f'fist_{s}']-S).round(3), 'fist',f.ref[f'fist_{s}'].round(3),'W',W.round(3))
    k=clips2h.hermite(clips2h.ATTACK,0.68); k.update(fist=(-0.08,-0.30,-0.22),blade=(-0.45,-0.55,0.70),turn=35,hip=14)
    pose=f.solve(k)
    a,d=f.sword(pose)
    for s in "RL": print(s,'shoulder',r.pos(pose,f"J_Bip_{s}_UpperArm").round(3))
    print('R fist',a.round(3),'L target',(a-d*0.095).round(3), 'dist L', np.linalg.norm(a-d*0.095-r.pos(pose,"J_Bip_L_UpperArm")).round(3))
    EOF

    result, 5 lines

    R upper 0.249 lower 0.224 fist from wrist 0.048 S->fist 0.519 fist [ 0.273  0.834 -0.019] W [ 0.278  0.883 -0.019]
    L upper 0.249 lower 0.224 fist from wrist 0.07 S->fist 0.541 fist [-0.283  0.813 -0.013] W [-0.278  0.883 -0.019]
    R shoulder [ 0.095  1.196 -0.375]
    L shoulder [-0.147  1.217 -0.208]
    R fist [-0.105  0.824 -0.5  ] L target [-0.062  0.877 -0.567] dist L 0.501
  • Write~/Projects/lowmarch-fable52/review/out/whole-clips/grid.py

    input

    ~/Projects/lowmarch-fable52/review/out/whole-clips/grid.py
    
    """Grid search one key's fist and turn: python3 grid.py T 'base overrides' -> the clearest configurations."""
    import itertools
    import sys
    
    import numpy as np
    
    ARGV = list(sys.argv)
    import h
    
    v, shape = h.load()
    sys.path.insert(0, f"{h.ROOT}/tools/whole")
    import clips2h
    import poses as P
    
    f = clips2h.Fighter(v, shape)
    rig = f.rig
    t = float(ARGV[1])
    base = dict(clips2h.hermite(clips2h.ATTACK, t), **eval(ARGV[2] if len(ARGV) > 2 else "{}"))
    xs, ys, zs, turns = eval(ARGV[3]) if len(ARGV) > 3 else ([-0.24, -0.16, -0.08, 0.0], [-0.42, -0.34, -0.26], [-0.42, -0.34, -0.26, -0.18], [20, 32, 44])
    res = []
    for x, y, z, tu in itertools.product(xs, ys, zs, turns):
        k = dict(base, fist=(x, y, z), turn=tu)
        pose = f.solve(k)
        cl = f.body.clearance(pose)
        a, d = f.sword(pose)
        lf = rig.held(pose, "J_Bip_L_Hand", P.BUST, f.ref["fist_L"])
        off = np.linalg.norm((lf - a) - d * ((lf - a) @ d))
        rf = rig.held(pose, "J_Bip_R_Hand", P.BUST, f.ref["fist_R"])
        tgt = rig.pos(pose, "J_Bip_C_UpperChest") + np.array([x, y, z])
        miss = np.linalg.norm(rf - tgt)
        elb = []
        for s in "RL":
            S, E, W = (rig.pos(pose, f"J_Bip_{s}_{b}") for b in ("UpperArm", "LowerArm", "Hand"))
            u1, u2 = S - E, W - E
            elb.append(np.degrees(np.arccos(u1 @ u2 / np.linalg.norm(u1) / np.linalg.norm(u2))))
        res.append((min(cl.values()) - 2 * (off + miss), (x, y, z, tu), min(cl.values()), off, miss, elb, min(cl, key=cl.get)))
    res.sort(key=lambda r: -r[0])
    for r in res[:14]:
        print(f"fist {r[1][:3]} turn {r[1][3]:3d} | clear {r[2] * 100:5.1f} ({r[6]}) off {r[3] * 100:4.1f} miss {r[4] * 100:4.1f} elb R{r[5][0]:4.0f} L{r[5][1]:4.0f}")
    

    result, 1 line

    File created successfully at: ~/Projects/lowmarch-fable52/review/out/whole-clips/grid.py (file state is current in your context — no need to Read it back)
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && time OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 grid.py 0.68 "dict(blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4),hip=14)" 2>&1 | tail -15

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && time OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 grid.py 0.68 "dict(blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4),hip=14)" 2>&1 | tail -15

    result, 18 lines

    fist (-0.24, -0.26, -0.26) turn  44 | clear  -3.9 (L_UpperArm) off  0.1 miss  0.0 elb R 159 L 155
    fist (-0.16, -0.26, -0.18) turn  20 | clear  -4.7 (R_UpperArm) off  0.1 miss  0.0 elb R 134 L 164
    fist (-0.16, -0.26, -0.26) turn  44 | clear  -5.5 (L_UpperArm) off  0.0 miss  0.1 elb R 118 L 149
    fist (-0.16, -0.34, -0.18) turn  44 | clear  -5.5 (L_UpperArm) off  0.1 miss  0.1 elb R 162 L 142
    fist (-0.24, -0.26, -0.18) turn  44 | clear  -5.5 (L_UpperArm) off  0.2 miss  0.0 elb R 148 L 150
    fist (-0.08, -0.34, -0.18) turn  44 | clear  -6.9 (L_UpperArm) off  0.0 miss  0.0 elb R 126 L 144
    fist (-0.08, -0.26, -0.26) turn  44 | clear  -7.2 (L_UpperArm) off  0.1 miss  0.0 elb R  99 L 161
    fist (0.0, -0.34, -0.18) turn  32 | clear  -8.2 (L_UpperArm) off  0.0 miss  0.0 elb R 118 L 151
    fist (-0.08, -0.34, -0.18) turn  32 | clear  -7.8 (L_UpperArm) off  0.2 miss  0.1 elb R 138 L 159
    fist (-0.08, -0.26, -0.26) turn  32 | clear  -7.3 (L_UpperArm) off  0.4 miss  0.1 elb R 108 L 178
    fist (-0.16, -0.26, -0.18) turn  44 | clear  -7.8 (L_UpperArm) off  0.3 miss  0.1 elb R 112 L 158
    fist (-0.08, -0.26, -0.18) turn  20 | clear  -6.2 (L_UpperArm) off  1.1 miss  0.1 elb R 107 L 178
    fist (-0.08, -0.26, -0.18) turn  44 | clear  -9.3 (L_UpperArm) off  0.0 miss  0.0 elb R  93 L 160
    fist (0.0, -0.26, -0.18) turn  44 | clear  -9.6 (L_UpperArm) off  0.1 miss  0.0 elb R  82 L 143
    
    real	0m55.415s
    user	0m54.339s
    sys	0m0.442s
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 grid.py 0.68 "dict(blade=(-0.45,-0.55,0.70),poleL=(-1,-0.6,0.2),hip=14,lean=26)" "([-0.22,-0.14,-0.06],[-0.48,-0.40],[-0.34,-0.26,-0.18],[24,34,44])" 2>&1 | tail -8; OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 grid.py 0.68 "dict(blade=(-0.35,-0.75,-0.55),poleL=(-1,-0.6,0.2),hip=14,lean=20)" "([-0.22,-0.14,-0.06],[-0.40,-0.32],[-0.38,-0.30,-0.22],[24,34,44])" 2>&1 | tail -8

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 grid.py 0.68 "dict(blade=(-0.45,-0.55,0.70),poleL=(-1,-0.6,0.2),hip=14,lean=26)" "([-0.22,-0.14,-0.06],[-0.48,-0.40],[-0.34,-0.26,-0.18],[24,34,44])" 2>&1 | tail -8; OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 grid.py 0.68 "dict(blade=(-0.35,-0.75,-0.55),poleL=(-1,-0.6,0.2),hip=14,lean=20)" "([-0.22,-0.14,-0.06],[-0.40,-0.32],[-0.38,-0.30,-0.22],[24,34,44])" 2>&1 | tail -8

    result, 16 lines

    fist (-0.22, -0.4, -0.18) turn  44 | clear  -5.2 (R_UpperArm) off  0.0 miss  7.3 elb R 178 L 136
    fist (-0.14, -0.4, -0.26) turn  34 | clear  -6.5 (L_UpperArm) off  1.4 miss  5.4 elb R 178 L 178
    fist (-0.14, -0.4, -0.26) turn  24 | clear  -5.4 (R_UpperArm) off  0.0 miss  7.5 elb R 178 L 146
    fist (-0.06, -0.4, -0.26) turn  34 | clear  -7.3 (L_UpperArm) off  5.0 miss  1.8 elb R 178 L 178
    fist (-0.14, -0.4, -0.26) turn  44 | clear  -6.9 (L_UpperArm) off  4.2 miss  3.3 elb R 178 L 178
    fist (-0.06, -0.4, -0.26) turn  44 | clear  -7.9 (L_UpperArm) off  7.4 miss  0.0 elb R 165 L 178
    fist (-0.22, -0.4, -0.26) turn  44 | clear  -6.1 (L_UpperArm) off  1.3 miss  7.7 elb R 178 L 178
    fist (-0.22, -0.4, -0.26) turn  34 | clear  -4.6 (R_UpperArm) off  0.0 miss  9.9 elb R 178 L 143
    fist (-0.06, -0.32, -0.3) turn  44 | clear  -5.9 (L_UpperArm) off  0.1 miss  0.1 elb R 146 L 154
    fist (-0.06, -0.32, -0.3) turn  24 | clear  -3.0 (R_UpperArm) off  0.0 miss  1.9 elb R 178 L 121
    fist (-0.14, -0.32, -0.3) turn  44 | clear  -3.4 (L_UpperArm) off  0.1 miss  1.7 elb R 178 L 145
    fist (-0.06, -0.4, -0.22) turn  34 | clear  -2.7 (R_UpperArm) off  0.1 miss  3.0 elb R 178 L 135
    fist (-0.14, -0.32, -0.22) turn  24 | clear  -5.4 (R_UpperArm) off  0.0 miss  1.9 elb R 178 L 100
    fist (-0.06, -0.4, -0.22) turn  44 | clear  -6.3 (L_UpperArm) off  0.1 miss  1.4 elb R 178 L 157
    fist (-0.22, -0.32, -0.22) turn  44 | clear  -3.6 (R_UpperArm) off  0.1 miss  3.0 elb R 178 L 119
    fist (-0.14, -0.32, -0.3) turn  34 | clear  -2.7 (R_UpperArm) off  0.1 miss  3.6 elb R 178 L 123
  • Write~/Projects/lowmarch-fable52/review/out/whole-clips/viz.py

    input

    ~/Projects/lowmarch-fable52/review/out/whole-clips/viz.py
    
    """Stick views of one solved key: python3 viz.py T 'overrides' OUT.png -> front, side, top: torso skin, arms, sword."""
    import sys
    
    import matplotlib
    import numpy as np
    
    matplotlib.use("Agg")
    import matplotlib.pyplot as plt
    
    ARGV = list(sys.argv)
    import h
    
    v, shape = h.load()
    sys.path.insert(0, f"{h.ROOT}/tools/whole")
    import clips2h
    import poses as P
    
    f = clips2h.Fighter(v, shape)
    rig = f.rig
    t = float(ARGV[1])
    k = dict(clips2h.hermite(clips2h.ATTACK, t) if t > 0 else clips2h.guard_at(0.0), **eval(ARGV[2]))
    pose = f.solve(k)
    Bp, Bn, _ = f.body.posed(pose)
    tor = Bp[f.body.torso]
    cl = f.body.clearance(pose)
    a, d = f.sword(pose)
    sw = np.array([a - d * 0.13, a + d * 0.10, a + d * 0.94])
    chains = [["J_Bip_C_Hips", "J_Bip_C_Spine", "J_Bip_C_Chest", "J_Bip_C_UpperChest", "J_Bip_C_Neck", "J_Bip_C_Head"]]
    for s in "RL":
        chains.append(["J_Bip_C_UpperChest", f"J_Bip_{s}_Shoulder", f"J_Bip_{s}_UpperArm", f"J_Bip_{s}_LowerArm", f"J_Bip_{s}_Hand", f"J_Bip_{s}_Middle3"])
        chains.append(["J_Bip_C_Hips", f"J_Bip_{s}_UpperLeg", f"J_Bip_{s}_LowerLeg", f"J_Bip_{s}_Foot", f"J_Bip_{s}_ToeBase"])
    fig, ax = plt.subplots(1, 3, figsize=(15, 6))
    views = [("front (x her right ->, y up)", 0, 1, 1), ("side (-z forward <-, y up)", 2, 1, 1), ("top (x ->, -z forward up)", 0, 2, -1)]
    for A, (title, i, j, sj) in zip(ax, views):
        A.scatter(tor[:, i], sj * tor[:, j], s=0.3, c="#bbb")
        for c in chains:
            pts = np.array([rig.pos(pose, b) for b in c])
            col = "r" if "_R_" in c[-1] else "b" if "_L_" in c[-1] else "k"
            A.plot(pts[:, i], sj * pts[:, j], "-o", c=col, ms=3)
        A.plot(sw[:2, i], sj * sw[:2, j], "-", c="#a60", lw=4)
        A.plot(sw[1:, i], sj * sw[1:, j], "-", c="#888", lw=2)
        A.set_aspect("equal")
        A.set_title(title)
        A.grid(alpha=0.3)
    fig.suptitle(f"t {t}  " + " ".join(f"{n}{c * 100:5.1f}" for n, c in cl.items()))
    fig.savefig(ARGV[3], dpi=70)
    

    result, 1 line

    File created successfully at: ~/Projects/lowmarch-fable52/review/out/whole-clips/viz.py (file state is current in your context — no need to Read it back)
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 viz.py 0.68 "dict(blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4),fist=(-0.16,-0.30,-0.24),turn=34,hip=14)" shots/viz.png 2>&1 | tail -3

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 viz.py 0.68 "dict(blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4),fist=(-0.16,-0.30,-0.24),turn=34,hip=14)" shots/viz.png 2>&1 | tail -3

    result, 1 line

    (Bash completed with no output)
  • Read~/Projects/lowmarch-fable52/review/out/whole-clips/shots/viz.png

    input

    {
      "file_path": "~/Projects/lowmarch-fable52/review/out/whole-clips/shots/viz.png"
    }

    result

    no output

    viz.png
    viz.png
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && python3 - <<'EOF'

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && python3 - <<'EOF'
    s=open('grid.py').read()
    s=s.replace('''xs, ys, zs, turns = eval(ARGV[3]) if len(ARGV) > 3 else ([-0.24, -0.16, -0.08, 0.0], [-0.42, -0.34, -0.26], [-0.42, -0.34, -0.26, -0.18], [20, 32, 44])
    res = []
    for x, y, z, tu in itertools.product(xs, ys, zs, turns):
        k = dict(base, fist=(x, y, z), turn=tu)''','''axes = eval(ARGV[3])                       # {"x": [...], "y": [...], "z": [...], other key names: [...]}
    names = list(axes)
    res = []
    for combo in itertools.product(*axes.values()):
        c = dict(zip(names, combo))
        fx = list(base["fist"])
        for i, n in enumerate("xyz"):
            if n in c:
                fx[i] = c.pop(n)
        k = dict(base, fist=tuple(fx), **c)
        x, y, z = fx''')
    s=s.replace("res.append((min(cl.values()) - 2 * (off + miss), (x, y, z, tu),","res.append((min(cl.values()) - 2 * (off + miss), combo,")
    s=s.replace('''print(f"fist {r[1][:3]} turn {r[1][3]:3d} | clear''','''print(f"{dict(zip(names, r[1]))} | clear''')
    open('grid.py','w').write(s)
    EOF
    OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 grid.py 0.68 "dict(blade=(-0.45,-0.55,0.70),poleL=(-1,-0.4,0.4),hip=14)" '{"x":[-0.2,-0.12],"y":[-0.36,-0.28],"z":[-0.3,-0.22],"turn":[24,40],"lean":[4,10]}' 2>&1 | tail -8

    result, 8 lines

    {'x': -0.12, 'y': -0.28, 'z': -0.3, 'turn': 24, 'lean': 4} | clear  -7.9 (L_UpperArm) off  2.9 miss  0.1 elb R 164 L 178
    {'x': -0.2, 'y': -0.28, 'z': -0.3, 'turn': 40, 'lean': 10} | clear  -6.7 (L_UpperArm) off  2.7 miss  1.1 elb R 178 L 178
    {'x': -0.12, 'y': -0.36, 'z': -0.22, 'turn': 40, 'lean': 4} | clear  -9.4 (L_UpperArm) off  0.6 miss  2.0 elb R 178 L 178
    {'x': -0.12, 'y': -0.28, 'z': -0.3, 'turn': 40, 'lean': 10} | clear  -7.7 (L_UpperArm) off  3.6 miss  0.0 elb R 129 L 178
    {'x': -0.12, 'y': -0.28, 'z': -0.3, 'turn': 40, 'lean': 4} | clear  -8.6 (L_UpperArm) off  4.1 miss  0.0 elb R 135 L 178
    {'x': -0.2, 'y': -0.28, 'z': -0.3, 'turn': 40, 'lean': 4} | clear  -7.7 (L_UpperArm) off  2.7 miss  1.9 elb R 178 L 178
    {'x': -0.2, 'y': -0.36, 'z': -0.22, 'turn': 40, 'lean': 10} | clear  -6.5 (L_UpperArm) off  0.1 miss  5.8 elb R 178 L 153
    {'x': -0.12, 'y': -0.28, 'z': -0.22, 'turn': 24, 'lean': 10} | clear  -7.6 (L_UpperArm) off  5.2 miss  0.1 elb R 132 L 178
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 grid.py 0.68 "dict(blade=(-0.55,-0.45,0.70),poleL=(-1,-0.4,0.4),hip=14)" '{"x":[-0.18,-0.10],"y":[-0.46,-0.38],"z":[-0.24,-0.16,-0.08],"turn":[24,40],"lean":[8,16]}' 2>&1 | tail -6

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 grid.py 0.68 "dict(blade=(-0.55,-0.45,0.70),poleL=(-1,-0.4,0.4),hip=14)" '{"x":[-0.18,-0.10],"y":[-0.46,-0.38],"z":[-0.24,-0.16,-0.08],"turn":[24,40],"lean":[8,16]}' 2>&1 | tail -6

    result, 6 lines

    {'x': -0.18, 'y': -0.38, 'z': -0.16, 'turn': 40, 'lean': 8} | clear  -6.3 (R_UpperArm) off  0.1 miss  5.5 elb R 178 L 151
    {'x': -0.18, 'y': -0.38, 'z': -0.08, 'turn': 40, 'lean': 16} | clear  -7.3 (R_UpperArm) off  0.0 miss  5.3 elb R 178 L 131
    {'x': -0.1, 'y': -0.38, 'z': -0.24, 'turn': 24, 'lean': 16} | clear  -8.4 (L_UpperArm) off  1.1 miss  3.8 elb R 178 L 178
    {'x': -0.1, 'y': -0.38, 'z': -0.16, 'turn': 24, 'lean': 8} | clear  -8.6 (L_UpperArm) off  2.1 miss  3.4 elb R 178 L 178
    {'x': -0.18, 'y': -0.38, 'z': -0.08, 'turn': 40, 'lean': 8} | clear  -7.7 (R_UpperArm) off  0.1 miss  6.0 elb R 178 L 134
    {'x': -0.1, 'y': -0.38, 'z': -0.24, 'turn': 40, 'lean': 16} | clear  -9.1 (L_UpperArm) off  4.4 miss  1.2 elb R 178 L 178
  • Bashcd ~/Projects/lowmarch-fable52/tools/whole && python3 - <<'EOF'

    command

    cd ~/Projects/lowmarch-fable52/tools/whole && python3 - <<'EOF'
    s=open('clips2h.py').read()
    a='''    def look(self, pose, down, neck=0.4):'''
    b='''    def girdle(self, pose, side, target, share=0.3, cap=20.0):
            """Swing the clavicle (the Shoulder bone) a share of the way toward where the arm reaches, at most `cap`
            degrees: the shoulder comes forward across the body on a long reach, as a real shoulder girdle does,
            instead of leaving the arm to reach alone (straight, and through the chest)."""
            rig = self.rig
            S = rig.pos(pose, f"J_Bip_{side}_Shoulder")
            U = rig.pos(pose, f"J_Bip_{side}_UpperArm")
            a, b = (U - S) / np.linalg.norm(U - S), (target - S) / np.linalg.norm(target - S)
            ang = np.degrees(np.arccos(np.clip(a @ b, -1, 1)))
            if ang < 1e-3:
                return pose
            axis = np.cross(a, b)
            return rig.rotate_world(pose, f"J_Bip_{side}_Shoulder", P.rot(axis, min(ang * share, cap)))
    
        def look(self, pose, down, neck=0.4):'''
    assert s.count(a)==1; s=s.replace(a,b)
    a='''        pose = clear_grip(rig, self.body, pose, "R", self.ref, fr, D, [k["poleR"]] + POLES)
            a, d = self.sword(pose)
            mirror = np.array([-1.0, 1.0, 1.0])
    '''
    b='''        pose = self.girdle(pose, "R", fr)
            pose = self.girdle(pose, "L", fr - D * SPAN)
            pose = clear_grip(rig, self.body, pose, "R", self.ref, fr, D, [k["poleR"]] + POLES)
            a, d = self.sword(pose)
            mirror = np.array([-1.0, 1.0, 1.0])
    '''
    assert s.count(a)==1; s=s.replace(a,b)
    open('clips2h.py','w').write(s)
    EOF
    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 grid.py 0.68 "dict(blade=(-0.55,-0.45,0.70),poleL=(-1,-0.4,0.4),hip=14)" '{"x":[-0.18,-0.10],"y":[-0.46,-0.38],"z":[-0.24,-0.16,-0.08],"turn":[24,40],"lean":[8,16]}' 2>&1 | tail -6

    result, 6 lines

    {'x': -0.1, 'y': -0.38, 'z': -0.24, 'turn': 40, 'lean': 16} | clear  -8.4 (L_UpperArm) off  1.3 miss  0.0 elb R 132 L 178
    {'x': -0.1, 'y': -0.38, 'z': -0.24, 'turn': 40, 'lean': 8} | clear  -8.9 (L_UpperArm) off  1.5 miss  0.0 elb R 139 L 178
    {'x': -0.1, 'y': -0.38, 'z': -0.08, 'turn': 24, 'lean': 16} | clear -10.0 (R_Hand) off  1.0 miss  0.0 elb R 146 L 178
    {'x': -0.1, 'y': -0.46, 'z': -0.16, 'turn': 40, 'lean': 16} | clear  -7.3 (L_UpperArm) off  0.1 miss  3.1 elb R 178 L 168
    {'x': -0.1, 'y': -0.38, 'z': -0.16, 'turn': 24, 'lean': 8} | clear  -6.9 (L_UpperArm) off  3.7 miss  0.0 elb R 148 L 178
    {'x': -0.1, 'y': -0.38, 'z': -0.24, 'turn': 24, 'lean': 8} | clear  -7.4 (L_UpperArm) off  3.6 miss  0.1 elb R 165 L 178
  • Bashcd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 viz.py 0.68 "dict(blade=(-0.55,-0.45,0.70),poleL=(-1,-0.4,0.4),fist=(-0.12,-0.40,-0.10),turn=30,hip=14,lean=12)" shots/viz.png 2>&1 | tail -3

    command

    cd ~/Projects/lowmarch-fable52/review/out/whole-clips && OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 viz.py 0.68 "dict(blade=(-0.55,-0.45,0.70),poleL=(-1,-0.4,0.4),fist=(-0.12,-0.40,-0.10),turn=30,hip=14,lean=12)" shots/viz.png 2>&1 | tail -3

    result, 1 line

    (Bash completed with no output)
  • Read~/Projects/lowmarch-fable52/review/out/whole-clips/shots/viz.png

    input

    {
      "file_path": "~/Projects/lowmarch-fable52/review/out/whole-clips/shots/viz.png"
    }

    result

    no output

    viz_2.png
    viz_2.png
  • Bashcd ~/Projects/lowmarch-fable52/tools/whole && grep -n "fr = rig.pos" clips2h.py && python3 - <<'EOF'

    command

    cd ~/Projects/lowmarch-fable52/tools/whole && grep -n "fr = rig.pos" clips2h.py && python3 - <<'EOF'
    s=open('clips2h.py').read()
    a='''        fr = rig.pos(pose, "J_Bip_C_UpperChest") + np.asarray(k["fist"], float)'''
    b='''        W = rig.world(pose)[rig.names["J_Bip_C_UpperChest"]]
            fr = W[:3, 3] + self._rot(W) @ self.chest0.T @ np.asarray(k["fist"], float)'''
    assert s.count(a)==1; s=s.replace(a,b)
    a='''        Wh = rig.world(P.BUST)[rig.names["J_Bip_C_Head"]][:3, :3]'''
    b='''        self.chest0 = self._rot(rig.world(P.BUST)[rig.names["J_Bip_C_UpperChest"]])
            Wh = rig.world(P.BUST)[rig.names["J_Bip_C_Head"]][:3, :3]'''
    assert s.count(a)==1; s=s.replace(a,b)
    open('clips2h.py','w').write(s)
    EOF
    sed -i 's/    tgt = rig.pos(pose, "J_Bip_C_UpperChest") + np.array(\[x, y, z\])/    Wc = rig.world(pose)[rig.names["J_Bip_C_UpperChest"]]\n    tgt = Wc[:3, 3] + f._rot(Wc) @ f.chest0.T @ np.array([x, y, z])/' ~/Projects/lowmarch-fable52/review/out/whole-clips/grid.py; grep -n "tgt" ~/Projects/lowmarch-fable52/review/out/whole-clips/grid.py

    result, 4 lines

    257:        fr = rig.pos(pose, "J_Bip_C_UpperChest") + np.asarray(k["fist"], float)
    37:    tgt = Wc[:3, 3] + f._rot(Wc) @ f.chest0.T @ np.array([x, y, z])
    38:    miss = np.linalg.norm(rf - tgt)
    [This command modified 2 files you've previously read: ../whole-clips/grid.py, ../../../tools/whole/clips2h.py. Call Read before editing.]