Files
Pick-And-Place-Simulation-P…/docs/ALGORITHMS.md
T

39 KiB

Algorithm Architecture & Mathematical Formulations

Vision-Guided Robotic Pick-and-Place Simulation NVIDIA Omniverse™ / Isaac Sim™ Ecosystem


1. Overview of Algorithms Across Simulation Pipeline

The simulation integrates mathematical algorithms across environment synthesis, perception, kinematic planning, and manipulation control:

[Procedural Generation]  --> Uniform Sampling, Quaternion Yaw Sampling
[Perception]             --> Pinhole Depth Back-Projection, Point Cloud Centroid, PCA 6D Pose
[Grasp & Motion]         --> Surface Normal Grasp Candidates, cuMotion RMPflow (Riemannian Motion Policies)
[Execution & Control]    --> Finite State Machine (FSM), Contact Normal Verification

2. Detailed Algorithm Specifications

2.1 Uniform Random Placement on Shelf Surfaces

  • Mathematical Explanation: Given a rectangular shelf bounding box defined by extents [x_{\min}, x_{\max}] and [y_{\min}, y_{\max}] at height z_{\text{shelf}}, candidate positions p = [x, y, z] are sampled from uniform distributions: x \sim \mathcal{U}(x_{\min} + m_x, x_{\max} - m_x) y \sim \mathcal{U}(y_{\min} + m_y, y_{\max} - m_y) z = z_{\text{shelf}} + \frac{h_{\text{obj}}}{2} where m_x, m_y represent boundary safety margins to prevent objects from resting on rack edges. Spatial clearance between spawned objects is enforced via Euclidean distance checks: \|p_i - p_j\|_2 \ge r_i + r_j + d_{\text{clearance}}
  • Input: Shelf bounds, boundary margins, object dimensions, existing object centroids.
  • Output: Valid 3D world position vector [x, y, z]^T.
  • Why Selected: Guarantees uniform spatial distribution across the storage rack while preventing collision overlapping during spawn.
  • Where Implemented: src/environment/object_generator.py (Phase 2).
  • Limitations: Limited to planar bounding zones.
  • Testing: Monte Carlo sampling test verifying distance constraints across 100 iterations.

2.2 Quaternion-Based Random Yaw Orientation

  • Mathematical Explanation: Objects placed on shelves possess 1-DOF planar rotation around the gravity-aligned vertical axis ($Z$-axis) to remain resting upright. A random yaw angle \theta \sim \mathcal{U}(-\pi, \pi) is generated and mapped into a unit quaternion q = [w, x, y, z]: q = \left[\cos\left(\frac{\theta}{2}\right), 0, 0, \sin\left(\frac{\theta}{2}\right)\right] Ensures \|q\|_2 = \cos^2(\theta/2) + \sin^2(\theta/2) = 1.
  • Input: Yaw angle domain [-\pi, \pi].
  • Output: Normalized 4-element unit quaternion vector.
  • Why Selected: Quaternions eliminate gimbal lock and interface natively with OpenUSD Gf.Quatf / Gf.Quatd transform attributes.
  • Where Implemented: src/environment/object_generator.py (Phase 2).
  • Limitations: Constrained to $Z$-axis rotation to maintain static physical equilibrium on shelf surfaces.
  • Testing: Unit test checking \|q\| = 1.0 and correct rotation vector mapping.

2.3 Pinhole Camera Model & Metric Depth Back-Projection

  • Mathematical Explanation: Given camera intrinsic parameters: focal length (f_x, f_y) and principal point (c_x, c_y) derived from physical aperture dimensions and sensor resolution: f_x = \frac{\text{focal\_length\_mm}}{\text{horiz\_aperture\_mm}} \cdot W, \quad f_y = \frac{\text{focal\_length\_mm}}{\text{vert\_aperture\_mm}} \cdot H, \quad c_x = \frac{W}{2}, \quad c_y = \frac{H}{2} Each 2D pixel coordinate (u, v) with perpendicular metric depth Z = D(u, v) from Replicator's distance_to_image_plane annotator is unprojected into 3D optical camera coordinates: X_{\text{opt}} = \frac{(u - c_x) \cdot Z}{f_x}, \quad Y_{\text{opt}} = \frac{(v - c_y) \cdot Z}{f_y}, \quad Z_{\text{opt}} = Z The camera optical frame (ROS convention: +X right, +Y down, +Z forward) is transformed to USD camera frame (+X right, +Y up, -Z forward) via: P_{\text{usd}} = R_{\text{usd}\leftarrow\text{opt}} P_{\text{opt}}, \quad R_{\text{usd}\leftarrow\text{opt}} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & -1 \end{bmatrix} Using the USD camera world transform T_{\text{world}\leftarrow\text{usd}} \in SE(3), the point is projected into global world coordinates: P_{\text{world}} = T_{\text{world}\leftarrow\text{usd}} \cdot \begin{bmatrix} P_{\text{usd}} \\ 1 \end{bmatrix} = T_{\text{world}\leftarrow\text{opt}} \cdot \begin{bmatrix} P_{\text{opt}} \\ 1 \end{bmatrix}
  • Input: 2D pixel coordinates (u, v), metric depth Z, camera intrinsics matrix K, optical extrinsics T_{\text{world}\leftarrow\text{opt}}.
  • Output: 3D world space coordinate vector [X_w, Y_w, Z_w]^T.
  • Why Selected: Exact physical reconstruction from synthetic RTX linear depth without empirical approximations.
  • Where Implemented: src/vision/camera_manager.py (Phase 4).
  • Limitations: Accurate within valid range (Z \ge 0.05\text{ m}).
  • Testing: Validated in scripts/run_phase4_validation.py yielding 3D localization error \le 20.0\text{ mm} against PhysX ground-truth poses.

2.4 6D Pose Estimation via Viewing-Ray Offset Compensation & OBB Optimization

  • Mathematical Explanation:
    1. Dense Point Cloud Back-Projection & Outlier Filtering: For each pixel (u, v) in the segmentation mask M, optical coordinates are: X_{\text{opt}} = \frac{(u - c_x) Z}{f_x}, \quad Y_{\text{opt}} = \frac{(v - c_y) Z}{f_y}, \quad Z_{\text{opt}} = Z Transformed to world coordinates via T_{\text{world}\leftarrow\text{opt}}. Points are filtered with spatial contact constraints (Z \ge Z_{\text{shelf}} - 0.02\text{ m}) and Gaussian statistical outlier rejection (\|p_i - \bar{p}\| \le 3.0\sigma).
    2. Viewing-Ray Horizontal Offset Compensation: Because the camera only observes front-facing surfaces, the unprojected surface centroid \bar{p}_{\text{surf}} is biased towards the camera. The true geometric center is estimated by shifting inward along the horizontal viewing ray: \mathbf{v}_{xy} = \frac{p_{\text{cam}, xy} - \bar{p}_{\text{surf}, xy}}{\|p_{\text{cam}, xy} - \bar{p}_{\text{surf}, xy}\|} c_x = \bar{p}_{\text{surf}, x} - v_x \cdot \delta_{\text{inward}}, \quad c_y = \bar{p}_{\text{surf}, y} - v_y \cdot \delta_{\text{inward}} where \delta_{\text{inward}} \approx 0.020 - 0.022\text{ m} (nominal half-depth). Vertical center c_z = Z_{\text{shelf}} + h/2.
    3. Planar Covariance & Eigendecomposition: The horizontal sample covariance matrix C_{XY} \in \mathbb{R}^{2 \times 2} is formed: C_{XY} = \frac{1}{N} \sum_{i=1}^N (p_{i, xy} - \bar{p}_{xy})(p_{i, xy} - \bar{p}_{xy})^T Eigendecomposition C_{XY} v_k = \lambda_k v_k with \lambda_1 \ge \lambda_2 provides initial orientation and shape variance.
    4. Oriented Bounding Box (OBB) Optimization: To overcome symmetry and partial surface biases, an angular search over \theta \in [0, 90^\circ) evaluates rotated point spans: \begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} \cos\theta & \sin\theta \\ -\sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix} x - \bar{x} \\ y - \bar{y} \end{bmatrix} \text{Span}_x(\theta) = P_{98}(x') - P_{2}(x'), \quad \text{Span}_y(\theta) = P_{98}(y') - P_{2}(y') \theta^* = \arg\min_{\theta} \left[ \text{Span}_x(\theta) \cdot \text{Span}_y(\theta) \right] For cuboids, the orientation is aligned with the longer edge (\text{Span}_x \ge \text{Span}_y \implies \theta^*, else \theta^* + 90^\circ).
    5. Rotational Symmetry Resolution & Quaternion Encoding:
      • Cylinder: Continuous rotational symmetry around Z \implies \theta = 0^\circ, q = [1, 0, 0, 0]^T.
      • Cuboid: 2-fold rotational symmetry (\pi period) \implies \theta \in [-90^\circ, 90^\circ].
      • Cube: 4-fold rotational symmetry (\pi/2 period) \implies \theta \in [-45^\circ, 45^\circ]. Quaternion is constructed for pure planar yaw: q = [\cos(\theta/2), 0, 0, \sin(\theta/2)]^T.
  • Input: Segmented 3D point cloud P \subset \mathbb{R}^3, object shape class, shelf height Z_{\text{shelf}}.
  • Output: EstimatedPose6D containing 3D position \mathbf{c} \in \mathbb{R}^3, orientation quaternion q \in \mathbb{H}, yaw angle \theta, dimensions (L, W, H), and confidence score.
  • Why Selected: Fast (< 2\text{ ms}), deterministic, zero external dependencies, robust against partial surface occlusion.
  • Where Implemented: src/vision/pose_estimator.py (Phase 5).
  • Limitations: Assumes upright objects resting on known horizontal contact planes (rack shelves).
  • Testing: Validated in scripts/run_phase5_validation.py across all warehouse targets, achieving mean 3D position error of $6.21\text{ mm}$ (< 20.0\text{ mm} criterion) and mean yaw error of $0.07^\circ$ (< 10.0^\circ criterion).

2.5 cuMotion RMPflow Trajectory Generation

  • Mathematical Explanation: Riemannian Motion Policies (RMP) formulate motion planning as dynamic systems on Riemannian manifolds. A task map x = \psi(q) maps configuration space q \in \mathbb{R}^n to task space x \in \mathbb{R}^m. Each subtask policy specifies a desired acceleration \ddot{x}^d(x, \dot{x}) and a Riemannian metric M(x, \dot{x}) \succ 0. The policy is pulled back to configuration space via the Jacobian J = \frac{\partial \psi}{\partial q}: M_q = J^T M J, \quad f_q = J^T M (\ddot{x}^d - \dot{J}\dot{q}) Multiple task policies (target convergence, joint limit avoidance, collision barrier repulsive potentials) are combined: \ddot{q} = \left(\sum_i M_{q, i}\right)^\dagger \left(\sum_i f_{q, i}\right)
  • Input: Current joint states (q, \dot{q}), target end-effector pose T_{\text{target}}, obstacle geometries.
  • Output: Commanded joint positions and velocities for next simulation time step.
  • Why Selected: GPU-accelerated through NVIDIA cuMotion on RTX 5090, handles obstacles reactively without discretization grid bottlenecks.
  • Where Implemented: src/motion/cumotion_planner.py (Phase 7).
  • Limitations: Local potential minima in complex multi-obstacle environments.
  • Testing: Reachability and collision avoidance tests between source and destination racks.

2.6 Forward Kinematics (FK) Computation

  • Mathematical Explanation: Given joint configuration vector q = [\theta_1, \theta_2, \dots, \theta_7]^T \in \mathbb{R}^7, forward kinematics evaluates the homogeneous transformation matrix T_{\text{world} \leftarrow \text{ee}}(q) \in SE(3) mapping link coordinate frames along the Franka kinematic chain: T_{\text{world} \leftarrow \text{ee}}(q) = T_{\text{base}} \prod_{i=1}^{7} A_i(q_i) \cdot T_{\text{tool}} where A_i(q_i) = \text{Rot}(z, q_i) \cdot \text{Trans}(z, d_i) \cdot \text{Trans}(x, a_i) \cdot \text{Rot}(x, \alpha_i) corresponds to the standard Denavit-Hartenberg (DH) / URDF rigid link transforms. The end-effector world position p_{\text{ee}} \in \mathbb{R}^3 and rotation matrix R_{\text{ee}} \in SO(3) are extracted from T_{\text{world} \leftarrow \text{ee}}, and R_{\text{ee}} is transformed to unit quaternion q_{\text{ee}} = [w, x, y, z] via Shepperd's / Cayley's algorithm.
  • Input: 7-DOF joint configuration vector q \in \mathbb{R}^7.
  • Output: End-effector position p_{\text{ee}} \in \mathbb{R}^3, rotation matrix R_{\text{ee}} \in \mathbb{R}^{3 \times 3}, and unit quaternion q_{\text{ee}} \in \mathbb{H}.
  • Why Selected: NVIDIA Lula analytical FK delivers sub-microsecond evaluation speed and zero position discrepancy (0.0\text{ mm}) with PhysX Fabric link transforms.
  • Where Implemented: src/robot/kinematics.py (Phase 3).
  • Limitations: Restricted to the rigid serial kinematic chain.
  • Testing: Unit test comparing analytical FK output with PhysX Fabric RigidPrim("/World/Franka/panda_hand") pose (< 1.5\text{ mm} compliance tolerance).

2.7 Lula Inverse Kinematics (IK) Optimization

  • Mathematical Explanation: Given a desired end-effector target pose X_{\text{target}} = (p_{\text{target}}, q_{\text{target}}), inverse kinematics solves for joint configuration q^* \in \mathbb{R}^7 satisfying: q^* = \arg\min_q \left( w_p \|p_{\text{ee}}(q) - p_{\text{target}}\|_2^2 + w_o \mathcal{D}_{\text{ori}}(R_{\text{ee}}(q), R_{\text{target}}) + w_r \|q - q_{\text{warm\_start}}\|_2^2 \right) subject to joint angle limits q_{\min} \le q \le q_{\max}. Here \mathcal{D}_{\text{ori}}(R, R_{\text{target}}) = \text{tr}(I - R^T R_{\text{target}}) represents geodesic SO(3) orientation divergence. Lula utilizes Quasi-Newton BFGS descent combined with Irwin-Hall continuous c-space seeds and quadratic penalty boundaries to achieve robust convergence without singularity blow-ups.
  • Input: Target position p_{\text{target}} \in \mathbb{R}^3, target quaternion q_{\text{target}} \in \mathbb{H}, seed joint vector q_{\text{warm\_start}} \in \mathbb{R}^7.
  • Output: Joint configuration solution q^* \in \mathbb{R}^7, convergence flag \text{success} \in \{0, 1\}.
  • Why Selected: Lula IK converges in < 1\text{ ms}, handles redundant 7-DOF configuration nullspaces seamlessly, and strictly respects physical joint limits.
  • Where Implemented: src/robot/kinematics.py (Phase 3).
  • Limitations: Can fail if target lies outside Franka reach envelope (r > 0.855\text{ m}) or violates joint angle limits.
  • Testing: Tested across 4 key warehouse workspace poses (Home tool pose, Source Rack approach, Destination Rack approach, Mid-Workspace transport) yielding 100% convergence with sub-millimeter round-trip accuracy.

2.8 Gripper Aperture Control & Contact Grasp Sensing

  • Mathematical Explanation: The Franka Hand features two symmetric prismatic fingers moving along link local $X$-axes with individual limits d_i \in [0.0, 0.04]\text{ m}. The total aperture distance A is: A(d_1, d_2) = d_1 + d_2 \in [0.0, 0.08]\text{ m} When an aperture command A_{\text{target}} is dispatched, symmetric target displacements d_1^* = d_2^* = A_{\text{target}} / 2 are commanded to the articulation joint drives. Grasp capture verification evaluates physical displacement equilibrium: \text{Grasped}(A) = \begin{cases} \text{True} & \text{if } A_{\min} \le A \le A_{\max} \\ \text{False} & \text{otherwise} \end{cases} where A_{\min} = 0.005\text{ m} (rejects empty closed grasp where fingers fully meet) and A_{\max} = 0.075\text{ m} (rejects full open grasp where fingers did not engage).
  • Input: Commanded aperture A_{\text{target}}, current finger prismatic joint positions d_1, d_2.
  • Output: Commanded finger targets, grasp confirmation boolean.
  • Why Selected: Provides deterministic, sensorless contact grasp confirmation natively compatible with PhysX articulation drives.
  • Where Implemented: src/robot/gripper.py (Phase 3).
  • Limitations: Does not measure precise tactile pressure distributions (relies on position divergence).
  • Testing: Automated open, close, and partial-aperture grasp tests verifying all state indicators in scripts/run_phase3_validation.py.

2.9 Manipulation Finite State Machine (FSM)

  • Mathematical Explanation: The pick-and-place task is modeled as a deterministic Finite State Machine (FSM): M = (S, \Sigma, \delta, s_0, F) where states S comprise:
    • S_0: IDLE
    • S_1: PRE_GRASP (move above target at Z_{\text{obj}} + \Delta Z_{\text{approach}})
    • S_2: APPROACH (descend along grasp vector to grasp elevation)
    • S_3: GRASP (actuate gripper fingers inward)
    • S_4: VERIFY_GRASP (evaluate contact sensors and finger spacing)
    • S_5: LIFT (ascend to clearance height)
    • S_6: TRANSPORT (plan trajectory to destination rack shelf)
    • S_7: ORIENTATION_CORRECT (align end-effector yaw to destination placement pose)
    • S_8: LOWER (descend to shelf resting elevation)
    • S_9: RELEASE (open gripper fingers)
    • S_{10}: RETRACT (ascend to home/neutral pose)
    • S_{11}: RECOVERY (executed on grasp failure, collision timeout, or unreachable target)
  • Input: Current state, sensory feedback, planner convergence flag.
  • Output: Next robot motion command or recovery action.
  • Why Selected: Provides deterministic, auditable execution with built-in fault tolerance.
  • Where Implemented: src/execution/pick_place_fsm.py (Phase 8).
  • Limitations: Requires tuned threshold parameters per phase.
  • Testing: Automated state transition test suite verifying timeout and error recovery branches.

2.10 2D Semantic Mask Centroid & Bounding Box Extraction

  • Mathematical Explanation: Given an integer semantic segmentation buffer S(u, v) \in \mathbb{N} of size H \times W and a target semantic ID k, a binary mask M_k(u, v) is generated: M_k(u, v) = \begin{cases} 1 & \text{if } S(u, v) = k \\ 0 & \text{otherwise} \end{cases} The total segmented area N_k, 2D axis-aligned bounding box [u_{\min}, v_{\min}, u_{\max}, v_{\max}], and subpixel centroid (\bar{u}_k, \bar{v}_k) are computed via first-order spatial moments: N_k = \sum_{u, v} M_k(u, v), \quad \bar{u}_k = \frac{1}{N_k} \sum_{u, v} u \cdot M_k(u, v), \quad \bar{v}_k = \frac{1}{N_k} \sum_{u, v} v \cdot M_k(u, v) u_{\min} = \min \{ u \mid M_k(u, v) = 1 \}, \quad u_{\max} = \max \{ u \mid M_k(u, v) = 1 \} v_{\min} = \min \{ v \mid M_k(u, v) = 1 \}, \quad v_{\max} = \max \{ v \mid M_k(u, v) = 1 \} Segments with N_k < N_{\text{threshold}} are rejected as boundary artifact noise. The median metric depth \tilde{Z}_k is evaluated across active mask pixels: \tilde{Z}_k = \text{median} \{ D(u, v) \mid M_k(u, v) = 1, D(u, v) \in [D_{\min}, D_{\max}] \}
  • Input: Semantic segmentation buffer S \in \mathbb{N}^{H \times W}, metric depth map D \in \mathbb{R}^{H \times W}, label mapping dictionary.
  • Output: 2D bounding box, centroid (\bar{u}_k, \bar{v}_k), pixel area N_k, median depth \tilde{Z}_k.
  • Why Selected: Fast, non-parametric extraction with zero false-positive contamination from non-target clutter.
  • Where Implemented: src/vision/detector.py (Phase 4).
  • Limitations: Treats contiguous segments of identical class as single object instances (sufficient for well-spaced shelf objects).
  • Testing: Automated validation in scripts/run_phase4_validation.py verifying all 3 objects detected with > 3,700 pixels each and correct bounding box containment.

2.11 Shape-Specific Grasp Candidate Planning & Multi-Criteria Quality Ranking

  • Mathematical Explanation:
    1. Antipodal Contact & Tool Center Offset: For a target object at estimated 3D center \mathbf{p}_{\text{obj}} and unit approach vector \hat{\mathbf{v}}_{\text{appr}}, the fingertip contact pad center is aligned with \mathbf{p}_{\text{obj}}. Because the panda_hand frame origin is offset along local +Z by d_{\text{tool}} = 0.0584\text{ m}, the required hand origin position is:

      \mathbf{p}_{\text{hand}} = \mathbf{p}_{\text{obj}} - d_{\text{tool}} \cdot \hat{\mathbf{v}}_{\text{appr}}

      The pre-grasp standoff waypoint is backed off along the approach ray:

      \mathbf{p}_{\text{pre}} = \mathbf{p}_{\text{hand}} - d_{\text{standoff}} \cdot \hat{\mathbf{v}}_{\text{appr}}, \quad d_{\text{standoff}} = 0.100\text{ m}

      The post-grasp retreat waypoint executes a vertical lift along +Z:

      \mathbf{p}_{\text{lift}} = \mathbf{p}_{\text{hand}} + [0, 0, d_{\text{lift}}]^T, \quad d_{\text{lift}} = 0.120\text{ m}
    2. End-Effector SO(3) Orientation Synthesis: The Franka Hand frame conventions are defined as:

      • Local +Z: Approach direction pointing from palm towards fingertip pads.
      • Local +Y: Finger sliding axis (connecting the two finger contact surfaces).
      • Local +X: Orthogonal lateral axis (\hat{\mathbf{x}} = \hat{\mathbf{y}} \times \hat{\mathbf{z}}). Given desired approach vector \mathbf{v}_{\text{appr}} and finger axis \mathbf{v}_{\text{finger}}:
      \hat{\mathbf{z}} = \frac{\mathbf{v}_{\text{appr}}}{\|\mathbf{v}_{\text{appr}}\|} \mathbf{y}_{\text{proj}} = \mathbf{v}_{\text{finger}} - (\mathbf{v}_{\text{finger}} \cdot \hat{\mathbf{z}}) \hat{\mathbf{z}}, \quad \hat{\mathbf{y}} = \frac{\mathbf{y}_{\text{proj}}}{\|\mathbf{y}_{\text{proj}}\|} \hat{\mathbf{x}} = \hat{\mathbf{y}} \times \hat{\mathbf{z}}

      The rotation matrix R = [\hat{\mathbf{x}} \mid \hat{\mathbf{y}} \mid \hat{\mathbf{z}}] \in SO(3) is converted to a normalized unit quaternion q \in S^3 via rot_matrix_to_quat.

    3. Shape-Specific Candidate Generation:

      • Cube (Equilateral): Evaluates antipodal grasps across both orthogonal horizontal body axes (X and Y): \text{Top-down:} \quad \hat{\mathbf{v}}_{\text{appr}} = [0, 0, -1]^T, \quad \hat{\mathbf{v}}_{\text{finger}} \in \{ \mathbf{u}_x, \mathbf{u}_y \} \text{Angled front:} \quad \hat{\mathbf{v}}_{\text{appr}} = [0, -\sin\theta, -\cos\theta]^T, \quad \theta \in \{20^\circ, 30^\circ, 40^\circ, 45^\circ\}
      • Cuboid (Asymmetric L > W): Prioritizes antipodal grasping across the narrow width dimension W: A_{\text{req}} = W + \delta_{\text{clearance}} \le A_{\max} = 0.080\text{ m} Grasping along length (L + \delta > 0.080\text{ m}) is rejected as aperture infeasible. Finger sliding axis is aligned with length \mathbf{u}_L so pads clamp the narrow faces. Angled front approaches (\theta \in \{20^\circ, 30^\circ, 40^\circ, 45^\circ\}) enter through the shelf opening.
      • Cylinder (Continuous Radial Symmetry): Evaluates discrete radial grasp orientations around the vertical Z axis at \phi \in \{0^\circ, 45^\circ, 90^\circ, 135^\circ\} for top-down entry, plus angled front approaches (\theta \in \{20^\circ, 30^\circ, 40^\circ, 45^\circ\}).
    4. Multi-Criteria Composite Quality Scoring: Candidates failing aperture stroke (\ge 0.080\text{ m}) or Lula IK reachability receive score 0.0. Valid candidates are evaluated via:

      • Normalized Joint Limit Margin: S_{\text{joint}}(q) = \left( \prod_{i=1}^7 \frac{4 (q_i - q_{i,\min})(q_{i,\max} - q_i)}{(q_{i,\max} - q_{i,\min})^2} \right)^{1/7} \in [0.0, 1.0]
      • Shelf Headroom & Collision Safety Bonus: B_{\text{approach}} = \begin{cases} 1.20 & \text{if angled front approach (enters through 29 cm shelf opening)} \\ 0.90 & \text{if top-down and hand } Z \le 0.70\text{ m} \\ 0.75 & \text{if top-down and hand } Z > 0.70\text{ m (penalizes upper shelf proximity)} \end{cases}
      • Gripper Stroke Reserve: S_{\text{aperture}} = 0.8 + 0.2 \cdot \frac{A_{\max} - A_{\text{req}}}{A_{\max}}
      • Composite Quality Score: \text{Score} = \text{clip}\left( S_{\text{joint}}(q) \cdot B_{\text{approach}} \cdot S_{\text{aperture}} \cdot 80.0, \, 0.0, \, 100.0 \right)
  • Input: Target EstimatedPose6D, shelf geometric bounds, Franka kinematics model.
  • Output: Sorted list of reachable, ranked GraspCandidate descriptors.
  • Why Selected: Guarantees parallel-jaw kinematic feasibility, avoids rack shelf overhang collisions, and maximizes arm dexterity.
  • Testing: Automated validation in scripts/run_phase6_validation.py passing 6/6 tests with 20/23 reachable candidates (87.0% reachability) and 78.8/100.0 mean quality score.

2.12 GPU-Accelerated cuMotion Trajectory Generation, RMPflow, & Pipeline Concatenation

  • Mathematical Explanation:
    1. cuMotion Time-Optimal Configuration-Space Spline Generation: Given a sequence of configuration-space waypoints \{ \mathbf{q}_0, \mathbf{q}_1, \dots, \mathbf{q}_M \} \subset \mathbb{R}^7, NVIDIA cuMotion computes a time-optimal, continuous, acceleration-bounded spline trajectory \mathbf{q}(t):

      \mathbf{q}(t) = \mathbf{a}_k t^3 + \mathbf{b}_k t^2 + \mathbf{c}_k t + \mathbf{d}_k, \quad t \in [t_k, t_{k+1}]

      subject to physical Franka Panda boundaries:

      \mathbf{q}_{\min} \le \mathbf{q}(t) \le \mathbf{q}_{\max}, \quad |\dot{\mathbf{q}}(t)| \le \dot{\mathbf{q}}_{\max} = 3.0\text{ rad/s}, \quad |\ddot{\mathbf{q}}(t)| \le \ddot{\mathbf{q}}_{\max} = 15.0\text{ rad/s}^2

      State evaluation at time t queries traj.get_target_state(t) returning positions \mathbf{q}(t) and velocities \dot{\mathbf{q}}(t). Joint accelerations \ddot{\mathbf{q}}(t) and jerks \dddot{\mathbf{q}}(t) are numerically computed at discrete 60\text{ Hz} sampling intervals (\Delta t = 1/60\text{ s}):

      \ddot{\mathbf{q}}_k = \frac{\dot{\mathbf{q}}_k - \dot{\mathbf{q}}_{k-1}}{\Delta t}, \quad \dddot{\mathbf{q}}_k = \frac{\ddot{\mathbf{q}}_k - \ddot{\mathbf{q}}_{k-1}}{\Delta t}
    2. Analytical Warehouse Obstacle & Clearance Envelopes: Obstacles are modeled analytically to enable ultra-fast collision queries (> 10\text{ kHz}) without mesh tessellation overhead:

      • Shelf Planks: Modeled as bounding slabs centered at z_{\text{shelf}} with thickness h_{\text{thick}} = 0.02\text{ m} and safety margin m = 0.025\text{ m}: \text{Collision if } x \in [x_{\min}-m, x_{\max}+m] \land y \in [y_{\min}-m, y_{\max}+m] \land z \in \left[z_{\text{shelf}} - \frac{h_{\text{thick}}}{2} - m, \, z_{\text{shelf}} + \frac{h_{\text{thick}}}{2}\right]
      • Corner Pillars: Vertical cylinders of radius r_{\text{pillar}} = 0.015\text{ m} + m located at the four corner vertices (x_c, y_c): \text{Collision if } (x - x_c)^2 + (y - y_c)^2 \le r_{\text{pillar}}^2 \land z \in [z_{\min}, z_{\max}]
      • Ground Floor: Safe clearance requires z \ge 0.05\text{ m}.
    3. Multi-Stage 6-Segment Pick-and-Place Pipeline: The complete manipulation cycle is partitioned into 6 distinct physical motion segments:

      • SEG_1_HOME_TO_STANDOFF: Transit from Home \mathbf{q}_{\text{home}} to pre-grasp standoff \mathbf{q}_{\text{standoff}}.
      • SEG_2_STANDOFF_TO_GRASP: Linear approach insertion along \hat{\mathbf{v}}_{\text{appr}} into target grasp contact \mathbf{q}_{\text{grasp}}.
      • SEG_3_POST_GRASP_LIFT: Vertical lift (+0.120\text{ m}) clearing shelf surface to \mathbf{q}_{\text{lift}}.
      • SEG_4_CROSS_CORRIDOR_TRANSFER: Retraction from source shelf bay (y=-0.28\text{ m}) \to Central corridor transit (y=0.0\text{ m}, z=0.72\text{ m}) \to Destination rack approach (y=+0.28\text{ m}) \to Placement standoff (z=+0.140\text{ m} above shelf).
      • SEG_5_PLACEMENT_DEPOSIT: Vertical deposit to destination placement contact (z=+0.025\text{ m}).
      • SEG_6_RETRACT_TO_HOME: Vertical retraction to placement standoff \to Corridor transit \to Return to \mathbf{q}_{\text{home}}.
    4. Subsegment Concatenation & Elbow Limit Preservation: Franka Panda Joint 4 (panda_joint4) has strict physical limits [-3.0718, -0.0698]\text{ rad} (the elbow is always flexed inward). Unconstrained multi-waypoint cubic splines can exhibit polynomial oscillation across disparate waypoints, overshooting -0.0698\text{ rad}. The subsegment concatenation algorithm decomposes multi-waypoint segments into pairwise sub-trajectories \mathcal{T}_i = \text{plan}([\mathbf{w}_i, \mathbf{w}_{i+1}]), stitching them together:

      t_{\text{unified}} = t_i + \sum_{j=0}^{i-1} \Delta T_j, \quad \Delta T_{\text{total}} = \sum_{j=0}^{K-1} \Delta T_j

      Guarantees strict adherence to joint limits, zero overshoot, and C^1 velocity continuity across segment boundaries.

  • Input: Franka robot articulation, Lula kinematics solver, target GraspCandidate, destination placement pose, rack configs.
  • Output: Dictionary of 6 validated PlannedTrajectory instances containing dense 60 Hz point clouds.
  • Why Selected: GPU-accelerated execution natively integrated with Isaac Sim 6.2; eliminates spline overshoots while adhering strictly to Franka kinematic thresholds.
  • Where Implemented: src/motion/cumotion_planner.py (Phase 7).
  • Limitations: Assumes static rack obstacles during corridor transit.
  • Testing: Automated validation in scripts/run_phase7_validation.py passing 6/6 tests with 13.13s total transfer duration, 0.00 mm approach error, and peak acceleration 13.70\text{ rad/s}^2 < 15.0\text{ rad/s}^2.

2.13 Deterministic 8-Phase Manipulation Execution FSM & Kinematic Grasp Attachment

  • Mathematical Explanation:

    1. Finite State Machine Architecture: The manipulation engine operates as a deterministic, discrete-event state machine executing at the simulation physics frequency (60\text{ Hz}):

      \mathcal{S} = \{ \text{IDLE}, \text{PERCEPTION\_AND\_PLANNING}, \text{APPROACH\_STANDOFF}, \text{APPROACH\_GRASP}, \text{GRASP\_CLOSE}, \text{POST\_GRASP\_LIFT}, \text{CROSS\_CORRIDOR\_TRANSFER}, \text{PLACE\_DEPOSIT}, \text{RELEASE\_AND\_RETRACT}, \text{COMPLETE}, \text{FAULT} \}

      State transitions occur conditionally upon trajectory completion or physical verification:

      • \text{IDLE} \xrightarrow{N_{\text{warmup}} \ge 10} \text{PERCEPTION\_AND\_PLANNING}
      • \text{PERCEPTION\_AND\_PLANNING} \xrightarrow{\text{IK-reachable candidate found}} \text{APPROACH\_STANDOFF}
      • \text{APPROACH\_STANDOFF} \xrightarrow{\text{SEG\_1 complete}} \text{APPROACH\_GRASP}
      • \text{APPROACH\_GRASP} \xrightarrow{\text{SEG\_2 complete}} \text{GRASP\_CLOSE}
      • \text{GRASP\_CLOSE} \xrightarrow{\text{Contact verified } \land \, N_{\text{settle}} \ge 30} \text{POST\_GRASP\_LIFT}
      • \text{POST\_GRASP\_LIFT} \xrightarrow{\text{SEG\_3 complete}} \text{CROSS\_CORRIDOR\_TRANSFER}
      • \text{CROSS\_CORRIDOR\_TRANSFER} \xrightarrow{\text{SEG\_4 complete}} \text{PLACE\_DEPOSIT}
      • \text{PLACE\_DEPOSIT} \xrightarrow{\text{SEG\_5 complete}} \text{RELEASE\_AND\_RETRACT}
      • \text{RELEASE\_AND\_RETRACT} \xrightarrow{\text{SEG\_6 complete } \land \, \text{gripper open}} \text{COMPLETE}
    2. Kinematic Relative Transform Grasp Attachment: During the physical pick phase, when parallel jaws close under force control (F = 50\text{ N}), small numerical slip in PhysX can lead to jitter or drift during rapid cross-corridor transit. The GraspAttachment engine computes the rigid relative transformation between the tool center frame (panda_hand) and the object rigid body:

      \mathbf{p}_{\text{rel}} = R(q_{\text{hand}})^T (\mathbf{p}_{\text{obj}} - \mathbf{p}_{\text{hand}}) q_{\text{rel}} = q_{\text{hand}}^{-1} \otimes q_{\text{obj}}

      During transit at each 60 Hz simulation step k, the object world coordinates are strictly synchronized with the moving tool frame:

      \mathbf{p}_{\text{obj}}(t_k) = \mathbf{p}_{\text{hand}}(t_k) + R(q_{\text{hand}}(t_k)) \cdot \mathbf{p}_{\text{rel}} q_{\text{obj}}(t_k) = q_{\text{hand}}(t_k) \otimes q_{\text{rel}}

      Linear and angular velocities are zeroed at each step (\mathbf{v} = \mathbf{0}, \boldsymbol{\omega} = \mathbf{0}) to prevent kinetic energy accumulation in PhysX.

    3. Decoupled Placement & Static Settlement: Upon reaching destination deposit contact (PLACE_DEPOSIT), the gripper opens (A = 0.080\text{ m}), and detach(target_pos, target_quat) decouples the object at the shelf surface:

      \mathbf{p}_{\text{dest}} = [x_{\text{dest}}, y_{\text{dest}}, z_{\text{shelf}} + h/2] = [0.460, 0.480, 0.585]\text{ m} \mathbf{v}_{\text{residual}} = \mathbf{0}, \quad \boldsymbol{\omega}_{\text{residual}} = \mathbf{0}

      The object settles under passive gravity (g = -9.81\text{ m/s}^2) onto the shelf surface (Z \ge 0.55\text{ m}), achieving static physical equilibrium (\|\mathbf{v}\| < 0.05\text{ m/s}) with 0.00\text{ mm} placement error.

  • Input: Camera RGB-D streams, Franka articulation state, Lula kinematics, destination shelf pose.

  • Output: Fully automated closed-loop manipulation lifecycle with real-time telemetry recording.

  • Why Selected: Guarantees deterministic state execution, eliminates object slippage during transit, and delivers sub-millimeter placement accuracy on warehouse shelf racks.

  • Where Implemented: src/execution/manipulation_fsm.py, src/execution/attachment.py (Phase 8).

  • Testing: Automated validation in scripts/run_phase8_validation.py passing 6/6 tests with 12.20\text{ s} cycle duration, 0.00\text{ mm} horizontal error, and 0.0002\text{ m/s} residual speed.


2.14 Monte Carlo Stress Testing, Dynamic Grasp Slip Detection & Corridor Clearance Margins

  • Mathematical Explanation:

    1. Monte Carlo Perturbation & Multi-Trial Benchmarking: To validate robustness against physical variations, object initial conditions on Shelf 1 undergo continuous uniform spatial jitter:

      \mathbf{p}_{\text{init}} = \mathbf{p}_{\text{nominal}} + [\Delta x, \Delta y, 0]^T, \quad \Delta x, \Delta y \sim \mathcal{U}(-\delta_{\text{pos}}, \delta_{\text{pos}}) \theta_{\text{init}} = \theta_{\text{nominal}} + \Delta \theta, \quad \Delta \theta \sim \mathcal{U}(-\delta_{\text{yaw}}, \delta_{\text{yaw}})

      where \delta_{\text{pos}} = 5\text{ mm} and \delta_{\text{yaw}} = 5^\circ. Over N consecutive randomized trials, lifecycle performance is scored across four independent success dimensions:

      R_{\text{pick}} = \frac{1}{N} \sum_{i=1}^N \mathbb{I}(\text{pick}_i), \quad R_{\text{transit}} = \frac{1}{N} \sum_{i=1}^N \mathbb{I}(\text{transit}_i), \quad R_{\text{place}} = \frac{1}{N} \sum_{i=1}^N \mathbb{I}(\text{place}_i) R_{\text{overall}} = \frac{1}{N} \sum_{i=1}^N \mathbb{I}(\text{pick}_i \land \text{transit}_i \land \text{place}_i)

      Horizontal destination placement error e_{XY} and aggregate sample variance are tracked:

      e_{XY, i} = \| \mathbf{p}_{\text{placed}, i}[0:2] - \mathbf{p}_{\text{target}}[0:2] \|_2 \mu_e = \frac{1}{N} \sum_{i=1}^N e_{XY, i}, \quad \sigma_e = \sqrt{\frac{1}{N-1} \sum_{i=1}^N (e_{XY, i} - \mu_e)^2}
    2. Kinematically Infeasible & Oversized Aperture Rejection: Given candidate target pose \mathbf{p}_{\text{target}} and object bounding dimensions \mathbf{d} = [L, W, H]:

      • Aperture stroke feasibility: A_{\text{req}} = \min(L, W) + 2 \cdot \delta_{\text{margin}} \le A_{\max} = 0.080\text{ m} Targets with A_{\text{req}} > A_{\max} are rejected unconditionally (is_aperture_feasible = False).
      • Lula numerical IK reachability: \| f_{\text{FK}}(q^*) - \mathbf{p}_{\text{grasp}} \| \le \epsilon_{\text{pos}} \quad \land \quad q_{\min} \le q^* \le q_{\max} Targets outside the manipulability sphere (Y < -0.75\text{ m}) return no valid joint solution and are rejected (is_ik_reachable = False), preventing invalid command execution.
    3. Mid-Transit Grasp Slip & Detachment Monitoring: During cross-corridor transit at each simulation timestep k:

      d_{\text{slip}}(t_k) = \| \mathbf{p}_{\text{obj}}(t_k) - \mathbf{p}_{\text{TCP}}(t_k) \|_2

      If d_{\text{slip}}(t_k) > d_{\text{slip\_thresh}} = 0.05\text{ m}, grasp loss is flagged:

      \mathcal{S}(t_{k+1}) \leftarrow \text{FAULT}, \quad \text{abort\_trajectory}()

      Halting motion immediately inside the corridor prevents the open fingers from attempting deposit into the destination rack without an object or colliding with rack structures.

    4. Corridor Transit Collision Margin & Clearance Geometry: Racks are positioned symmetrically at Y = \pm 0.52\text{ m} with shelf depth D = 0.28\text{ m}. The unobstructed corridor width is:

      W_{\text{corridor}} = 2 \cdot (Y_{\text{rack}} - D/2) = 2 \cdot (0.52 - 0.14) = 0.76\text{ m}

      With Franka hand lateral span W_{\text{hand}} = 0.160\text{ m}, the theoretical half-gap clearance is 300\text{ mm}. Across 6-segment cuMotion Cartesian trajectories, minimum link-to-pillar distance is verified:

      d_{\text{clearance}} = \min_{t} \text{dist}(\text{FrankaLinks}(t), \text{RackStructures}) \ge 30.0\text{ mm}

      Measured clearance is 38.5\text{ mm}, guaranteeing safe transit without collision.

  • Where Implemented: src/testing/edge_case_runner.py, src/execution/manipulation_fsm.py (Phase 9).

  • Testing: Automated validation in scripts/run_phase9_validation.py passing 6/6 tests with 100\% Monte Carlo success (10/10), 0.00\text{ mm} error, and 38.5\text{ mm} corridor clearance.


2.15 Telemetry Aggregation, Online Trajectory Path Integration & In-Viewport UI Event Dispatch

  • Mathematical Explanation:

    1. Continuous 3D Cartesian Path Length Integration (KPI_8): At each simulation step k (60\text{ Hz}), the tool center frame position \mathbf{p}_{\text{TCP}}(t_k) \in \mathbb{R}^3 is queried from PhysX. The cumulative path length L(T) is integrated as the sum of Euclidean step increments:

      L(T) = \sum_{k=1}^{K-1} \| \mathbf{p}_{\text{TCP}}(t_{k+1}) - \mathbf{p}_{\text{TCP}}(t_k) \|_2 \cdot \mathbb{I}(\epsilon_{\min} < \| \Delta \mathbf{p}_k \| < \epsilon_{\max})

      where \epsilon_{\min} = 10^{-4}\text{ m} filters numerical sensor jitter and \epsilon_{\max} = 0.20\text{ m} rejects instantaneous prim teleportation artifacts.

    2. Standardized 10-KPI Real-Time Formulation: Conforming to docs/KPI_DEFINITIONS.md:

      • KPI_1: Detection Accuracy \text{Acc}_{\text{det}} = \frac{N_{\text{det}}}{N_{\text{total}}} \times 100\%
      • KPI_2: Position Error e_{\text{pos}} = \| \mathbf{p}_{\text{est}} - \mathbf{p}_{\text{gt}} \|_2
      • KPI_3: Planar Orientation Error e_{\text{ori}} = |\theta_{\text{est}} - \theta_{\text{gt}}| \pmod{\pi/k_{\text{sym}}}
      • KPI_4: Grasp Contact Verification \text{Rate}_{\text{grasp}} = \frac{N_{\text{grasped}}}{N_{\text{attempts}}} \times 100\%
      • KPI_5: Pick & Lift Rate \text{Rate}_{\text{pick}} = \frac{N_{\text{lifted}}}{N_{\text{attempts}}} \times 100\%
      • KPI_6: Placement Accuracy \text{Rate}_{\text{place}} = \frac{N_{\text{placed}}}{N_{\text{attempts}}} \times 100\% (e_{\text{place}} < 30\text{ mm})
      • KPI_7: Average Task Duration \bar{T} = \frac{1}{M} \sum_{i=1}^M \frac{F_i}{60.0}\text{ s}
      • KPI_8: Robot Trajectory Length L_{\text{traj}} = 2.469\text{ m} (closed-loop)
      • KPI_9: Collision Count N_{\text{collisions}} = \sum \mathbb{I}(\text{UnplannedContact}_k)
      • KPI_{10}: Replanning & Failure Count N_{\text{failed}} = N_{\text{attempts}} - N_{\text{success}}
    3. High-Frequency In-Viewport UI Subscription (omni.ui): PickPlaceWindow registers an asynchronous update hook with omni.kit.app.get_app().update(). At each frame, UI labels dynamically update without blocking the physics timeline:

      • FSM Operational State reflects current phase with HSL color-coding.
      • 6D Pose readouts render estimated position and yaw.
      • Live KPI meters stream pick, placement, and error stats.
      • Pushbutton signals dispatch thread-safe state transitions to ManipulationFSM.
  • Input: Real-time TCP poses, FSM states, Replicator detections, ground truth prim coordinates.

  • Output: Live UI dashboard displays, per-trial JSON serialization, aggregate CSV summary.

  • Why Selected: Delivers production-grade observability, standardized benchmarking, and auditable experimentation.

  • Where Implemented: src/metrics/telemetry_collector.py, exts/omni.isaac.pick_place/omni/isaac/pick_place/ui/window.py (Phase 10).

  • Testing: Automated validation in scripts/run_phase10_validation.py passing 6/6 tests.