154 lines
11 KiB
Markdown
154 lines
11 KiB
Markdown
# Implementation Details
|
|
**Vision-Guided Robotic Pick-and-Place Simulation**
|
|
**NVIDIA Omniverse™ / Isaac Sim™ Ecosystem**
|
|
|
|
---
|
|
|
|
## 1. Architectural Overview & Design Patterns
|
|
|
|
The implementation follows a configuration-driven, object-oriented design pattern ensuring loose coupling between modules:
|
|
|
|
- **Factory Pattern:** Used in procedural object generation (`ObjectFactory`) and grasp candidate generation.
|
|
- **Manager Pattern:** Used in simulation lifecycle management (`CoreSimulationManager`), configuration handling (`ConfigManager`), and sensor streaming (`CameraManager`).
|
|
- **Finite State Machine (FSM):** Orchestrates manipulation subtasks deterministically with failure detection and recovery branches.
|
|
|
|
---
|
|
|
|
## 2. Phase 1 Implementation Details: Environment Setup & Core Subsystems
|
|
|
|
### 2.1 Configuration Subsystem (`src/core/config.py`)
|
|
- **Class:** `ConfigManager`
|
|
- Loads YAML configuration files from `config/`:
|
|
- `simulation_config.yaml`: Physics $\Delta t = 1/60\text{ s}$, GPU device `cuda`, gravity $[0, 0, -9.81]\text{ m/s}^2$, lighting intensity.
|
|
- `environment_config.yaml`: Rack widths (0.7m), depths (0.4m), heights (1.2m), shelf elevations ($Z = 0.25, 0.55, 0.85\text{ m}$), object dimensional limits.
|
|
- `robot_config.yaml`: Franka articulation paths, joint name mappings, home joint angles, parallel-jaw gripper parameters (open aperture 0.08m, grasp force 50N).
|
|
- `vision_config.yaml`: Overhead camera intrinsic/extrinsic parameters, $640 \times 480$ resolution, 30 Hz capture rate, depth thresholds.
|
|
- `motion_config.yaml`: cuMotion RMPflow parameters, obstacle margin (0.02m), FSM phase frame budgets.
|
|
- Implements property accessors (`.simulation`, `.warehouse`, `.objects`, `.robot`, `.camera`, `.perception`, `.motion`) guaranteeing zero hardcoding across the codebase.
|
|
|
|
### 2.2 Core Simulation Management (`src/core/simulation_manager.py`)
|
|
- **Class:** `CoreSimulationManager`
|
|
- Encapsulates Isaac Sim 6.2 `SimulationManager` and `app_utils`:
|
|
- `setup_stage()`: Initializes GPU PhysX context with `SimulationManager.setup_simulation(dt=1/60, device='cuda')`, adds `/World/GroundPlane` with PhysX collision API, and configures `/World/DomeLight` with 1200 lux intensity for RTX illumination.
|
|
- `play()`: Initiates physics timeline via `isaacsim.core.experimental.utils.app.play()` and triggers initial app step.
|
|
- `step(num_steps)`: Steps simulation and rendering loops via `omni.kit.app.get_app().update()`.
|
|
- `warmup(num_frames)`: Advances simulation for 60 frames to achieve physical settlement and shader caching.
|
|
- `stop()`: Halts timeline via `app_utils.stop()`.
|
|
|
|
### 2.3 Custom Omniverse Kit Extension (`exts/omni.isaac.pick_place`)
|
|
- **Package Configuration:** `config/extension.toml`
|
|
- Declares package metadata, Kit dependencies (`isaacsim.core.simulation_manager`, `isaacsim.core.experimental.prims`, `isaacsim.robot_motion.cumotion`, `omni.physx`, `omni.ui`), and python module entry.
|
|
- **Extension Class:** `omni.isaac.pick_place.extension.PickPlaceExtension`
|
|
- Inherits from `omni.ext.IExt`.
|
|
- Implements `on_startup(ext_id)` to instantiate UI window `PickPlaceWindow` and subscribe to simulation events.
|
|
- Implements `on_shutdown()` to destroy UI frames and release scene hooks cleanly.
|
|
- **UI Window:** `omni.isaac.pick_place.ui.window.PickPlaceWindow`
|
|
- Built with native `omni.ui`.
|
|
- Provides interactive panels:
|
|
- System Status (Isaac Sim version, GPU hardware, motion planner status).
|
|
- Simulation Lifecycle (Setup Scene, Randomize Objects, Start Task, Reset).
|
|
- Vision & Perception readout (detected objects, estimated target 6D pose).
|
|
- Live Performance KPIs (grasp success rate, place success rate, average cycle time).
|
|
|
|
### 2.4 Diagnostics & Automated Validation Suite
|
|
- **Script:** `scripts/verify_environment.py`
|
|
- Probes host operating system, disk space, RTX 5090 GPU, driver, and Isaac Sim 6.2 versions.
|
|
- Executes live headless simulation tests verifying PhysX physics dropping, RTX Camera rendering (RGB, metric depth, semantic segmentation), cuMotion robot loading, and asset CDN access.
|
|
- Outputs structured diagnostic JSON: `docs/environment_verification_report.json`.
|
|
- **Script:** `scripts/run_phase1_validation.py`
|
|
- Programmatically registers `exts/` path via `ext_manager.add_path()`.
|
|
- Activates `omni.isaac.pick_place` extension.
|
|
- Executes stage setup, physics play, and 60-frame warmup.
|
|
- Outputs phase validation JSON: `docs/phase1_validation_report.json`.
|
|
|
|
---
|
|
|
|
## 3. Phase 2 Implementation Details: Warehouse Environment & Object Randomization
|
|
|
|
### 3.1 Procedural Storage Rack Generator (`src/environment/rack_generator.py`)
|
|
- **Classes:** `StorageRack`, `StorageRackGenerator`
|
|
- **Structure Hierarchy:**
|
|
- Root Xform: `/World/SourceRack` and `/World/DestinationRack` positioned in world space ($X = 0.55, Y = \pm 0.45, Z = 0.0\text{ m}$).
|
|
- Corner Pillars: 4 vertical cylinders (`Cylinder`) positioned relative to parent rack Xform using `translations=[pillar_pos]`, with collision enabled (`GeomPrim(apply_collision_apis=True)`).
|
|
- Horizontal Shelves: $N$ plank prims (`Cube`) positioned relative to parent rack Xform using `translations=[shelf_pos]`, with static PhysX collision enabled.
|
|
- **Surface Bounds Extraction:**
|
|
- Computes top resting surface elevation: $Z_{\text{top}} = Z_{\text{rack}} + Z_{\text{nominal}} + \frac{h_{\text{thickness}}}{2}$.
|
|
- Calculates collision-safe planar boundaries $[X_{\min}, X_{\max}]$, $[Y_{\min}, Y_{\max}]$ accounting for pillar clearances ($w - 4r_{\text{pillar}}$).
|
|
|
|
### 3.2 Procedural Object Generator & Domain Randomizer (`src/environment/object_generator.py`)
|
|
- **Classes:** `ManipulatedObject`, `ObjectGenerator`
|
|
- **Shape Topologies:**
|
|
- **Equilateral Cube:** Dimension $s \sim \mathcal{U}(0.04, 0.06)\text{ m}$, mass $0.15\text{ kg}$, color red (`[0.85, 0.15, 0.15]`), semantic class `object_cube`.
|
|
- **Asymmetric Cuboid:** Dimensions $[w, d, h]$ ($w \sim \mathcal{U}(0.04, 0.06), d \sim \mathcal{U}(0.03, 0.04), h \sim \mathcal{U}(0.07, 0.09)\text{ m}$), mass $0.20\text{ kg}$, color blue (`[0.15, 0.35, 0.85]`), semantic class `object_cuboid`.
|
|
- **Circular Cylinder:** Radius $r \sim \mathcal{U}(0.02, 0.03)\text{ m}$, height $h \sim \mathcal{U}(0.06, 0.09)\text{ m}$, mass $0.18\text{ kg}$, color green (`[0.15, 0.80, 0.25]`), semantic class `object_cylinder`.
|
|
- **Sampling & Physics:**
|
|
- 2D uniform rejection sampling enforces boundary margins ($m_x = 0.08, m_y = 0.06\text{ m}$) and inter-object Euclidean clearance $\ge 0.10\text{ m}$.
|
|
- 1-DOF quaternion yaw sampling: $\theta \sim \mathcal{U}(-\pi, \pi)$, mapped to unit quaternion $q = [\cos(\theta/2), 0, 0, \sin(\theta/2)]$.
|
|
- Dynamics: Configured with `RigidPrim` and exact mass via `UsdPhysics.MassAPI`.
|
|
- Perception: Annotated via native `Semantics.SemanticsAPI.Apply(prim, "Semantics")`.
|
|
|
|
### 3.3 Scene Builder & USD Serializer (`src/environment/scene_builder.py`)
|
|
- **Class:** `WarehouseSceneBuilder`
|
|
- Coordinates rack synthesis, object distribution, and OpenUSD stage export.
|
|
- Implements `save_scene(output_path)`: Exports live stage to standalone OpenUSD files (`data/scenes/warehouse_scene.usda`).
|
|
- Implements `get_ground_truth_object_poses()`: Extracts real-time world coordinates from PhysX Fabric, decoupling simulation ground-truth from camera estimation.
|
|
|
|
---
|
|
|
|
## 4. Phase 3 Implementation Details: Robot Integration
|
|
|
|
### 4.1 Franka Panda Articulation Subsystem (`src/robot/articulation.py`)
|
|
- **Class:** `FrankaRobot`
|
|
- Encapsulates Franka Emika Panda 7-DOF arm and 2-DOF parallel-jaw gripper.
|
|
- **Asset Streaming:**
|
|
- Queries `get_assets_root_path()` from `isaacsim.storage.native`.
|
|
- References Franka USD directly from NVIDIA S3 Cloud CDN (`/Isaac/Robots_Multiphysics/FrankaRobotics/FrankaPanda/franka/franka.usda`).
|
|
- Eliminates local disk consumption on constrained systems.
|
|
- **Articulation Binding:**
|
|
- Wraps `/World/Franka` with `isaacsim.core.experimental.prims.Articulation`.
|
|
- Automatically discovers and maps 9 degrees of freedom:
|
|
- Arm Revolute DOFs: `panda_joint1` through `panda_joint7` (indices 0 to 6).
|
|
- Gripper Prismatic DOFs: `panda_finger_joint1`, `panda_finger_joint2` (indices 7 and 8).
|
|
- Exposes joint limit bounds via `art.get_dof_limits()`.
|
|
- **Control & Sensing Interface:**
|
|
- `set_home_pose()`: Commands arm to $[0.0, -0.569, 0.0, -2.810, 0.0, 3.037, 0.741]\text{ rad}$ and fingers to $0.04\text{ m}$ each, synchronizing instantaneous positions and PD position control targets.
|
|
- `set_arm_joint_position_targets(targets)`: Modulates arm joint position targets while preserving current finger target commands.
|
|
- `get_end_effector_pose()`: Queries real-time world position and orientation of `panda_hand` directly from PhysX Fabric using `RigidPrim`.
|
|
|
|
### 4.2 Parallel-Jaw Gripper Controller (`src/robot/gripper.py`)
|
|
- **Class:** `ParallelJawGripper`
|
|
- Controls Franka Hand prismatic finger joints.
|
|
- **Aperture Kinematics:**
|
|
- Maximum aperture: $0.080\text{ m}$ (symmetric travel of $0.040\text{ m}$ per finger).
|
|
- Minimum aperture: $0.000\text{ m}$ (contact closure).
|
|
- **Actuation & Grasp Sensing:**
|
|
- `open(aperture)`: Commands symmetric outward finger motion.
|
|
- `close(force)`: Dispatches $0.0\text{ m}$ position targets, producing sustained inward clamping effort against contacted objects.
|
|
- `is_grasped(min_aperture, max_aperture)`: Evaluates physical displacement divergence; returns `True` when finger aperture rests within $[0.005, 0.075]\text{ m}$ under closure commands, confirming solid object capture.
|
|
- `is_open()` / `is_closed()`: State verification flags with configurable metric tolerances.
|
|
|
|
### 4.3 Lula Kinematics Engine (`src/robot/kinematics.py`)
|
|
- **Class:** `FrankaKinematics`
|
|
- Encapsulates NVIDIA's high-performance `LulaKinematicsSolver`.
|
|
- Initialized with standard Franka Lula configuration (`load_supported_lula_kinematics_solver_config('Franka')`).
|
|
- **Forward Kinematics:**
|
|
- Evaluates exact end-effector frame (`panda_hand`) position and $3 \times 3$ rotation matrix from 7 arm joint angles.
|
|
- Maps rotation matrix to unit quaternion $[w, x, y, z]$ using `isaacsim.core.utils.rotations.rot_matrix_to_quat`.
|
|
- Validated against PhysX Fabric link transforms with $0.0\text{ mm}$ position discrepancy.
|
|
- **Inverse Kinematics:**
|
|
- Solves non-linear constrained optimization for target position $p_{\text{target}}$ and target quaternion $q_{\text{target}}$ using warm-start seeding.
|
|
- Strictly obeys physical joint limits $q_{\min} \le q \le q_{\max}$.
|
|
- Evaluated across warehouse approach and transport poses with 100% convergence and sub-millimeter round-trip accuracy.
|
|
|
|
---
|
|
|
|
## 5. Data Types & Interfaces
|
|
|
|
- **Transformations:** All spatial orientations use unit quaternions $[w, x, y, z]$ conforming to OpenUSD conventions.
|
|
- **Arrays & Buffers:** All GPU simulation tensors (poses, velocities, joint angles) from `isaacsim.core.experimental.prims` are provided as NVIDIA Warp (`wp.array`) objects and converted via `.numpy()` for matrix calculations.
|
|
- **Sensory Output:** Replicator annotators produce NumPy arrays:
|
|
- RGB: `uint8` array of shape `(H, W, 4)`.
|
|
- Depth: `float32` array of shape `(H, W)` in metric meters.
|
|
- Semantic: `uint32` array of shape `(H, W)` with semantic mapping dictionary.
|
|
|