"""Self-righting vs hip (shaft) position: TARS-AI places it ~30 mm from the top (mini scale).""" import json, sys from multiprocessing import Pool from model import Params from getup import getup def job(a): hft, face, alpha, mu = a r, _ = getup(Params(hip_from_top=hft, mu=mu, cells=0.030, ups=0.012), face, alpha) return dict(hip_from_top_mm=round(hft * 1000, 1), **r) if __name__ == "__main__": jobs = [(h, f, 90, mu) for h in (0.030, 0.060, 0.0875) for f in ("front", "back") for mu in (0.5, 0.8, 1.0)] with Pool(9) as p: R = p.map(job, jobs) json.dump(R, open("../results/hip_study.json", "w"), indent=1) for r in R: print(f"hip {r['hip_from_top_mm']:5.1f} mm from top {r['face']:5s} mu {r['mu']} ok {r['ok']!s:5s} " f"final {r['final_tilt']:6.1f}° after push {r['tilt_after_push']:6.1f}° swing peak {r['swing_peak']:4.0f}% p95 {r['swing_p95']:4.0f}%")