Files
a7l20-hug-sim/scripts/prepare_upper_cup_candidates.py

35 lines
1.8 KiB
Python

"""Offline upper grasp hypotheses only; NOT executable robot plans."""
import copy
import json
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
def main():
cap=ROOT/'data/left_cup_current'
original=json.loads((cap/'cup_yaw_plan.json').read_text())['solutions'][0]
candidates=[]
for dz in (.02,.04,.06):
grasp=copy.deepcopy(original['grasp'])
grasp['wrist_pos'][2]+=dz
# No old IK solutions or clearance claims copied to shifted candidates.
candidates.append({'raise_m':dz,'grasp_hypothesis':grasp,
'executable':False,'requires':['cup upper-body surface/contact verification',
'new IK including adapter transform','full arm transit/approach/closure/lift collision checking',
'current state and actual controller trajectory validation']})
report={'status':'hypotheses_only','hardware_connected':False,
'source':'saved cup capture, not a fresh object observation',
'candidates':candidates,
'collision_design_reference':'https://moveit.picknik.ai/main/doc/examples/planning_scene/planning_scene_tutorial.html',
'path_resolution_reference':'https://moveit.picknik.ai/main/doc/examples/ompl_interface/ompl_interface_tutorial.html',
'stop_button_audit':{'source':'http://192.168.10.21:8000/api_http/onlineProgramming.js',
'function':'stopExecution','behavior':'sets stopRequested and resolves UI waits; no controller stop request in handler',
'warning':'Does not establish interruption of an already accepted arm motion.'}}
path=cap/'upper_cup_candidates_offline.json'
path.write_text(json.dumps(report,indent=2));print(path)
print('Created +20/+40/+60 mm hypotheses. No IK or execution authorization.')
if __name__=='__main__':main()