abse/museair-usb
USB-C–powered ESP32-C3 controller board with AP63203 buck conversion, AP2112K 3.3V regulation, I²C SEN62 sensor interface, status LED, buttons, UART/I²C headers, and extensive decoupling.
- Version
- 0.5.7
- License
- unset
- Stars
- 0
scripts/check-sensor-insertion.py
"""Sample the open-top insertion path against the actual assembly meshes.
Nominal CAD checks, not a physical fit or strength test. Screws and ties are
installed AFTER sliding the sensor; flex and sensor harness are disconnected.
"""
from pathlib import Path
import json, numpy as np, trimesh
root=Path(__file__).resolve().parent.parent
models=root/'mechanical/horizontal/models'
meshes={n:trimesh.load(models/(n+'.glb'),force='scene').to_geometry() for n in ['carrier','carrier-rigid','sensor','case-base','speaker','display','ties','sensor-cable','pcb']}
checks=[]
for part,offset in [('carrier',7.8),('sensor',12)]:
obstacles=['case-base','speaker','display']+(['carrier-rigid'] if part=='sensor' else [])
cm=trimesh.collision.CollisionManager()
for n in obstacles:cm.add_object(n,meshes[n])
path=[(offset,float(z)) for z in np.linspace(48,.2,97)]
path += [(float(y),.2) for y in np.linspace(offset,0,49)[1:]]
# Contact with the base/sensor seat is intentional at final Z=0 and
# checked for solid overlap separately by check-top-service-mechanics.py.
path += [(0,float(z)) for z in [.15,.10,.05]]
hits=[]
for y,z in path:
tf=np.eye(4);tf[:3,3]=[0,y,z]
hit,names=cm.in_collision_single(meshes[part],transform=tf,return_names=True)
if hit:hits.append({'offset_yz_mm':[y,z],'obstacles':sorted(names)})
checks.append({'part':part,'samples':len(path),'staging_y_offset_mm':offset,'collisions':hits})
report={'status':'fail' if any(x['collisions'] for x in checks) else 'pass','paths':checks,'sequence':['Remove lid and PCB; disconnect and park sensor/display cables','Drop base at Y+7.8mm, slide forward 7.8mm, lower onto floor seats','Drop bare sensor at Y+12mm, slide forward 12mm, lower onto base','Let side arms click into sensor recesses; install two M2x4 holder screws and washers; ties are optional backup','Reconnect harness and display flex; install PCB and lid'],'nominal_central_base_clearance_mm':.4,'nominal_sensor_under_ledge_clearance_during_slide_mm':.4,'sampling_step_vertical_mm':.5,'snap_arms_must_flex_outward_during_slide':True,'snap_flex_force_and_retention_not_simulated':True,'sensor_path_checks_rigid_frame_only':True,'physical_fit_and_strength_verified':False}
(root/'validation/compact-sensor-insertion.json').write_text(json.dumps(report,indent=2)+'\n')
assert report['status']=='pass',report
print('PASS: snap base and sensor rigid-envelope insertion paths:',[(x['part'],x['samples']) for x in checks])