Files
hand-motion-pipeline/scripts/configure_collision_physics.py
liyang ae28d55f81 Update to 2026-09-17 pipeline snapshot; add weights, L20 assets and recording via Git LFS
Source: RGB-D -> Dyn-HaMR -> L20 retargeting -> FoundationPose -> reference repair -> SPIDER,
documented in docs/PIPELINE_LATEST.md and docs/SETUP_AND_WEIGHTS.md. Adds FoundationPose and
nvdiffrast upstream snapshots, requirements/pipeline_venv.txt and the FoundationPose weight
manifest/downloader.

Assets (Git LFS): weights/ (WiLoR detector, HandFlow denoiser, UniDepth-L), FoundationPose
checkpoints, HaMeR checkpoint, Dyn-HaMR HMP model and BMC constraints, L20 URDF/meshes, the
20260915_171525 D405 recording and the two box CADs. MANO models are not redistributed
(third_party/hamer/_DATA/data/mano/README.txt). Environments, caches and run outputs excluded.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 11:43:37 +08:00

15 lines
1.3 KiB
Python

"""Apply the selected bounded-drive contact model after geometric preparation."""
from pathlib import Path
import json,xml.etree.ElementTree as E
O=Path(__file__).resolve().parents[1]/'output/collision_fix_20260915';p=O/'datasets/processed/current/l20/bimanual/boxes/scene_act.xml';tree=E.parse(p);r=tree.getroot();r.find('option').set('iterations','80');r.find('option').set('ls_iterations','50')
for g in r.findall('.//geom'):
if g.get('contype') in ['1','2']:g.set('solimp','.999 .9999 .0001 .5 2');g.set('solref','.005 1')
for a in r.findall('actuator/position'):
n=a.get('name')
if '_object_' in n:continue
if '_hand_pos_' in n:kp,kv,limit=500,30,20
elif '_hand_rot_' in n:kp,kv,limit=15,2,2
else:kp,kv,limit=4,.15,.1
a.attrib.update(kp=str(kp),kv=str(kv),forcerange=f'{-limit} {limit}')
tree.write(p);(O/'physics_parameters.json').write_text(json.dumps({'solver_iterations':80,'ls_iterations':50,'wrist_position_kp':500,'wrist_position_kv':30,'wrist_force_cap_N':20,'wrist_rotation_kp':15,'wrist_rotation_kv':2,'wrist_torque_cap_Nm':2,'finger_kp':4,'finger_kv':.15,'finger_torque_cap_Nm':.1,'contact_solimp':[.999,.9999,.0001,.5,2],'contact_solref':[.005,1],'note':'Simulation drive assumptions, not measured hardware ratings. Chosen after full-clip CPU control-replay comparison.'},indent=2))