55 Commits
Author SHA1 Message Date
AdrianoandClaude Opus 4.8 c383fd3143 feat(version): mostra build time nel badge (non solo tooltip); bump 1.0.2
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 14:49:22 +02:00
AdrianoandClaude Opus 4.8 cf726b479e feat: badge versione build in GUI + build.sh con auto-bump
- VERSION (1.0.0) + build.sh: bump patch/minor/major e deploy via docker compose
- Dockerfile: ARG/ENV APP_VERSION + BUILD_TIME (iniettati come build-arg)
- version.build_info(): env in Docker, fallback file VERSION + '(local)' in dev
- GET /api/version; badge #appVersionPill nell'header (tooltip = build time)
- test_version.py: env vs fallback

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 14:40:52 +02:00
AdrianoandClaude Opus 4.8 47ae8a6b2c feat(pose_3d): doAlign + persistenza/caricamento calibrazione cross-camera
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 12:38:25 +02:00
AdrianoandClaude Opus 4.8 746662d534 feat(pose_3d): piazzamento Nuwa allineato nel frame D435i (matrice)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 12:35:30 +02:00
AdrianoandClaude Sonnet 4.6 2f0dc69cdd feat(pose_3d): rinomina sezione Tags + controlli Allinea cross-camera
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03 12:33:55 +02:00
AdrianoandClaude Sonnet 4.6 edc4430c67 feat(pose_3d): overlay tag su entrambe le camere (Nuwa rosso, D435i ciano)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03 12:31:16 +02:00
AdrianoandClaude Opus 4.8 b4922fe01b fix(pose_3d): front-tag detection solo al cambio immagine, non in loop
L'overlay tag frontale (D435i) ri-eseguiva la detection ArUco ad ogni
tick di pollState() finche' il flag era attivo. Ora gira solo:
- al toggle on del checkbox
- a fine acquireClouds() (pulsante Acquisisci) se il flag e' attivo

Rimosso il piggyback in pollState() e lo stato front_tags.in_flight
ormai inutilizzato.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 10:05:51 +02:00
AdrianoandClaude Opus 4.7 fb0e9b9112 feat(pose_3d): tag locator save, front-tag overlay, sidebar tabs, cloud params persist
- Sidebar a 3 tab verticali (POSE / CAMERAS / MISC) per ridurre lo scroll
- Tag locator: POST /api/pose_3d/tag_offset/{save,} salva crocetta nel
  viewport con snapshot giunti, current.json + archive rotation
- Front-camera tag overlay (MISC):
  - GET /api/pose_3d/front_tags scansiona ArUco sul D435i e per ogni tag
    misura i 4 corner 3D via depth sensor (indipendente da solvePnP);
    outlier rejection ±20% dalla mediana per ignorare corner che catturano
    background sul bordo del marker
  - Rendering quad cyan + label compatta (id, edge_mm, distanza camera)
    agganciato al d435_link, segue la camera anche in modalita' hand-eye
  - Trigger via pollState() quando il flag e' on, niente timer separato
- Cloud cross-camera: memorizza step/max_depth/sizes/scale_xy/flip/handeye
  in pose_3d.cloud_params al click di Acquisisci, ripopola UI da config
  al primo poll (state.cloud_params_populated guard)
- D435i front cloud: applica nuwa_to_cv_frame (il servizio ritorna native,
  non OpenCV come si pensava)
- Cache-bust per pose_3d.js e pose_3d.css

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-01 16:53:26 +02:00
Adriano Dal PastroandClaude Opus 4.7 6c2452fe20 refactor(pose_3d): rimuovi agent/chat, aggiungi cloud+diagnostics+camera polso
Rimosso il modulo agent (LLM chat) e la relativa config OpenRouter.
La tab Pose 3D ora: espone i giunti reali via G1 /diagnostics per
specchiare l'URDF senza IK; acquisisce point cloud Nuwa+D435i
(/api/pose_3d/clouds); mostra il modello 3D della camera sul polso;
degrada gracefully a 200 (wrist=null) quando il robot è offline.
Il vecchio renderer canvas-2D (app.js view3d + diagnostic3d.js) è
stato consolidato nel viewport Three.js di pose_3d.js.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 17:34:42 +02:00
Adriano Dal Pastro 9d30073d57 fix(pose_3d): zero scena al centro robot (pelvi), griglia sotto i piedi a Z=-0.793 2026-05-21 18:06:38 +02:00
Adriano Dal Pastro 38848ad53c feat(pose_3d): IK 2-bone su URDF dopo Apply/Jog/GoPose (polso modello segue il target) 2026-05-21 17:47:12 +02:00
Adriano Dal Pastro 7f60238be9 fix(pose_3d): URDF feet a terra (+0.793m) + sfere polso a zero-pose (Z=0.45) 2026-05-21 17:41:31 +02:00
Adriano Dal Pastro bfd4cc13fb fix(pose_3d): URDFLoader path resolution (rimuovi doppio prefisso /static/vendor/g1/) 2026-05-21 17:37:25 +02:00
Adriano Dal Pastro d5bb9cebd3 feat(pose_3d): workspace check client-side (ghost verde/rosso) + SHOULDER da URDF 2026-05-21 17:21:09 +02:00
Adriano Dal Pastro 8c09d79505 feat(pose_3d): modello reale G1 (URDF + STL meshes) al posto della silhouette finta
Sostituisce torso/head/hips/gambe/spalle primitive in tab Pose 3D con il
modello URDF G1 (g1_body29_hand14), caricato via urdf-loader 0.12.6.

Vendor:
- web/vendor/g1/g1.urdf + 64 mesh STL (~52 MB, copiati da
  G1_API_Server/assets/g1/)
- web/vendor/three/addons/loaders/URDFLoader.js (npm urdf-loader@0.12.6),
  import path adattato a 'three/addons/loaders/STLLoader.js' (importmap
  del sito) e ColladaLoader stubbato (G1 URDF è solo STL)
- web/vendor/three/addons/loaders/URDFClasses.js (companion del loader)

pose_3d.js:
- Aggiunge loadG1Urdf(scene) async che configura loader.loadMeshCb per
  servire le STL dal mount /static/vendor/g1/meshes/
- Best-effort: in caso di errore di parsing/fetch il body non viene
  aggiunto ma la tab continua a funzionare (polsi, UCS, gizmo)
2026-05-21 17:14:16 +02:00
Adriano Dal Pastro 18dce0d951 feat(pose_3d): bottone Sincronizza con robot (refetch state + reset target) 2026-05-21 17:08:09 +02:00
Adriano Dal Pastro b852976a4a feat(pose_3d): readout XYZ/RPY editabili (input number, drive il ghost) 2026-05-21 17:01:03 +02:00
Adriano Dal Pastro 8b722ca729 feat(pose_3d): silhouette robot completa (testa+gambe+spalle) + FRONT come marker terra 2026-05-21 16:46:44 +02:00
Adriano Dal Pastro d4cd82551e fix(pose_3d): ghost fallback alla posa dell'arm quando /state e' offline 2026-05-21 16:44:57 +02:00
Adriano Dal Pastro fd506dff9b feat(pose_3d): etichette DX/SX sulle sfere e FRONT al base 2026-05-21 16:41:08 +02:00
Adriano Dal Pastro 25c94d3861 fix(pose_3d): gizmo visibility (use getHelper for r160) + larger wrist hitbox + diagnostics 2026-05-21 16:36:09 +02:00
Adriano Dal Pastro 71baf829e6 feat(pose_3d): bottone Sblocca braccia 2026-05-21 16:06:43 +02:00
Adriano Dal Pastro bb6796bfe3 feat(pose_3d): save/load/delete named poses 2026-05-21 16:03:38 +02:00
Adriano Dal Pastro a81fc9acf9 feat(pose_3d): Jog mode auto-apply + safety + Precise toggle 2026-05-21 16:01:56 +02:00
Adriano Dal Pastro 5b2239e307 feat(pose_3d): Editor mode Apply + Cancel 2026-05-21 16:00:15 +02:00
Adriano Dal Pastro 64500944d6 feat(pose_3d): selezione polso + gizmo translate/rotate sul ghost 2026-05-21 15:58:41 +02:00
Adriano Dal Pastro 7a561cfa67 feat(pose_3d): polling /state + readout sidebar 2026-05-21 15:56:34 +02:00
Adriano Dal Pastro f161894d53 feat(pose_3d): scene Three.js base (torso, polsi, UCS, grid) 2026-05-21 15:54:29 +02:00
Adriano Dal Pastro c4124a2983 feat(pose_3d): markup HTML + CSS della tab 2026-05-21 15:50:49 +02:00
Adriano Dal Pastro 433edc0974 chore(web): vendor TransformControls (per tab Pose 3D) 2026-05-21 15:48:01 +02:00
Adriano Dal PastroandClaude Opus 4.7 57954b5c8d feat(right_arm): perm assi cam->polso, precise=true default, verify_tag UI
Lavoro accumulato nella sessione 2026-05-21 prima del brainstorming
della tab Pose 3D:

- compute_delta_wrist generalizzato con cam_to_wrist_perm: la mappa
  cam->polso non e' solo sign-flip ma una permutazione (default
  identita' per backward compat). DeltaOversize ora espone X/Y/Z
  nella stringa d'errore. Test aggiornati.

- G1Client.wrist_absolute / wrist_relative: precise=True di default
  (era False). Stessa cosa per wrist_routes.AbsoluteReq Pydantic
  e per agent.tools move_wrist_*. Movimenti reali ora chiedono
  controllo accurato salvo override esplicito.

- Tab Braccio DX:
  - /verify_tag endpoint: snapshot wrist FK + tag id=1 dalla front
    camera. Per verifica relativa moveto vs marker (no calibrazione).
  - GUI: pannello "Verifica tag id=1" + campi camera_offset_wrist_mm.
  - markUserTouchedOnInput esteso a raOff/raSgn/raCamOff.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 15:44:48 +02:00
Adriano Dal PastroandClaude Opus 4.7 1fa7d12ad7 feat(right_arm): force, camera↔polso offset, cluster filter sul centroide
Tre miglioramenti al move-toward dopo il primo uso live:

1. checkbox "force" accanto a "Muovi": bypassa max_step_m quando
   l'utente sa che il delta richiesto e' grande ma corretto (es. primo
   avvicinamento all'oggetto).

2. camera_offset_wrist_mm: il modello assumeva camera e TCP coincidenti
   (sole sign flips). La camera Nuwa e' invece montata con traslazione
   costante rispetto al polso. La formula diventa:
       delta_wrist = sign * (centroid_cam - offset_cam) + t_wrist_cam
   Esposto in config (default 0,0,0), GUI (3 input "Camera rispetto a
   polso (mm)") e in /state. Il termine compensa il fatto che muovere
   il polso porta la camera, non il TCP, sul punto di presa.

3. filter_nearest_cluster: il centroide era media di tutti i punti
   SAM21 della mask. In presenza di sfondo lontano visibile attraverso
   buchi della depth del primo piano la media veniva trascinata a
   metri di distanza. Ora si tiene il cluster piu' vicino:
       z_near = p5(Z)
       keep   = punti con Z <= z_near + cluster_depth_window_m
   Default window 0.20 m, configurabile. La risposta di /detect/wrist
   espone n_sam21_points, n_centroid_points e z_near/z_cutoff per
   diagnosi.

Aggiornata anche la persistenza: /offset accetta camera_offset_wrist_mm.
GUI: i campi Offset/Sign/CamOff rispettano "user touched" (refresh non
li cancella mentre l'utente digita).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 12:18:24 +02:00
Adriano Dal PastroandClaude Opus 4.7 2f6444c0a5 fix(right_arm): bbox dict, image_size da /api/status, tab non seleziona robot
Tre problemi della tab Braccio DX dopo il primo rodaggio:

1. /detect/front e /detect/wrist ritornavano bbox raw dal YOLO server,
   che lo manda come lista [x1,y1,x2,y2]; la GUI legge bbox.x1 e mostra
   NaN. Ora il router normalizza il payload via perception/detector
   ._normalize, allineandosi al resto del codice. Aggiunta regressione
   con payload reale del server.

2. La tab gateava su robot.active==g1 && wrist_side==right con banner
   "Attiva G1 right" e POST /activate. Confonde: la selezione del
   robot e' globale e non si flippa per-feature. Rimossi banner,
   bottone, endpoint /activate e _guard_g1_right(); gli endpoint
   operano sul polso destro del robot attivo qualunque esso sia.

3. image_size: [0,0] perche' Nuwa /api/intrinsics non include
   width/height; vivono in /api/status > data.resolution. Aggiunto
   NuwaClient.image_size() e usato in detect_front. Aggiornato
   docstring di intrinsics() per coerenza con il payload reale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 11:43:05 +02:00
Adriano Dal PastroandClaude Opus 4.7 848cd962c4 fix(gui): conferma esplicita su Muovi quando dry-run off
Coerente con le conferme di Home e Custom: gesto fisico richiede consenso.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 12:47:34 +02:00
Adriano Dal Pastro 8297abb61d feat(gui): right_arm.js — auto-refresh, detect, move, home, custom 2026-05-20 12:43:55 +02:00
Adriano Dal PastroandClaude Opus 4.7 03ecbbae4e fix(gui): allinea CSS tab Braccio DX al tema dark esistente
- Sostituisce colori hardcoded con CSS variables (--bg/--panel/--border/--dim/--warn/--ok/--danger)
- Scope .dim a #tab-right-arm per non alterare altre tab che usano la classe
- Aggiunge white-space pre-wrap a .ra-result per testi multi-riga

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 12:40:55 +02:00
Adriano Dal Pastro 2f8c7006ba feat(gui): markup + CSS tab Braccio DX 2026-05-20 12:38:01 +02:00
Adriano Dal PastroandClaude Opus 4.7 b0a2d7141d feat(find_model gui): toggle to overlay work plane as a violet polygon
The find_model response now returns plane_polygon_px (4 corners of a
30 cm square anchored at the work plane centroid, projected to RGB
pixels via the same K used for the SAM21 cloud). The GUI gains a
'Piano (viola)' checkbox that draws the polygon as a translucent
violet quad with an outline, helping the operator see whether the
plane sits where expected relative to the object.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 11:53:16 +02:00
Adriano Dal PastroandClaude Opus 4.7 2fe7a7a7fa feat(find_model gui): toggle to overlay full SAM21 cluster (yellow)
Adds a 4th checkbox 'Punti SAM21 (gialli)' that draws the full SAM21
segmentation (input to both the plane partition and Open3DModel) on
the RGB result canvas. The backend now returns sam21_points_px and
n_sam21 alongside the existing accepted/excluded splits.

Useful as a sanity check: visualise what was actually segmented vs
what the plane filter kept/rejected vs where the STL got placed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 11:40:24 +02:00
Adriano Dal PastroandClaude Opus 4.7 767d91acdc feat(work_plane gui): show fit inliers as blue scatter in 3D, drop wrong plane mesh
The 0.4x0.4 PlaneGeometry square was a fixed-size proxy that did not
reflect the actual ROI extent — visually misleading. Replace it with
an explicit blue point cloud of the inliers fed to fit_plane_svd, so
the user can see *exactly* which depth pixels the plane was fit on.

- Backend: fit response now returns fit_points_camera (CV frame) instead
  of the (parallax-shifted) RGB pixel projection.
- Frontend: drop the purple plane mesh; new three.setFitInliers paints
  the inliers in blue. The RGB overlay no longer carries blue dots.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 11:20:03 +02:00
Adriano Dal PastroandClaude Opus 4.7 ae510e4387 feat(work_plane gui): overlay inliers used for fit as blue dots on RGB
The fit endpoint now returns fit_points_px (the post-outlier-filter
inliers projected to RGB pixels via Nuwa's RGB intrinsics). The GUI
draws them on the same overlay as the ROI rectangle so the user can
visually verify which depth pixels were fed to fit_plane_svd.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 11:10:25 +02:00
Adriano Dal PastroandClaude Opus 4.7 76e0739620 fix(work_plane): allow negative offset_mm + readable validation errors
- Drop the ge=0 constraint on FitReq.offset_mm (negative values are a
  documented usage: aggressive noise cull above the plane).
- HTML input min lowered to -200 to match.
- Render FastAPI 422 validation arrays as a human-readable string in the
  status chip (was showing "[object Object]").

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 11:03:36 +02:00
Adriano Dal PastroandClaude Opus 4.7 92506d62c6 fix(work_plane gui): preserve ROI overlay across RGB live-refresh
Setting canvas.width/height clears its bitmap; the live RGB tick was
firing the img.load handler every second, wiping the ROI rectangle and
breaking the two-click flow (third click was interpreted as restart).

- Only mutate canvas size when image resolution actually changes.
- Re-paint the overlay after each load so the ROI persists.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 10:58:41 +02:00
Adriano Dal PastroandClaude Opus 4.7 33d66019ee feat(web): Cerca modello — model picker + find_model overlay handlers
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 10:12:46 +02:00
Adriano Dal PastroandClaude Opus 4.7 af8d4d6fc4 feat(web): rebuild Cerca modello tab — model picker + result canvas
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 10:10:35 +02:00
Adriano Dal PastroandClaude Opus 4.7 56f8888217 fix(gui): work_plane 3D view = camera POV + red = excluded points
- Camera at origin (CV frame) looking at +Z with screen-up = CV −Y, so
  the rendered scene matches the camera's vantage point. OrbitControls
  retargets to the plane centroid on fit so rotation feels natural.
- Simplify scatter coloring to two tones: red for filter-excluded points
  (signed_distance < −offset_mm/1000), cyan-white for everything kept.
  Matches the backend filter contract exactly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 17:41:03 +02:00
Adriano Dal PastroandClaude Opus 4.7 652fa4b912 fix(gui): two-click ROI on Calibrazione Piano (was shift+drag)
User asked for "2 punti" — replace the drag-to-rectangle interaction with
two discrete clicks: first click places corner A (cross marker), second
click defines the rectangle, third click starts a new selection.
Rectangles smaller than 10×10 px are rejected. Status chip guides the
flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 17:38:43 +02:00
Adriano Dal PastroandClaude Opus 4.7 b4db712cd0 fix(gui): work_plane RGB feed via same-origin proxy
Direct fetch to http://localhost:8877/api/rgb fails from the browser due
to CORS (page is served from :8890). Switch to /api/calibration/rgb.jpg
which presa-mano already proxies same-origin.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 17:36:56 +02:00
Adriano Dal PastroandClaude Opus 4.7 57bd252375 fix(gui+api): cleanup before merge
- Rename "TrovaUtensile" tab → "Cerca modello".
- Remove the "Precisione (ultime 5 detection)" stats panel and the
  "Dettagli" JSON dump from the grasp tab; keep hidden stubs so the
  existing app.js continuous-loop code doesn't null-deref.
- Add work_plane_routes to api/__init__.py imports + __all__ (consistency
  with the other routers).
- Trim the misleading "drag = pan · wheel = zoom · doppio click = reset"
  hint from the Calibrazione Piano RGB label — pan/zoom isn't wired.
- Disable wpClearBtn initially so it doesn't flash clickable before
  fetchSaved() resolves.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 17:23:29 +02:00
Adriano Dal PastroandClaude Opus 4.7 ae84739c64 feat(gui): Calibrazione Piano tab (ROI + fit preview + 3D viewer)
New tab replaces the removed Servo Visuale. Shift+drag on the RGB image
defines a rectangle, 'Calcola piano' calls POST /api/work_plane/fit and
renders the plane + a colored scatter in 3D. Adjusting the offset slider
re-colors the scatter client-side. 'Salva piano' persists; 'Rimuovi piano
salvato' clears.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 17:08:32 +02:00