feat: complete multi-robot benchmark pipeline with FCL contact diagnostics, 3 modes, and clean docs

This commit is contained in:
2026-09-01 00:34:39 +02:00
parent 39ab9d77e1
commit d7ae42c07c
38 changed files with 114695 additions and 5061 deletions
+60 -150
View File
@@ -9,61 +9,31 @@ Dieses Repository enthält die vollständige **Execution-Grounding- und Validier
Die Pipeline evaluiert, ob durch Graphenkompression erzeugte Subgraphen ausreichen, damit Roboterarme Zielobjekte kollisionsfrei manipulieren können, oder ob der Arm durch ungesehene Hindernisse greift.
Getestet wird auf zwei standardisierten Roboter-Kinematiken:
1. 🦾 **AgileX Piper (6-DoF)** – Kompakter Leichtbau-Manipulator ($r_{\max} = 52.0\,\text{cm}$)
2. 🐼 **Franka Emika Panda (7-DoF)** – Weltweiter akademischer Standard ($r_{\max} = 85.5\,\text{cm}$)
---
## 🦾 Unterstützte Roboterarme
1. 🦾 **AgileX Piper (6-DoF):** Kompakter Leichtbau-Manipulator ($r_{\max} = 52.0\,\text{cm}$)
2. 🐼 **Franka Emika Panda (7-DoF):** Weltweiter akademischer Standard ($r_{\max} = 85.5\,\text{cm}$)
---
## 🏗️ Systemarchitektur
## 🏗️ 2-Phasen-Architektur nach ICRA-Standard
```mermaid
flowchart TD
subgraph Data [1. FunGraph3D Datensatz]
PLY[3D Punktwolke: scene.ply]
ANN[Annotationen: 348 Objekte]
REL[Affordanzen: 230 Relationen]
end
Um das physikalische Greifen an Schränken, Schubladen und Haushaltsgeräten realitätsgetreu abzubilden, folgt die Pipeline dem **MoveIt 2 Greifstandard (*Pre-Grasp Standoff & Allowed Collision Matrix*)**:
subgraph Policy_Layer [2. Resolution Policy / Subgraph]
TASK[Task: z.B. 'open microwave']
POL[Policy: z.B. Combined Quantile / Radius]
SUB[PolicyResult: Detail-Level pro Objekt]
end
subgraph MoveIt2_Planning [3. MoveIt 2 & OMPL in ROS 2 Humble]
DOCKER[Docker Container: ROS 2 Humble + MoveIt 2]
ROBOTS[Roboter-Auswahl: Piper 6-DoF | Franka Panda 7-DoF]
PS_RED[MoveIt2 PlanningScene: Reduzierter Subgraph]
OMPL[OMPL Planer: RRTConnect]
end
subgraph Validation [4. Ground-Truth Kollisionsprüfung]
TRAJ[Geplante Gelenktrajektorie Q t]
PS_FULL[PlanningScene: Reale Gesamtszene]
FCL[MoveIt 2 Native FCL Engine: /check_state_validity]
SAFE[🟢 SAFE: Kollisionsfreier Ausweichpfad]
UNSAFE[🔴 UNSAFE: Kollision mit ungesehenem Objekt 💥]
INF[⚪ INFEASIBLE: Kein Pfad möglich]
end
PLY --> PS_FULL
ANN --> POL
REL --> POL
TASK --> POL
POL --> SUB
SUB --> PS_RED
ROBOTS --> OMPL
PS_RED --> OMPL
OMPL --> TRAJ
TRAJ --> FCL
PS_FULL --> FCL
FCL --> SAFE
FCL --> UNSAFE
OMPL -->|Kein Pfad im Subgraphen| INF
```text
┌────────────────────────────────────────────────────────────────────────┐
│ 1. GLOBALER AUSWEICHPLAN (Phase 1: OMPL RRTConnect) │
│ • Ziel: Pre-Grasp Pose (10 cm vor dem Griff im freien Raum) │
│ • Kollisionskörper: GESAMTE KÜCHE (alle 30-43 Objekte aktiv!) │
│ • Roboter navigiert kollisionsfrei um alle Geräte & Möbel │
├────────────────────────────────────────────────────────────────────────┤
│ 2. FCL WEGPUNKT-VALIDIERUNG & ACM-GREIFERFREIGABE (Phase 2) │
│ • Native FCL 3D-Mesh-Prüfung an jedem Trajektorien-Wegpunkt │
│ • Armglieder (Schulter, Ellbogen, Unterarm) dürfen nie kollidieren │
│ • Greiferspitzen dürfen das Ziel-Interaktionsobjekt kontaktieren │
└────────────────────────────────────────────────────────────────────────┘
```
---
@@ -72,40 +42,31 @@ flowchart TD
```
.
├── docker/ # Docker-Umgebung (ROS 2 Humble + MoveIt 2 + Piper + Franka)
│ ├── Dockerfile # Basiert auf osrf/ros:humble-desktop-full
│ ├── docker-compose.yml # Mounts für Workspace, Dataset und WSLg GUI-Forwarding
│ ├── entrypoint.sh # Automatisches Sourcing von ROS 2 und Piper-Workspace
│ └── README.md # Kurzanleitung für Docker-Container
├── docker/ # ROS 2 Humble & MoveIt 2 Docker-Umgebung
│ ├── Dockerfile # Basiert auf osrf/ros:humble-desktop-full + MoveIt 2
│ ├── docker-compose.yml # Mounts für Workspace, Dataset und WSLg GUI
│ └── entrypoint.sh # Automatisches Sourcing
│
├── Dataset/ # FunGraph3D Datensatz
│ └── FunGraph3D.tar.gz # Komprimiertes Archiv des Gesamtdatensatzes (14 Szenen)
│ └── FunGraph3D.tar.gz # Gesamtdatensatz (14 Szenen, 348 Objekte)
│
├── src/ # ROS 2 / MoveIt 2 Benchmark & Evaluatoren
│ ├── moveit2_batch_grounding.py # Multi-Robot Benchmark über alle 192 Szenarien (Docker)
│ ├── test_single_moveit_action.py # Einzeltest-Skript für den MoveGroup Action Client
│ └── test_arm_execution_grounding.py # Standalone-Prototyp (reines Python)
├── src/ # ROS 2 Benchmark-Knoten
│ ├── moveit2_batch_grounding.py # Multi-Robot Benchmark mit Run-Tracking (--tag)
│ └── test_single_moveit_action.py # Einzeltest-Skript für den Action Client
│
├── tools/ # Hilfswerkzeuge, Dashboard & Visualisierung
│ ├── generate_benchmark_report.py # Erzeugt Markdown-Bericht, Dashboard & Paper-Charts
│ ├── render_scene_images.py # Automatische 3D-PNG-Renderings für Paper & Präsentationen
├── tools/ # Reporting, Dashboard & Visualisierung
│ ├── generate_benchmark_report.py # Erzeugt Markdown-Bericht, HTML-Dashboard & Plots
│ ├── render_scene_images.py # Automatische 3D-PNG-Renderings für Publikationen
│ └── visualize_placement.py # Interaktiver 3D-Plotly-Viewer für den Browser
│
├── results/ # Benchmark-Ergebnisse & Metriken
│ ├── moveit2_benchmark_piper.json # Ergebnisse für AgileX Piper (6-DoF)
│ ├── moveit2_benchmark_panda.json # Ergebnisse für Franka Emika Panda (7-DoF)
│ ├── benchmark_dashboard.html # Interaktives Multi-Robot Web-Dashboard
├── results/ # Benchmark-Ergebnisse
│ ├── runs/ # Versioniertes Run-Archiv mit Zeitstempel & Tags
│ ├── moveit2_benchmark_piper.json # Aktuellste Ergebnisse: Piper (6-DoF)
│ ├── moveit2_benchmark_panda.json # Aktuellste Ergebnisse: Panda (7-DoF)
│ ├── benchmark_dashboard.html # Interaktives Multi-Robot & History Dashboard
│ └── BENCHMARK_REPORT.md # Vollständiger Auswertungsbericht mit LaTeX-Tabelle
│
├── figures/ # Abbildungen & Plots
│ ├── benchmark_summary_chart.png # 300-DPI-Vergleichsgrafik (Piper vs. Panda)
│ └── generated/ # Automatisch gerenderte PNG-Szenenbilder
│
├── scratch/ # Vorverarbeitungs- & Analyse-Skripte
│ └── verified_placements.json # 192 berechnete Fixpunkte (Basis, Ziel, Hindernis)
│
├── Piper_Placements_and_Benchmark_Scenarios.md # Vollständiger Posenkatalog
├── MoveIt2_Execution_Grounding_and_Commands_Guide.md # Befehls- & Schnittstellen-Leitfaden
├── figures/ # Abbildungen & Plots (300 DPI)
└── README.md # Diese Dokumentation
```
@@ -113,14 +74,8 @@ flowchart TD
## 🚀 Schnellstart & Installation
### Voraussetzungen
* **Docker** & **Docker Compose**
* Für GUI-Anzeige (RViz2) unter Windows: **WSL2 mit WSLg** (Windows 11) oder ein X-Server wie VcXsrv.
* Für lokale Python-Tools: [uv](https://github.com/astral-sh/uv) oder Python 3.10+.
### 1. Dataset entpacken (falls frisch geklont)
```bash
# Entpackt das Archiv in den Dataset-Ordner
tar -xzf Dataset/FunGraph3D.tar.gz -C Dataset/
```
@@ -129,10 +84,6 @@ tar -xzf Dataset/FunGraph3D.tar.gz -C Dataset/
cd docker
docker compose build
docker compose up -d
```
### 3. In den Container einloggen
```bash
docker compose exec piper_moveit bash
```
@@ -144,89 +95,48 @@ Im Docker-Container benötigst du zwei Terminal-Instanzen:
### Option A: AgileX Piper (6-DoF)
```bash
# Terminal 1: Piper MoveIt 2 MoveGroup starten
# Terminal 1: MoveGroup starten
ros2 launch piper_with_gripper_moveit demo.launch.py
# Terminal 2: Benchmark für Piper starten
python3 /workspace/src/moveit2_batch_grounding.py --robot piper
# Terminal 2: Benchmark mit Modus & Run-Tag starten (Standard: full_room)
python3 /workspace/src/moveit2_batch_grounding.py --robot piper --mode full_room --tag v2_contacts
```
### Option B: Franka Emika Panda (7-DoF)
```bash
# Terminal 1: Franka Panda MoveIt 2 MoveGroup starten
# Terminal 1: MoveGroup starten
ros2 launch moveit_resources_panda_moveit_config demo.launch.py
# Terminal 2: Benchmark für Franka Panda starten
python3 /workspace/src/moveit2_batch_grounding.py --robot panda
# Terminal 2: Benchmark mit Modus & Run-Tag starten (Standard: full_room)
python3 /workspace/src/moveit2_batch_grounding.py --robot panda --mode full_room --tag v2_contacts
```
---
## 📊 Benchmark-Ergebnisse (Baseline Validierung)
Die Baselines wurden über alle **192 Interaktionsszenarien aus allen 14 Szenen** von FunGraph3D mit MoveIt 2's nativer FCL-Kollisions-Engine evaluiert:
| Roboterarm | Evaluierungsmodus | 🟢 `SAFE` (Kollisionsfrei) | 🔴 `UNSAFE` (Kollision 💥) | ⚪ `INFEASIBLE` | ⏱️ Mittlere Planungszeit ($t_{\text{plan}}$) |
| :--- | :--- | :---: | :---: | :---: | :---: |
| **AgileX Piper** *(6-DoF)* | **Full Scene (Oracle)** | **91.7 %** (176/192) | **0.0 %** (0/192) | 8.3 % (16/192) | **0.87 s** |
| | **Empty Scene (Blind)** | 88.5 % (170/192) | **11.5 %** (22/192) | 0.0 % (0/192) | **0.04 s** |
| :--- | :--- | :---: | :---: | :---: | :---: |
| **Franka Panda** *(7-DoF)* | **Full Scene (Oracle)** | **91.7 %** (176/192) | **0.0 %** (0/192) | 8.3 % (16/192) | **0.95 s** |
| | **Empty Scene (Blind)** | 82.3 % (158/192) | **17.2 %** (33/192) | 0.5 % (1/192) | **0.05 s** |
### Wissenschaftliche Erkenntnisse für das Paper:
1. **0.0 % Unsafe bei `Oracle`:** Beide Roboterarme beweisen mit MoveIt 2 absolute Kollisionsfreiheit, wenn die Hindernisse wahrgenommen werden.
2. **Der „Swept-Volume“-Effekt:** Der größere 7-DoF Franka Panda ($85.5\,\text{cm}$ Reichweite) kollidiert im blinden Zustand mit **17.2 %** signifikant häufiger als der kompakte 6-DoF Piper (**11.5 %**). Größere Roboterarme benötigen somit eine noch feinere Subgraphen-Auflösung in Hindernisnähe!
3. **Nullraum-Vorteil:** Der 7-DoF-Arm löst Planungsanfragen dank kinematischer Redundanz und großem Arbeitsraum extrem zuverlässig.
### 🎛️ Verfügbare Evaluierungsmodi (`--mode`)
* `--mode full_room` *(Standard & Empfohlen)*: Vollständige Küche (30–43 Objekte) mit Parent-Entity-Freistellung für den Zielgriff.
* `--mode naive_full` *(Diagnose)*: Ungefilterte Gesamtszene (zur Analyse von Greifraum-Blockaden).
* `--mode single_pair` *(Baseline)*: Klassischer Einzelhindernis-Test im Anfahrtskorridor.
---
## 🌐 Interaktives Dashboard & Berichte generieren
## 🏷️ Versioniertes Run-Tracking-System (`--tag`)
Nach einem Benchmark-Lauf können die Berichte, das interaktive Web-Dashboard und die Paper-Grafiken mit einem einzigen Befehl aktualisiert werden:
Jeder Durchlauf kann mit einem eindeutigen Bezeichner getaggt werden:
* Das Skript archiviert jeden Lauf automatisch unter `results/runs/YYYYMMDD_HHMMSS_<ROBOT>_<TAG>.json`.
* So können verschiedene Heuristiken, Greifabstände oder Subgraphen-Policies historisch verglichen werden.
---
## 🌐 Dashboard & Berichte generieren
Nach den Durchläufen erzeugt ein einzelner Befehl alle Auswertungen:
```bash
uv run --python 3.12 --with matplotlib --with numpy python tools/generate_benchmark_report.py
```
* 🌐 **Web-Dashboard öffnen:** [`results/benchmark_dashboard.html`](results/benchmark_dashboard.html) im Browser öffnen (unterstützt Umschalten zwischen Piper, Franka Panda und Side-by-Side-Vergleich!).
* 📄 **Markdown & LaTeX:** [`results/BENCHMARK_REPORT.md`](results/BENCHMARK_REPORT.md) enthält die fertige `\begin{table}` fürs Paper.
* 📈 **Grafik:** [`figures/benchmark_summary_chart.png`](figures/benchmark_summary_chart.png) als 300-DPI Publikationsabbildung.
---
## 📸 Automatische 3D-Bildgenerierung für Paper & Präsentationen
Mit [`tools/render_scene_images.py`](tools/render_scene_images.py) können 3D-Bilder der Manipulationssituationen gerendert werden:
```bash
# Generiere die ersten 10 Szenarien als PNG:
uv run --python 3.12 --with matplotlib --with plyfile --with numpy python tools/render_scene_images.py --count 10
# Gezielt für eine bestimmte Szene (z. B. 0kitchen, 3kitchen oder 1bathroom):
uv run --python 3.12 --with matplotlib --with plyfile --with numpy python tools/render_scene_images.py --scene 0kitchen --count 5
```
---
## 🔌 Schnittstelle zur Integration von Resolution Policies
Um eine neue Subgraphen-Policy zu evaluieren, übergibt man dem Evaluator das resultierende Dictionary der Detailstufen:
```python
# Schema eines Policy-Ergebnisses:
policy_result = {
"node_annot_id_1": "POINT CLOUD", # Detailliertes Kollisionsobjekt
"node_annot_id_2": "BOUNDING BOX", # 3D-Quader (SolidPrimitive::BOX)
"node_annot_id_3": "LABEL", # Nicht in MoveIt2 geladen (Kompression)
"node_annot_id_4": "REMOVE" # Nicht in MoveIt2 geladen (Kompression)
}
# MoveIt 2 baut die PlanningScene auf Basis der Zuweisung auf:
# - 'BOUNDING BOX' & 'POINT CLOUD' werden als Hindernisse registriert.
# - 'LABEL' & 'REMOVE' werden ignoriert.
# - Trajektorie wird geplant und mit FCL (/check_state_validity) gegen die reale Gesamtszene validiert.
```
* 🌐 **Interaktives Web-Dashboard:** [`results/benchmark_dashboard.html`](results/benchmark_dashboard.html) im Browser öffnen (inklusive **Run-History**, **Piper**, **Panda** und **Side-by-Side-Vergleich**).
* 📄 **Markdown & LaTeX:** [`results/BENCHMARK_REPORT.md`](results/BENCHMARK_REPORT.md) mit publikationsfertiger `\begin{table}`.
* 📈 **Abbildung:** [`figures/benchmark_summary_chart.png`](figures/benchmark_summary_chart.png) (300 DPI).
---
Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

+5 -4
View File
@@ -7,10 +7,11 @@ Dieses Docker-Setup stellt eine vollständige Entwicklungsumgebung für den **Ag
## 📦 Enthaltene Pakete & Tools
* **Basis:** Ubuntu 22.04 LTS + `ros-humble-desktop-full`
* **Motion Planning:** MoveIt 2 (`ros-humble-moveit`, OMPL Planners, OctoMap)
* **Roboter-Treiber & URDF:** [agilexrobotics/piper_ros (Branch: humble)](https://github.com/agilexrobotics/piper_ros/tree/humble)
* `piper_description` / `agx_arm_urdf` (URDF & Xacro)
* `piper_moveit2` / `piper_with_gripper_moveit` (MoveIt-Konfiguration für den 6-DoF Arm)
* **Motion Planning:** MoveIt 2 (`ros-humble-moveit`, OMPL Planners, FCL Collision Engine)
* **Roboter-Treiber & URDFs:**
* 🦾 **AgileX Piper (6-DoF):** `piper_description`, `piper_with_gripper_moveit`
* 🐼 **Franka Emika Panda (7-DoF):** `moveit_resources_panda_moveit_config`, `moveit_resources_panda_description`
* Controller: `ros2_controllers`, `joint_state_broadcaster`, `joint_trajectory_controller`
* **Python-Bibliotheken:** `numpy`, `scipy`, `plyfile`, `trimesh`, `transforms3d`, `pyyaml`
* **GUI-Unterstützung:** Natives Windows 11 GUI-Forwarding via WSLg (`/mnt/wslg` & `/tmp/.X11-unix`).
Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 182 KiB

+17 -37
View File
@@ -1,52 +1,32 @@
# 📊 MoveIt 2 Execution Grounding: Cross-Robot Benchmark Report
# MoveIt 2 Execution Grounding Multi-Robot Benchmark Report
Dieses Dokument vergleicht die **Baseline-Ergebnisse** (*Oracle vs. Blind Baseline*) über **192 Manipulationsszenarien** auf dem *FunGraph3D*-Datensatz für zwei standardisierte Forschungsroboter:
1. 🦾 **AgileX Piper (6-DoF)** – Kompakter Manipulator ($r_{\max} = 52.0\,\text{cm}$)
2. 🐼 **Franka Emika Panda (7-DoF)** – Akademischer Gold-Standard ($r_{\max} = 85.5\,\text{cm}$)
*Generated: 2026-09-01 00:30:26*
---
## 1. Executive Summary
## 🏆 1. Cross-Robot Benchmark Vergleich
| Roboterarm | Evaluierungsmodus | 🟢 `SAFE` (Kollisionsfrei) | 🔴 `UNSAFE` (Kollision 💥) | ⚪ `INFEASIBLE` | ⏱️ Mittlere Planungszeit ($t_{\text{plan}}$) |
| Robot | Evaluation Mode | 🟢 Safe (Success) | 🔴 Unsafe (Crash 💥) | ⚪ Infeasible | Mean Plan Time |
| :--- | :--- | :---: | :---: | :---: | :---: |
| **AgileX Piper** *(6-DoF)* | **Full Scene (Oracle)** | **176 (91.7 %)** | **0 (0.0 %)** | 16 (8.3 %) | **0.06 s** |
| | **Empty Scene (Blind)** | 170 (88.5 %) | **22 (11.5 %)** | 0 (0.0 %) | **0.06 s** |
| :--- | :--- | :---: | :---: | :---: | :---: |
| **Franka Panda** *(7-DoF)* | **Full Scene (Oracle)** | **176 (91.7 %)** | **0 (0.0 %)** | 16 (8.3 %) | **0.05 s** |
| | **Empty Scene (Blind)** | 158 (82.3 %) | **33 (17.2 %)** | 1 (0.5 %) | **0.02 s** |
| **AgileX Piper (6-DoF)** | **Full Scene (Oracle)** | **78.7%** (181/230) | **0.9%** (2/230) | 20.4% (47/230) | 0.07s |
| | **Empty Scene (Blind)** | 71.7% (165/230) | **28.3%** (65/230) | 0.0% (0/230) | 0.05s |
| **Franka Panda (7-DoF)** | **Full Scene (Oracle)** | **74.8%** (172/230) | **0.0%** (0/230) | 25.2% (58/230) | 0.09s |
| | **Empty Scene (Blind)** | 50.4% (116/230) | **49.1%** (113/230) | 0.4% (1/230) | 0.02s |
---
## 🔍 2. Wissenschaftliche Kernaussagen für das ICRA 2027 Paper
1. **Perfekte Obere Schranke für beide Kinematiken:**
Sowohl der 6-DoF Piper als auch der 7-DoF Franka Panda erreichen im `Oracle`-Modus **exakt 0.0 % Kollisionen (`unsafe`)** und identische **91.7 % Erreichbarkeit (`safe`)**. Das beweist, dass MoveIt 2's OMPL-Planer die Szene für beide Arme fehlerfrei beherrscht.
2. **Einfluss des Robotervolumens (*Swept Volume*):**
* Beim **Franka Panda** führt das blinde Planen zu **17.2 % Kollisionen** (33 Fälle).
* Beim **AgileX Piper** führt das blinde Planen zu **11.5 % Kollisionen** (22 Fälle).
* **Erklärung:** Der Franka Panda besitzt längere Glieder und voluminösere Gelenke ($85.5\,\text{cm}$ vs. $52.0\,\text{cm}$). Wenn er blind operiert, überstreicht er ein signifikant größeres 3D-Volumen und kollidiert dadurch häufiger mit Umgebungsobjekten.
---
## 📄 3. Fertige LaTeX-Tabelle für das Paper
## 2. LaTeX Table for ICRA 2027 Paper
```latex
\begin{table}[t]
\begin{table}[ht]
\centering
\caption{Execution Grounding Benchmark across 192 FunGraph3D Scenarios for 6-DoF (AgileX Piper) and 7-DoF (Franka Emika Panda) Manipulators in MoveIt 2.}
\label{tab:execution_grounding_cross_robot}
\caption{Execution-Grounding Benchmark across 6-DoF and 7-DoF Manipulators on FunGraph3D.}
\label{tab:execution_grounding_benchmark}
\begin{tabular}{llcccc}
\toprule
\textbf{Robot Arm} & \textbf{Evaluation Mode} & \textbf{Safe (\%)} & \textbf{Unsafe (\%)} & \textbf{Infeasible (\%)} & \textbf{Time (s)} \\
\textbf{Robot Model} & \textbf{Perception Policy} & \textbf{Safe (\%)} & \textbf{Unsafe (\%)} & \textbf{Infeasible (\%)} & \textbf{$t_{\text{plan}}$ (s)} \\
\midrule
\multirow{2}{*}{\textbf{AgileX Piper (6-DoF)}}
& Full Scene (Oracle) & \textbf{91.7\%} & \textbf{0.0\%} & 8.3\% & 0.06 s \\
& Empty Scene (Blind) & 88.5\% & \textbf{11.5\%} & 0.0\% & 0.06 s \\
\multirow{2}{*}{AgileX Piper (6-DoF)} & Full Scene (Oracle) & \textbf{78.7} & \textbf{0.9} & 20.4 & 0.07 \\
& Empty Scene (Blind) & 71.7 & \textbf{28.3} & 0.0 & 0.05 \\
\midrule
\multirow{2}{*}{\textbf{Franka Panda (7-DoF)}}
& Full Scene (Oracle) & \textbf{91.7\%} & \textbf{0.0\%} & 8.3\% & 0.05 s \\
& Empty Scene (Blind) & 82.3\% & \textbf{17.2\%} & 0.5\% & 0.02 s \\
\multirow{2}{*}{Franka Panda (7-DoF)} & Full Scene (Oracle) & \textbf{74.8} & \textbf{0.0} & 25.2 & 0.09 \\
& Empty Scene (Blind) & 50.4 & \textbf{49.1} & 0.4 & 0.02 \\
\bottomrule
\end{tabular}
\end{table}
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,172 @@
[
{
"case_id": 1,
"scene": "0kitchen",
"robot": "piper",
"tag": "v2_parent_aware",
"target": "kitchen cabinet",
"part": "knob",
"num_room_objects": 37,
"full_scene": {
"outcome": "infeasible",
"plan_time": 0.0
},
"empty_scene": {
"outcome": "unsafe",
"plan_time": 0.034
}
},
{
"case_id": 2,
"scene": "0kitchen",
"robot": "piper",
"tag": "v2_parent_aware",
"target": "kitchen cabinet",
"part": "knob",
"num_room_objects": 37,
"full_scene": {
"outcome": "infeasible",
"plan_time": 0.0
},
"empty_scene": {
"outcome": "unsafe",
"plan_time": 0.095
}
},
{
"case_id": 3,
"scene": "0kitchen",
"robot": "piper",
"tag": "v2_parent_aware",
"target": "kitchen cabinet",
"part": "knob",
"num_room_objects": 36,
"full_scene": {
"outcome": "safe",
"plan_time": 0.034
},
"empty_scene": {
"outcome": "safe",
"plan_time": 0.013
}
},
{
"case_id": 4,
"scene": "0kitchen",
"robot": "piper",
"tag": "v2_parent_aware",
"target": "kitchen cabinet",
"part": "knob",
"num_room_objects": 36,
"full_scene": {
"outcome": "safe",
"plan_time": 0.179
},
"empty_scene": {
"outcome": "unsafe",
"plan_time": 0.054
}
},
{
"case_id": 5,
"scene": "0kitchen",
"robot": "piper",
"tag": "v2_parent_aware",
"target": "kitchen cabinet",
"part": "knob",
"num_room_objects": 35,
"full_scene": {
"outcome": "infeasible",
"plan_time": 0.0
},
"empty_scene": {
"outcome": "unsafe",
"plan_time": 0.026
}
},
{
"case_id": 6,
"scene": "0kitchen",
"robot": "piper",
"tag": "v2_parent_aware",
"target": "kitchen cabinet",
"part": "knob",
"num_room_objects": 36,
"full_scene": {
"outcome": "infeasible",
"plan_time": 0.0
},
"empty_scene": {
"outcome": "unsafe",
"plan_time": 0.025
}
},
{
"case_id": 7,
"scene": "0kitchen",
"robot": "piper",
"tag": "v2_parent_aware",
"target": "kitchen cabinet",
"part": "knob",
"num_room_objects": 36,
"full_scene": {
"outcome": "infeasible",
"plan_time": 0.0
},
"empty_scene": {
"outcome": "unsafe",
"plan_time": 0.036
}
},
{
"case_id": 8,
"scene": "0kitchen",
"robot": "piper",
"tag": "v2_parent_aware",
"target": "kitchen cabinet",
"part": "knob",
"num_room_objects": 37,
"full_scene": {
"outcome": "safe",
"plan_time": 0.056
},
"empty_scene": {
"outcome": "unsafe",
"plan_time": 0.024
}
},
{
"case_id": 9,
"scene": "0kitchen",
"robot": "piper",
"tag": "v2_parent_aware",
"target": "kitchen cabinet",
"part": "knob",
"num_room_objects": 36,
"full_scene": {
"outcome": "infeasible",
"plan_time": 0.0
},
"empty_scene": {
"outcome": "unsafe",
"plan_time": 0.054
}
},
{
"case_id": 10,
"scene": "0kitchen",
"robot": "piper",
"tag": "v2_parent_aware",
"target": "kitchen cabinet",
"part": "knob",
"num_room_objects": 36,
"full_scene": {
"outcome": "safe",
"plan_time": 0.014
},
"empty_scene": {
"outcome": "safe",
"plan_time": 0.014
}
}
]
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+43
View File
@@ -0,0 +1,43 @@
import json
from collections import Counter
f_v2 = 'results/runs/20260831_215324_piper_full_room_v2_phases.json'
f_v1 = 'results/runs/20260831_215104_piper_naive_full_v1_diagnostic.json'
for tag, fname in [('V1 (naive_full)', f_v1), ('V2 (full_room)', f_v2)]:
with open(fname, 'r', encoding='utf-8') as f:
data = json.load(f)
print(f"\n==================== {tag} ====================")
total = len(data)
safe = sum(1 for d in data if d['empty_scene']['outcome'] == 'safe')
unsafe = sum(1 for d in data if d['empty_scene']['outcome'] == 'unsafe')
print(f"Empty Blind: SAFE={safe} ({safe/total*100:.1f}%) | UNSAFE={unsafe} ({unsafe/total*100:.1f}%)")
t0_contacts = []
motion_contacts = []
goal_contacts = []
for d in data:
contacts = d['empty_scene'].get('contacts', [])
if not contacts:
continue
c0 = contacts[0]
phase = c0.get('phase', '')
summary = f"{c0.get('body_1')} x {c0.get('body_2')} ({c0.get('depth_cm')}cm)"
if 'START' in phase:
t0_contacts.append(summary)
elif 'GOAL' in phase:
goal_contacts.append(summary)
else:
motion_contacts.append(summary)
print(f"Phase Breakdown of first collision:")
print(f" • START (t=0): {len(t0_contacts)} cases")
for s, count in Counter(t0_contacts).most_common(5):
print(f" -> {count}x: {s}")
print(f" • MOTION (en-route): {len(motion_contacts)} cases")
for s, count in Counter(motion_contacts).most_common(5):
print(f" -> {count}x: {s}")
print(f" • GOAL (at target): {len(goal_contacts)} cases")
for s, count in Counter(goal_contacts).most_common(5):
print(f" -> {count}x: {s}")
+59
View File
@@ -0,0 +1,59 @@
import os
import json
from plyfile import PlyData
import numpy as np
base_path = 'Dataset/FunGraph3D/FunGraph3D'
annot_file = os.path.join(base_path, 'FunGraph3D.annotations.json')
rel_file = os.path.join(base_path, 'FunGraph3D.relations.json')
scenes = ['0kitchen', '10kitchen', '11bedroom', '12kitchen', '13bathroom', '1bathroom',
'2livingroom', '3kitchen', '4livingroom', '5kitchen', '6kitchen', '7bedroom',
'8bathroom', '9bedroom']
with open(annot_file, 'r', encoding='utf-8') as f:
annots = json.load(f)
scene_objects = {}
for s_id in scenes:
ply_path = os.path.join(base_path, s_id, f'{s_id}.ply')
if not os.path.exists(ply_path):
print(f"Warning: {ply_path} not found")
continue
ply = PlyData.read(ply_path)
vertex = ply['vertex']
pts = np.vstack([vertex['x'], vertex['y'], vertex['z']]).T
s_annots = [a for a in annots if a['scene_id'] == s_id]
objects_list = []
for a in s_annots:
idx = a['indices']
if len(idx) > 0:
obj_pts = pts[idx]
centroid = obj_pts.mean(axis=0)
bbox_min = obj_pts.min(axis=0)
bbox_max = obj_pts.max(axis=0)
bbox_size = bbox_max - bbox_min
else:
continue
objects_list.append({
'id': a['annot_id'],
'label': a['label'],
'centroid': [round(float(x), 4) for x in centroid],
'bbox_size': [round(float(x), 4) for x in bbox_size],
'bbox_min': [round(float(x), 4) for x in bbox_min],
'bbox_max': [round(float(x), 4) for x in bbox_max]
})
scene_objects[s_id] = objects_list
print(f"Scene {s_id:<12}: Extracted {len(objects_list):<3} full 3D objects")
out_file = 'scratch/full_scene_objects.json'
with open(out_file, 'w', encoding='utf-8') as f:
json.dump(scene_objects, f, indent=2)
print(f"\nSaved all full scene objects to: {out_file}")
+138
View File
@@ -0,0 +1,138 @@
import os
import json
from plyfile import PlyData
import numpy as np
base_path = 'Dataset/FunGraph3D/FunGraph3D'
annot_file = os.path.join(base_path, 'FunGraph3D.annotations.json')
rel_file = os.path.join(base_path, 'FunGraph3D.relations.json')
full_objects_file = 'scratch/full_scene_objects.json'
with open(annot_file, 'r', encoding='utf-8') as f:
annots = json.load(f)
with open(rel_file, 'r', encoding='utf-8') as f:
relations = json.load(f)
with open(full_objects_file, 'r', encoding='utf-8') as f:
all_room_objects = json.load(f)
scenes = ['0kitchen', '10kitchen', '11bedroom', '12kitchen', '13bathroom', '1bathroom',
'2livingroom', '3kitchen', '4livingroom', '5kitchen', '6kitchen', '7bedroom',
'8bathroom', '9bedroom']
def check_base_clearance_xy(base_xy, room_objects, margin=0.18):
"""Checks if base_xy collides with any room object bounding box in 2D"""
for obj in room_objects:
b_min = np.array(obj['bbox_min'])[:2] - margin
b_max = np.array(obj['bbox_max'])[:2] + margin
if b_min[0] <= base_xy[0] <= b_max[0] and b_min[1] <= base_xy[1] <= b_max[1]:
return False, obj['label']
return True, None
def calibrate_scene(s_id):
ply_path = os.path.join(base_path, s_id, f'{s_id}.ply')
if not os.path.exists(ply_path):
return []
ply = PlyData.read(ply_path)
vertex = ply['vertex']
pts = np.vstack([vertex['x'], vertex['y'], vertex['z']]).T
floor_z = np.percentile(pts[:, 2], 2) # true floor level
room_center_xy = pts[:, :2].mean(axis=0)
s_annots = [a for a in annots if a['scene_id'] == s_id]
s_rels = [r for r in relations if r['scene_id'] == s_id]
room_objs = all_room_objects.get(s_id, [])
obj_dict = {a['annot_id']: a for a in s_annots}
placements = []
for r in s_rels:
part_id = r['first_node_annot_id']
parent_id = r['second_node_annot_id']
part = obj_dict.get(part_id)
parent = obj_dict.get(parent_id)
if not part or not parent:
continue
# Extract centroids from room_objs
part_obj = next((o for o in room_objs if o['id'] == part_id), None)
parent_obj = next((o for o in room_objs if o['id'] == parent_id), None)
if part_obj:
tgt_pos = np.array(part_obj['centroid'])
elif parent_obj:
tgt_pos = np.array(parent_obj['centroid'])
else:
continue
# Direction towards open room space
v_open = room_center_xy - tgt_pos[:2]
norm = np.linalg.norm(v_open)
u_open = v_open / (norm + 1e-6) if norm > 1e-4 else np.array([1.0, 0.0])
# Determine standoff distance in free space
# We start at 0.50m and step outwards into free floor space until base is clear
best_base_xy = None
for dist_step in np.linspace(0.46, 0.68, 12):
test_xy = tgt_pos[:2] + u_open * dist_step
is_clear, _ = check_base_clearance_xy(test_xy, room_objs, margin=0.16)
if is_clear:
best_base_xy = test_xy
break
if best_base_xy is None:
# Fallback to standard 0.50m
best_base_xy = tgt_pos[:2] + u_open * 0.50
# Mobile base platform height:
# Standard mobile base is ~35cm above floor level or 20cm below target
base_z = max(floor_z + 0.35, tgt_pos[2] - 0.22)
base_pos = np.array([best_base_xy[0], best_base_xy[1], base_z])
reach = np.linalg.norm(tgt_pos - base_pos)
yaw = np.arctan2(tgt_pos[1] - base_pos[1], tgt_pos[0] - base_pos[0])
# Closest obstacle for reference metadata
best_obs_label = "room_obstacles"
best_obs_pos = tgt_pos + np.array([0.1, 0.1, 0.0])
min_dist = float('inf')
for o in room_objs:
if o['id'] in [part_id, parent_id]:
continue
c = np.array(o['centroid'])
d = np.linalg.norm(tgt_pos - c)
if 0.10 <= d <= 0.85 and d < min_dist:
min_dist = d
best_obs_label = o['label']
best_obs_pos = c
placements.append({
'scene': s_id,
'target': parent['label'],
'part': part['label'],
'affordance': r['description'],
'target_pos': [round(float(x), 4) for x in tgt_pos],
'obstacle': best_obs_label,
'obstacle_pos': [round(float(x), 4) for x in best_obs_pos],
'obstacle_size': [0.20, 0.20, 0.20],
'dist_tgt_obs': round(float(min_dist if min_dist != float('inf') else 0.35), 3),
'arm_reach_dist': round(float(reach), 3),
'base_pos': [round(float(x), 4) for x in base_pos],
'base_yaw_deg': round(float(np.degrees(yaw)), 1)
})
return placements
all_calibrated = []
for s in scenes:
res = calibrate_scene(s)
all_calibrated.extend(res)
print(f"Scene {s:<12}: Calibrated {len(res):<3} placements in free space")
out_file = 'scratch/verified_placements.json'
with open(out_file, 'w', encoding='utf-8') as f:
json.dump(all_calibrated, f, indent=2)
print(f"\nTotal calibrated test cases: {len(all_calibrated)} saved to {out_file}")
+37
View File
@@ -0,0 +1,37 @@
import json
from collections import Counter
runs = {
'Piper (V1 naive)': 'results/runs/20260831_215104_piper_naive_full_v1_diagnostic.json',
'Piper (V2 full_room)': 'results/runs/20260831_215324_piper_full_room_v2_phases.json',
'Panda (V1 naive)': 'results/runs/20260831_222044_panda_naive_full_v1_diagnostic.json',
'Panda (V2 full_room)': 'results/runs/20260831_222552_panda_full_room_v2_phases.json',
}
for label, path in runs.items():
with open(path, 'r', encoding='utf-8') as f:
data = json.load(f)
tot = len(data)
f_safe = sum(1 for d in data if d['full_scene']['outcome'] == 'safe')
f_uns = sum(1 for d in data if d['full_scene']['outcome'] == 'unsafe')
f_inf = sum(1 for d in data if d['full_scene']['outcome'] == 'infeasible')
e_safe = sum(1 for d in data if d['empty_scene']['outcome'] == 'safe')
e_uns = sum(1 for d in data if d['empty_scene']['outcome'] == 'unsafe')
e_inf = sum(1 for d in data if d['empty_scene']['outcome'] == 'infeasible')
phases = []
links = []
obstacles = []
for d in data:
for c in d['empty_scene'].get('contacts', []):
phases.append(c.get('phase', 'UNKNOWN'))
links.append(c.get('body_1', ''))
obstacles.append(c.get('body_2', ''))
print(f"\n==================== {label.upper()} ====================")
print(f"Total: {tot} cases")
print(f" Oracle: Safe={f_safe:<3} ({f_safe/tot*100:.1f}%) | Unsafe={f_uns:<3} ({f_uns/tot*100:.1f}%) | Infeasible={f_inf:<3} ({f_inf/tot*100:.1f}%)")
print(f" Blind : Safe={e_safe:<3} ({e_safe/tot*100:.1f}%) | Unsafe={e_uns:<3} ({e_uns/tot*100:.1f}%) | Infeasible={e_inf:<3} ({e_inf/tot*100:.1f}%)")
print(f" Top Colliding Links: {', '.join([f'{k}({v})' for k, v in Counter(links).most_common(3)])}")
print(f" Top Obstacles: {', '.join([f'{k}({v})' for k, v in Counter(obstacles).most_common(3)])}")
+51
View File
@@ -0,0 +1,51 @@
import os
import json
import numpy as np
# Load placements and scene objects
with open('scratch/verified_placements.json', 'r', encoding='utf-8') as f:
placements = json.load(f)
with open('scratch/full_scene_objects.json', 'r', encoding='utf-8') as f:
all_scenes = json.load(f)
print("Diagnosing collision overlap for first 15 cases...")
for i, cand in enumerate(placements[:15]):
s_id = cand['scene']
base_pos = np.array(cand['base_pos'])
base_yaw = cand['base_yaw_deg']
tgt_pos = np.array(cand['target_pos'])
room_objs = all_scenes.get(s_id, [])
approach = base_pos - tgt_pos
u_app = approach / (np.linalg.norm(approach) + 1e-6)
pre_grasp = tgt_pos + u_app * 0.10
# Check if pre-grasp is inside any room object bounding box:
colliding_objs_at_target = []
colliding_objs_at_base = []
for o in room_objs:
b_min = np.array(o['bbox_min'])
b_max = np.array(o['bbox_max'])
# Check pre-grasp point
if (b_min[0] <= pre_grasp[0] <= b_max[0] and
b_min[1] <= pre_grasp[1] <= b_max[1] and
b_min[2] <= pre_grasp[2] <= b_max[2]):
colliding_objs_at_target.append(f"{o['label']} (id={o['id']})")
# Check base point in 2D
if (b_min[0] - 0.10 <= base_pos[0] <= b_max[0] + 0.10 and
b_min[1] - 0.10 <= base_pos[1] <= b_max[1] + 0.10 and
b_min[2] <= base_pos[2] <= b_max[2]):
colliding_objs_at_base.append(f"{o['label']} (id={o['id']})")
print(f"Case {i+1:<2} ({s_id}, {cand['target'][:15]} - {cand['part'][:8]}):")
if colliding_objs_at_target:
print(f" [!] PRE-GRASP TARGET INSIDE: {', '.join(colliding_objs_at_target)}")
if colliding_objs_at_base:
print(f" [!] ROBOT BASE INSIDE: {', '.join(colliding_objs_at_base)}")
if not colliding_objs_at_target and not colliding_objs_at_base:
print(f" [OK] Free Space Clear!")
File diff suppressed because it is too large Load Diff
+18
View File
@@ -0,0 +1,18 @@
import json
from collections import Counter
fname = 'results/runs/20260831_212236_piper_naive_full_v1_diagnostic.json'
with open(fname, 'r', encoding='utf-8') as f:
data = json.load(f)
pairs = []
for d in data:
for c in d['empty_scene'].get('contacts', []):
b1 = c.get('body_1')
b2 = c.get('body_2')
d_cm = c.get('depth_cm')
pairs.append(f"{b1} x {b2} ({d_cm} cm)")
print("Top 12 Human-Readable Collision Contacts:")
for p, count in Counter(pairs).most_common(12):
print(f" {count:<3}x: {p}")
+27
View File
@@ -0,0 +1,27 @@
import json
import numpy as np
f_v2 = 'results/runs/20260831_215324_piper_full_room_v2_phases.json'
with open(f_v2, 'r', encoding='utf-8') as f:
data = json.load(f)
print("Analyzing the 35 cases with t=0 collision:")
t0_cases = []
for d in data:
contacts = d['empty_scene'].get('contacts', [])
if contacts and 'START' in contacts[0].get('phase', ''):
c = contacts[0]
t0_cases.append({
'case_id': d['case_id'],
'scene': d['scene'],
'target': d['target'],
'part': d['part'],
'body_1': c['body_1'],
'body_2': c['body_2'],
'depth_cm': c['depth_cm'],
'point': c['point']
})
print(f"Found {len(t0_cases)} cases with t=0 collision.")
for c in t0_cases[:10]:
print(f"Case #{c['case_id']:<3} in {c['scene']:<10} | Target: {c['target'][:15]:<16} | Hit: {c['body_1']} x {c['body_2']} (depth: {c['depth_cm']}cm, point: {c['point']})")
+21
View File
@@ -0,0 +1,21 @@
import json
with open('scratch/full_scene_objects.json', 'r', encoding='utf-8') as f:
scenes = json.load(f)
id_to_label = {}
for s_id, objs in scenes.items():
for o in objs:
id_to_label[o['id']] = f"{o['label']} in {s_id}"
top_ids = [
'93bc40e7-e4d3-4a03-a0ec-b587ccc52159',
'1d98b33b-fbed-463f-8a31-4a7e2ba9d6b4',
'57af8075-e6f1-4a8f-ad01-f9124fd322ee',
'02c5fb08-9d63-4b5d-990c-959aacacef35',
'76af3134-447f-42fa-80b0-db98f4dcf728',
'fa25f213-0aa8-4084-97ff-a990f17f4302'
]
for tid in top_ids:
print(f"{tid}: {id_to_label.get(tid, 'unknown')}")
+48
View File
@@ -0,0 +1,48 @@
import os
import json
import numpy as np
with open('scratch/verified_placements.json', 'r', encoding='utf-8') as f:
placements = json.load(f)
with open('scratch/full_scene_objects.json', 'r', encoding='utf-8') as f:
all_scenes = json.load(f)
with open('Dataset/FunGraph3D/FunGraph3D/FunGraph3D.relations.json', 'r', encoding='utf-8') as f:
relations = json.load(f)
print(f"Testing parent-aware object filtering on {len(placements)} cases...")
total_clear = 0
for i, cand in enumerate(placements):
s_id = cand['scene']
base_pos = np.array(cand['base_pos'])
tgt_pos = np.array(cand['target_pos'])
room_objs = all_scenes.get(s_id, [])
# Exempt objects within 25cm of target (the parent furniture body being manipulated)
# and objects within 18cm of base footprint
active_obstacles = []
for o in room_objs:
c = np.array(o['centroid'])
b_min = np.array(o['bbox_min'])
b_max = np.array(o['bbox_max'])
# Check if target is inside or right on this object (it is the parent furniture)
dist_to_tgt = np.linalg.norm(c - tgt_pos)
is_parent = (b_min[0]-0.05 <= tgt_pos[0] <= b_max[0]+0.05 and
b_min[1]-0.05 <= tgt_pos[1] <= b_max[1]+0.05 and
b_min[2]-0.05 <= tgt_pos[2] <= b_max[2]+0.05)
is_under_base = (b_min[0]-0.08 <= base_pos[0] <= b_max[0]+0.08 and
b_min[1]-0.08 <= base_pos[1] <= b_max[1]+0.08 and
b_min[2] <= base_pos[2] <= b_max[2])
if is_parent or is_under_base:
continue
active_obstacles.append(o)
if len(active_obstacles) >= 5:
total_clear += 1
print(f"Total cases with cleanly isolated surrounding obstacles: {total_clear}/{len(placements)} ({total_clear/len(placements)*100:.1f}%)")
File diff suppressed because it is too large Load Diff
+274 -76
View File
@@ -1,10 +1,34 @@
#!/usr/bin/env python3
"""
ROS 2 MoveIt 2 Batch Execution Grounding Benchmark.
Supports:
1. AgileX Piper (6-DoF Arm)
2. Franka Emika Panda (7-DoF Arm)
Uses MoveIt 2's native FCL Collision Engine (/check_state_validity) and /move_action.
========================================================================================
TASK-DRIVEN 3D SCENE GRAPHS: EXECUTION GROUNDING BENCHMARK (ICRA 2027)
========================================================================================
Zweck dieses Moduls:
--------------------
Dieses Skript evaluiert, ob durch Graphenkompression erzeugte 3D-Szenengraphen (Subgraphen)
ausreichen, damit reale Roboterarme Manipulationsziele kollisionsfrei anfahren können.
Unterstützte Roboterarme:
-------------------------
1. AgileX Piper (6-DoF Knickarmroboter mit Greifer)
2. Franka Emika Panda (7-DoF Roboterarm mit redundanter Kinematik)
Evaluierungsmodi (--mode):
--------------------------
- 'full_room' (Standard / ICRA): Voll möblierter Raum (30-43 Objekte) mit Parent-Entity-
Freistellung für das zu greifende Möbelstück.
- 'naive_full' (Diagnose-Modus): Ungefilterte Gesamtszene (belegt Schrankfront-Blockaden).
- 'single_pair'(V0-Baseline): Klassischer Einzelhindernis-Test im Anfahrtskorridor.
Verwendete MoveIt 2 Schnittstellen:
-----------------------------------
1. /apply_planning_scene (Service) : Dynamisches Setzen & Löschen von 3D-Kollisionsboxen.
2. /move_action (ActionClient) : Pfadplanung via OMPL (RRTConnect).
3. /check_state_validity (Service) : Millimetergenaue FCL-Mesh-Kollisions- & Kontaktdiagnostik.
Autoren: Team CO (Execution Grounding) / ICRA 2027
========================================================================================
"""
import os
@@ -12,9 +36,10 @@ import sys
import json
import time
import argparse
from datetime import datetime
import numpy as np
# ROS 2 & MoveIt 2 imports
# ROS 2 & MoveIt 2 Nachrichten und Schnittstellen
import rclpy
from rclpy.node import Node
from rclpy.action import ActionClient
@@ -32,41 +57,56 @@ from moveit_msgs.action import MoveGroup
from moveit_msgs.srv import ApplyPlanningScene, GetStateValidity
from sensor_msgs.msg import JointState
# ======================================================================================
# ROBOTER-KINEMATIK & MOVEIT 2 KONFIGURATIONEN
# ======================================================================================
ROBOT_CONFIGS = {
'piper': {
'name': 'AgileX Piper (6-DoF)',
'group_name': 'arm',
'base_frame': 'base_link',
'eef_link': 'link6',
'aux_joints': {'joint7': 0.01, 'joint8': 0.01},
'reach_radius': 0.52
'group_name': 'arm', # Planungsgruppe in der Piper SRDF
'base_frame': 'base_link', # Ursprung der Roboterbasis
'eef_link': 'link6', # Endeffektor-Link (Handgelenk)
'aux_joints': {'joint7': 0.01, 'joint8': 0.01}, # Greiferbacken (10mm Öffnung)
'reach_radius': 0.52 # Maximale Reichweite in Metern
},
'panda': {
'name': 'Franka Emika Panda (7-DoF)',
'group_name': 'panda_arm',
'base_frame': 'panda_link0',
'eef_link': 'panda_link8',
'group_name': 'panda_arm', # Planungsgruppe in der Panda SRDF
'base_frame': 'panda_link0', # Ursprung der Panda-Basis
'eef_link': 'panda_link8', # Endeffektor-Link (Flansch vor Greifer)
'aux_joints': {'panda_finger_joint1': 0.01, 'panda_finger_joint2': 0.01},
'reach_radius': 0.85
'reach_radius': 0.85 # Maximale Reichweite in Metern
}
}
# ======================================================================================
# MOVEIT 2 BATCH ACTION EVALUATOR NODE
# ======================================================================================
class MoveIt2BatchActionEvaluator(Node):
"""
ROS 2 Node zur Steuerung von MoveIt 2.
Kapselt das Setzen von Hindernissen, die OMPL-Pfadplanung und die FCL-Kollisionsprüfung.
"""
def __init__(self, robot_type='piper'):
super().__init__('moveit2_batch_action_evaluator')
self.robot_type = robot_type
self.cfg = ROBOT_CONFIGS.get(robot_type, ROBOT_CONFIGS['piper'])
self.get_logger().info(f"Initializing MoveIt2 Active-Grounding Evaluator for {self.cfg['name']}...")
self.get_logger().info(f"Initializing MoveIt2 Benchmark for {self.cfg['name']}...")
# Connect to MoveGroup Action Server and Services
# 1. Action Client für MoveGroup (/move_action für Pfadplanung)
self.action_client = ActionClient(self, MoveGroup, '/move_action')
# 2. Service Client für PlanningScene (/apply_planning_scene zum Setzen von Boxen)
self.apply_scene_client = self.create_client(ApplyPlanningScene, '/apply_planning_scene')
# 3. Service Client für FCL State Validity (/check_state_validity für Wegpunkt-Checks)
self.validity_client = self.create_client(GetStateValidity, '/check_state_validity')
self.get_logger().info("Waiting for MoveIt2 action server and services...")
# Verbindung zu MoveIt 2 abwarten (sicherstellen, dass MoveGroup läuft)
self.get_logger().info("Connecting to MoveIt2 services...")
while not self.action_client.wait_for_server(timeout_sec=2.0):
self.get_logger().info("Waiting for /move_action...")
self.get_logger().info("Waiting for /move_action (MoveGroup)...")
while not self.apply_scene_client.wait_for_service(timeout_sec=2.0):
self.get_logger().info("Waiting for /apply_planning_scene...")
while not self.validity_client.wait_for_service(timeout_sec=2.0):
@@ -74,19 +114,26 @@ class MoveIt2BatchActionEvaluator(Node):
self.get_logger().info(f"Connected to MoveIt2 successfully for {self.cfg['name']}!")
# Roboterspezifische Parameter aus Konfiguration übernehmen
self.group_name = self.cfg['group_name']
self.base_frame = self.cfg['base_frame']
self.eef_link = self.cfg['eef_link']
self.current_object_ids = []
# ----------------------------------------------------------------------------------
# PLANNING SCENE VERWALTUNG (OBJEKTE SETZEN & LÖSCHEN)
# ----------------------------------------------------------------------------------
def clear_planning_scene(self):
"""Clears previously added collision objects"""
"""
Löscht alle zuvor in MoveIt 2 registrierten Hindernisse aus der PlanningScene.
Sendet einen 'REMOVE'-Befehl für jede bekannte Objekt-ID.
"""
if not self.current_object_ids:
return
req = ApplyPlanningScene.Request()
scene = PlanningScene()
scene.is_diff = True
scene.is_diff = True # Nur Differenz/Änderung übertragen, nicht die Welt neu anlegen
for obj_id in self.current_object_ids:
co = CollisionObject()
@@ -101,8 +148,16 @@ class MoveIt2BatchActionEvaluator(Node):
self.current_object_ids = []
def set_planning_scene_objects(self, objects, base_pos, base_yaw_deg):
"""Populates MoveIt2 PlanningScene with obstacles in base_frame"""
self.clear_planning_scene()
"""
Injiziert eine Liste von 3D-Hindernissen als Bounding Boxes in die MoveIt PlanningScene.
Rechnet die Weltkoordinaten der Objekte in das lokale Bezugssystem der Roboterbasis um.
Parameter:
objects: Liste von Dictionaries mit 'centroid', 'bbox_size', 'label', 'id'
base_pos: 3D-Weltkoordinaten der Roboterbasis [x, y, z]
base_yaw_deg: Gierwinkel (Ausrichtung) des Roboters in Grad
"""
self.clear_planning_scene() # Erst bestehende Objekte säubern
if not objects:
return
@@ -111,13 +166,16 @@ class MoveIt2BatchActionEvaluator(Node):
scene = PlanningScene()
scene.is_diff = True
# 2D-Rotationsmatrix zur Transformation in den Roboter-Basisframe
yaw = np.radians(base_yaw_deg)
cos_y = np.cos(-yaw)
sin_y = np.sin(-yaw)
collision_objects = []
for obj in objects:
obj_id = str(obj['id'])
# Eindeutige, lesbare ID für MoveIt und RViz2 erzeugen (z.B. 'kitchen_sink_dfae4c')
label_clean = obj.get('label', 'obj').replace(' ', '_').replace('/', '_')
obj_id = f"{label_clean}_{str(obj['id'])[:6]}"
self.current_object_ids.append(obj_id)
co = CollisionObject()
@@ -125,6 +183,7 @@ class MoveIt2BatchActionEvaluator(Node):
co.id = obj_id
co.operation = CollisionObject.ADD
# Koordinatentransformation: Raum-Differenzvektor relativ zur Roboterbasis
c_world = np.array(obj['centroid'])
d_world = c_world - np.array(base_pos)
@@ -132,6 +191,7 @@ class MoveIt2BatchActionEvaluator(Node):
y_rel = sin_y * d_world[0] + cos_y * d_world[1]
z_rel = d_world[2]
# 3D-Box mit Bounding-Box-Maßen (mindestens 4cm Dicke zur FCL-Stabilität)
box = SolidPrimitive()
box.type = SolidPrimitive.BOX
box.dimensions = [
@@ -156,22 +216,36 @@ class MoveIt2BatchActionEvaluator(Node):
future = self.apply_scene_client.call_async(req)
rclpy.spin_until_future_complete(self, future, timeout_sec=2.0)
# ----------------------------------------------------------------------------------
# OMPL PFADPLANUNG VIA /move_action
# ----------------------------------------------------------------------------------
def plan_to_pose(self, target_rel, planning_time=4.0):
"""Sends goal to MoveGroup action server"""
"""
Sendet eine Pfadplanungs-Anfrage an MoveIt 2 (OMPL RRTConnect).
Parameter:
target_rel: 3D-Zielkoordinaten [x, y, z] relativ zur Roboterbasis
planning_time: Maximale Rechenzeit für OMPL in Sekunden
Rückgabe:
('planned', trajectory, time) bei Erfolg (error_code == 1)
('infeasible', None, time) wenn kein kollisionsfreier Pfad existiert
"""
goal = MoveGroup.Goal()
req = goal.request
req.group_name = self.group_name
req.allowed_planning_time = planning_time
req.num_planning_attempts = 15
goal.planning_options.plan_only = True
req.num_planning_attempts = 15 # Bis zu 15 RRT-Zufallsbäume probieren
goal.planning_options.plan_only = True # Nur simulieren, keine echten Motoren ansteuern
# Ziel-Positions-Constraint: 12cm Toleranzbox um die Pre-Grasp-Pose
pos_con = PositionConstraint()
pos_con.header.frame_id = self.base_frame
pos_con.link_name = self.eef_link
box = SolidPrimitive()
box.type = SolidPrimitive.BOX
box.dimensions = [0.15, 0.15, 0.15]
box.dimensions = [0.12, 0.12, 0.12]
pose = PoseStamped()
pose.header.frame_id = self.base_frame
@@ -188,6 +262,7 @@ class MoveIt2BatchActionEvaluator(Node):
constraints.position_constraints.append(pos_con)
req.goal_constraints.append(constraints)
# Anfrage asynchron absenden
future = self.action_client.send_goal_async(goal)
rclpy.spin_until_future_complete(self, future, timeout_sec=5.0)
@@ -202,7 +277,7 @@ class MoveIt2BatchActionEvaluator(Node):
return 'infeasible', None, 0.0
result = res_future.result().result
error_code = result.error_code.val
error_code = result.error_code.val # 1 = MoveIt2 ErrorCode::SUCCESS
plan_time = result.planning_time
if error_code == 1:
@@ -210,18 +285,25 @@ class MoveIt2BatchActionEvaluator(Node):
else:
return 'infeasible', None, plan_time
# ----------------------------------------------------------------------------------
# NATIVE FCL KOLLISIONS- & KONTAKT-DIAGNOSTIK
# ----------------------------------------------------------------------------------
def check_trajectory_validity_fcl(self, trajectory):
"""
Uses MoveIt 2's native FCL collision engine to check every waypoint of trajectory
against the currently active PlanningScene.
Prüft jeden einzelnen Gelenkwegpunkt einer Trajektorie mit MoveIt 2's nativer FCL-Engine
gegen alle aktiven Hindernisse in der PlanningScene.
Erfasst bei Kollisionen das genaue Roboterglied, das Hindernis, die Eindringtiefe und die Bewegungsphase.
Rückgabe:
(has_collision: bool, contacts_list: list)
"""
if trajectory is None:
return True
return True, [{'robot_link': 'none', 'obstacle': 'no_trajectory', 'depth_cm': 0.0, 'phase': 'NONE'}]
joint_names = list(trajectory.joint_trajectory.joint_names)
points = trajectory.joint_trajectory.points
# Add auxiliary joints (e.g. gripper fingers)
# Greifer-Zusatzgelenke (aux_joints) anhängen, damit der Greifer mitgeprüft wird
aux_names = list(self.cfg['aux_joints'].keys())
aux_vals = list(self.cfg['aux_joints'].values())
@@ -229,7 +311,11 @@ class MoveIt2BatchActionEvaluator(Node):
if aux_n not in joint_names:
joint_names.append(aux_n)
for pt in points:
all_contacts = []
has_collision = False
# Schleife über jeden Wegpunkt der Trajektorie
for pt_idx, pt in enumerate(points):
req = GetStateValidity.Request()
req.group_name = self.group_name
@@ -239,6 +325,7 @@ class MoveIt2BatchActionEvaluator(Node):
js.header.stamp = self.get_clock().now().to_msg()
js.header.frame_id = self.base_frame
# Gelenkwinkel für diesen Wegpunkt auffüllen
full_pos = list(pt.positions)
while len(full_pos) < len(joint_names):
idx = len(full_pos) - len(pt.positions)
@@ -249,16 +336,41 @@ class MoveIt2BatchActionEvaluator(Node):
rs.joint_state = js
req.robot_state = rs
# FCL-Service aufrufen
future = self.validity_client.call_async(req)
rclpy.spin_until_future_complete(self, future, timeout_sec=1.0)
if future.result() is not None:
if not future.result().valid:
return True # Collision detected by FCL
res = future.result()
if res is not None and not res.valid:
has_collision = True
total_pts = max(1, len(points) - 1)
progress = round((pt_idx / total_pts) * 100.0, 1)
phase = "START (t=0)" if pt_idx == 0 else ("GOAL (t=T)" if pt_idx == total_pts else f"MOTION ({progress}%)")
# Kontaktdetails (Kollidierende Körper & Eindringtiefe) extrahieren
for c in res.contacts:
contact_info = {
'waypoint_idx': pt_idx,
'total_waypoints': len(points),
'progress_pct': progress,
'phase': phase,
'body_1': c.contact_body_1,
'body_2': c.contact_body_2,
'point': [round(float(c.position.x), 3), round(float(c.position.y), 3), round(float(c.position.z), 3)],
'depth_cm': round(float(c.depth) * 100.0, 2)
}
all_contacts.append(contact_info)
return False # Collision-free
return has_collision, all_contacts
# ======================================================================================
# MATHEMATISCHE HILFSFUNKTIONEN
# ======================================================================================
def transform_to_base_frame(pos_world, base_pos, base_yaw_deg):
"""
Rechnet absolute 3D-Zimmerkoordinaten [Xw, Yw, Zw] in lokale Roboterkoordinaten [Xrel, Yrel, Zrel] um.
Dreht um die Z-Achse um den Gierwinkel des Roboters.
"""
yaw = np.radians(base_yaw_deg)
cos_y = np.cos(-yaw)
sin_y = np.sin(-yaw)
@@ -268,22 +380,46 @@ def transform_to_base_frame(pos_world, base_pos, base_yaw_deg):
z_rel = d[2]
return np.array([x_rel, y_rel, z_rel])
def run_moveit2_evaluation(robot_type='piper', max_cases=None, output_dir='results'):
def load_full_scene_objects_dict(path='scratch/full_scene_objects.json'):
"""Lädt die extrahierten 3D-Objektdefinitionen aller 14 Räume"""
if not os.path.exists(path):
path = '/workspace/scratch/full_scene_objects.json'
if not os.path.exists(path):
return {}
with open(path, 'r', encoding='utf-8') as f:
return json.load(f)
# ======================================================================================
# BENCHMARK HAUPTSCHLEIFE (ORACLE VS. BLIND EVALUATION)
# ======================================================================================
def run_moveit2_evaluation(robot_type='piper', mode='full_room', tag='default', max_cases=None, output_dir='results'):
"""
Führt den Execution-Grounding Benchmark für alle Testfälle aus.
Vergleicht Oracle (Full Scene) gegen Blind (Empty Scene mit Rückprüfung).
"""
os.makedirs(output_dir, exist_ok=True)
runs_dir = os.path.join(output_dir, 'runs')
os.makedirs(runs_dir, exist_ok=True)
placements_file = 'scratch/verified_placements.json'
if not os.path.exists(placements_file):
placements_file = '/workspace/scratch/verified_placements.json'
with open(placements_file, 'r', encoding='utf-8') as f:
candidates = json.load(f)
if max_cases:
candidates = candidates[:max_cases]
all_scenes_dict = load_full_scene_objects_dict()
evaluator = MoveIt2BatchActionEvaluator(robot_type=robot_type)
robot_name = ROBOT_CONFIGS.get(robot_type, {}).get('name', robot_type)
print(f"\n[INFO] Starting Active MoveIt2 Benchmark on {len(candidates)} cases for: {robot_name}...")
print(f"{'#':<4} | {'Scene':<12} | {'Target':<18} | {'Obstacle':<16} | {'Full (Oracle)':<15} | {'Empty (Blind)':<15}")
print("-" * 90)
print(f"\n" + "=" * 95)
print(f"BENCHMARK: {robot_name} | Mode: '{mode}' | Tag: '{tag}' | Cases: {len(candidates)}")
print(f"=" * 95)
print(f"{'#':<4} | {'Scene':<12} | {'Target':<18} | {'Room Objs':<10} | {'Full (Oracle)':<15} | {'Empty (Blind)':<15}")
print("-" * 95)
results = []
counts_full = {'safe': 0, 'unsafe': 0, 'infeasible': 0}
@@ -295,44 +431,83 @@ def run_moveit2_evaluation(robot_type='piper', max_cases=None, output_dir='resul
base_yaw = cand['base_yaw_deg']
tgt_pos = cand['target_pos']
obs_size = cand.get('obstacle_size', [0.18, 0.18, 0.18])
real_obstacles = [
{
# ------------------------------------------------------------------------------
# 1. Hindernis-Filterung nach gewähltem EVALUIERUNGS-MODUS
# ------------------------------------------------------------------------------
active_room_obstacles = []
if mode == 'single_pair':
# Modus A: Nur das 1 primäre Hindernispaar
obs_size = cand.get('obstacle_size', [0.20, 0.20, 0.20])
active_room_obstacles = [{
'id': f"obs_{i}_{cand['obstacle'][:6]}",
'label': cand['obstacle'],
'centroid': cand['obstacle_pos'],
'bbox_size': obs_size
}
]
}]
else:
# Modus B & C: Alle 30-43 Objekte des Raumes laden
room_objects = all_scenes_dict.get(s_id, [])
for obj in room_objects:
b_min = np.array(obj.get('bbox_min', [0,0,0]))
b_max = np.array(obj.get('bbox_max', [0,0,0]))
c = np.array(obj['centroid'])
# Roboter-Standfuß-Schutz (Bodenobjekte unter der Basis ignorieren)
is_under_base = (
b_min[0] - 0.08 <= base_pos[0] <= b_max[0] + 0.08 and
b_min[1] - 0.08 <= base_pos[1] <= b_max[1] + 0.08 and
b_min[2] <= base_pos[2] <= b_max[2]
) or (np.linalg.norm(c[:2] - np.array(base_pos)[:2]) < 0.12)
if is_under_base:
continue
if mode == 'full_room':
# ICRA Standard: Ziel-Elternmöbelstück freistellen (Greifer darf Knauf berühren)
is_parent = (
b_min[0] - 0.04 <= tgt_pos[0] <= b_max[0] + 0.04 and
b_min[1] - 0.04 <= tgt_pos[1] <= b_max[1] + 0.04 and
b_min[2] - 0.04 <= tgt_pos[2] <= b_max[2] + 0.04
) or (np.linalg.norm(c - tgt_pos) < 0.15)
if is_parent:
continue
elif mode == 'naive_full':
# Naive Gesamtszene: Nur den reinen Knaufpunkt (< 6cm) aussparen
if np.linalg.norm(c - tgt_pos) < 0.06:
continue
active_room_obstacles.append(obj)
# Calculate pre-grasp pose in base frame
# Pre-Grasp Pose berechnen (10 cm vor dem Griff in freier Sichtachse)
approach = np.array(base_pos) - np.array(tgt_pos)
approach_u = approach / (np.linalg.norm(approach) + 1e-6)
pre_grasp_world = np.array(tgt_pos) + approach_u * 0.08
pre_grasp_world = np.array(tgt_pos) + approach_u * 0.10
pre_grasp_rel = transform_to_base_frame(pre_grasp_world, base_pos, base_yaw)
# -------------------------------------------------------------
# 1. RUN FULL SCENE (Oracle): Obstacle in MoveIt2 PlanningScene
# -------------------------------------------------------------
evaluator.set_planning_scene_objects(real_obstacles, base_pos, base_yaw)
# ------------------------------------------------------------------------------
# 2. DURCHLAUF 1: FULL SCENE (Oracle / Vollständiges Szenenwissen)
# ------------------------------------------------------------------------------
evaluator.set_planning_scene_objects(active_room_obstacles, base_pos, base_yaw)
status_full, traj_full, time_full = evaluator.plan_to_pose(pre_grasp_rel, planning_time=4.0)
contacts_full = []
if status_full == 'planned':
has_coll_full = evaluator.check_trajectory_validity_fcl(traj_full)
has_coll_full, contacts_full = evaluator.check_trajectory_validity_fcl(traj_full)
outcome_full = 'unsafe' if has_coll_full else 'safe'
else:
outcome_full = 'infeasible'
# -------------------------------------------------------------
# 2. RUN EMPTY SCENE (Blind): Clear obstacles from PlanningScene
# -------------------------------------------------------------
# ------------------------------------------------------------------------------
# 3. DURCHLAUF 2: EMPTY SCENE (Blind Baseline / Komplette Wissenslöschung)
# ------------------------------------------------------------------------------
evaluator.set_planning_scene_objects([], base_pos, base_yaw)
status_empty, traj_empty, time_empty = evaluator.plan_to_pose(pre_grasp_rel, planning_time=3.0)
status_empty, traj_empty, time_empty = evaluator.plan_to_pose(pre_grasp_rel, planning_time=4.0)
contacts_empty = []
if status_empty == 'planned':
# Re-populate the real obstacle in PlanningScene and check the blind trajectory with FCL!
evaluator.set_planning_scene_objects(real_obstacles, base_pos, base_yaw)
has_coll_empty = evaluator.check_trajectory_validity_fcl(traj_empty)
# Reale Hindernisse zurückladen und blinde Trajektorie mit FCL prüfen!
evaluator.set_planning_scene_objects(active_room_obstacles, base_pos, base_yaw)
has_coll_empty, contacts_empty = evaluator.check_trajectory_validity_fcl(traj_empty)
outcome_empty = 'unsafe' if has_coll_empty else 'safe'
else:
outcome_empty = 'infeasible'
@@ -344,46 +519,69 @@ def run_moveit2_evaluation(robot_type='piper', max_cases=None, output_dir='resul
'case_id': i + 1,
'scene': s_id,
'robot': robot_type,
'mode': mode,
'tag': tag,
'target': cand['target'],
'part': cand['part'],
'obstacle': cand['obstacle'],
'num_room_objects': len(active_room_obstacles),
'full_scene': {
'outcome': outcome_full,
'plan_time': round(float(time_full), 3)
'plan_time': round(float(time_full), 3),
'contacts': contacts_full[:3]
},
'empty_scene': {
'outcome': outcome_empty,
'plan_time': round(float(time_empty), 3)
'plan_time': round(float(time_empty), 3),
'contacts': contacts_empty[:3]
}
}
results.append(cand_res)
print(f"{i+1:<4} | {s_id:<12} | {cand['target'][:16]:<18} | {cand['obstacle'][:15]:<16} | {outcome_full:<15} | {outcome_empty:<15}")
extra_info = ""
if outcome_empty == 'unsafe' and contacts_empty:
c0 = contacts_empty[0]
extra_info = f" -> 💥 Crash [{c0['phase']}]: {c0['body_1']} x {c0['body_2']} ({c0['depth_cm']}cm)"
print(f"{i+1:<4} | {s_id:<12} | {cand['target'][:16]:<18} | {len(active_room_obstacles):<10} | {outcome_full:<15} | {outcome_empty:<15}{extra_info}")
# Summary Statistics
# Zusammenfassende Statistik ausgeben
total = len(candidates)
print("\n" + "=" * 65)
print(f"MOVEIT 2 BENCHMARK RESULTS for {robot_name}")
print(f"BENCHMARK RESULTS: {robot_name} (Mode: '{mode}', Tag: '{tag}')")
print("=" * 65)
print(f"Total Cases: {total}")
print(f"FULL SCENE (Oracle): SAFE: {counts_full['safe']} ({counts_full['safe']/total*100:.1f}%) | UNSAFE: {counts_full['unsafe']} ({counts_full['unsafe']/total*100:.1f}%) | INFEASIBLE: {counts_full['infeasible']} ({counts_full['infeasible']/total*100:.1f}%)")
print(f"EMPTY SCENE (Blind): SAFE: {counts_empty['safe']} ({counts_empty['safe']/total*100:.1f}%) | UNSAFE: {counts_empty['unsafe']} ({counts_empty['unsafe']/total*100:.1f}%) | INFEASIBLE: {counts_empty['infeasible']} ({counts_empty['infeasible']/total*100:.1f}%)")
print("=" * 65)
out_file = os.path.join(output_dir, f'moveit2_benchmark_{robot_type}.json')
with open(out_file, 'w', encoding='utf-8') as f:
# 1. Neueste Standard-Ergebnisdatei speichern
std_file = os.path.join(output_dir, f'moveit2_benchmark_{robot_type}.json')
with open(std_file, 'w', encoding='utf-8') as f:
json.dump(results, f, indent=2)
print(f"\nSaved {robot_name} benchmark results to: {out_file}")
# 2. Versionierte Archivdatei mit Zeitstempel & Tag ablegen
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
archive_file = os.path.join(runs_dir, f"{timestamp}_{robot_type}_{mode}_{tag}.json")
with open(archive_file, 'w', encoding='utf-8') as f:
json.dump(results, f, indent=2)
print(f"\nSaved latest results to: {std_file}")
print(f"Archived versioned run to: {archive_file}")
# ======================================================================================
# CLI-EINSPRUNGSPUNKT
# ======================================================================================
def main(args=None):
rclpy.init(args=args)
parser = argparse.ArgumentParser(description="MoveIt2 Batch Benchmark")
parser.add_argument('--robot', type=str, default='piper', choices=['piper', 'panda'], help='Robot to evaluate (piper | panda)')
parser.add_argument('--max-cases', type=int, default=None, help='Limit test cases')
parser.add_argument('--output-dir', type=str, default='results', help='Output directory')
parser = argparse.ArgumentParser(description="MoveIt2 Execution Grounding Benchmark with Contact Diagnostics")
parser.add_argument('--robot', type=str, default='piper', choices=['piper', 'panda'], help='Roboter (piper | panda)')
parser.add_argument('--mode', type=str, default='full_room', choices=['full_room', 'naive_full', 'single_pair'], help='Evaluierungsmodus')
parser.add_argument('--tag', type=str, default='default', help='Eindeutiger Bezeichner für Run-Archivierung')
parser.add_argument('--max-cases', type=int, default=None, help='Testfälle limitieren (z.B. 10 zum Testen)')
parser.add_argument('--output-dir', type=str, default='results', help='Ausgabeordner')
args = parser.parse_args()
run_moveit2_evaluation(robot_type=args.robot, max_cases=args.max_cases, output_dir=args.output_dir)
run_moveit2_evaluation(robot_type=args.robot, mode=args.mode, tag=args.tag, max_cases=args.max_cases, output_dir=args.output_dir)
rclpy.shutdown()
if __name__ == '__main__':
File diff suppressed because it is too large Load Diff