Calibrate the object
Temporary AprilTags define the object box. Permanent table tags preserve its box_center frame across camera views.
- IN
- Object, setup tags and permanent table tags
- OUT
- Calibration, metric box dimensions and fixed object frame
Two streams. One calibrated object frame.
Prepare the data once, then estimate pose from each new RGB-D observation.
Calibrated views become two models and one metric reference.
ILLUSTRATIVE SEQUENCE · NOT LIVE TELEMETRY
Temporary AprilTags define the object box. Permanent table tags preserve its box_center frame across camera views.
Two outputs, in parallel. Reviewed captures feed paired training datasets and a calibrated TSDF reference. The reference is measured geometry.
Use learned initialization, measured depth and accepted pose history.
ILLUSTRATIVE SEQUENCE · NOT LIVE TELEMETRY
The Gemini 305 supplies color and aligned depth with current rectified camera intrinsics. Synchronized observations share the color optical frame.
A guarded tracking loop. Startup / lost → PnP seed. Tracking → last accepted raw pose. GICP rejection preserves the seed; repeated failure returns to recovery.
Explore the algorithms, coordinate math, configuration and checks behind all twelve stages.
Four temporary setup tags define a metric box. A fixed permanent-tag map recovers that box across camera views after setup-tag removal. Its center, axes and eight corner identities define the common frame for labels and measured points.
ILLUSTRATIVE SEQUENCE · NOT LIVE TELEMETRY
Object, setup tags and permanent table tags
Calibration, metric box dimensions and fixed object frame
Estimate each tag pose from its known square size and image corners. The collection wrapper uses tagStandard41h12, setup IDs 1–4 at 14 mm and permanent IDs 5–10 at 28 mm. Wrong physical sizes directly corrupt metric scale.
Find the raised tag using height above the table. Of the remaining three, choose the origin whose two neighbor vectors are closest to perpendicular. Swap X and Y when needed so their cross product points toward the raised tag; numeric IDs do not prescribe placement roles.
Normalize the first base edge, remove its component from the second edge, and form Z by their cross product. Edge lengths and top height define dimensions. Place the object origin half a width, length and height from the resolved base origin.
Use the first visible permanent tag as the table frame. Store all visible permanent-tag transforms and T_table_object. A later camera view solves the mapped board pose and composes it with this fixed object transform.
Save calibration.json with dimensions, revision, tag sizes, resolved roles and box_center. Additional permanent tags can be mapped while two existing tags remain visible. Reconfiguring the box changes its revision and relabels existing captures through the preserved table frame.
Values below come from the checked-in implementation. Each note identifies its scope; launch arguments can override defaults.
| Setting | Value | Meaning / scope |
|---|---|---|
| Tag pose error | ≤ 2.5 px | Calibration helper default for individual tag and combined board reprojection error; this is a pixel agreement gate, not a measured physical accuracy. |
| Permanent board support | At least 2 visible tags | Required to set the box and estimate the mapped board pose. |
| Box dimensions | > 0.01 m and ≤ 2 m each | Geometry sanity limits in resolve_box_geometry. |
A tag size or physical placement disagrees with calibration assumptions.
Base tags are nearly collinear, too close, or do not form three rectangular corners; the top tag lacks clear elevation.
scripts/collect_process/01_capture.sh:5-19turntable_dataset.py:125-240turntable_dataset.py:302-365Each manual capture saves raw RGB, a tag-inpainted training image, aligned depth and a geometric label. Mapped tags determine its pose. The operator chooses useful viewpoints; the script does not measure coverage or automatically reject blur.
Calibrated object and RGB-D camera
Color, aligned depth, intrinsics and T_camera_object per view
Request color and depth from the chosen backend using collection depth limits. Save current intrinsics and image dimensions so projection and depth backprojection share camera geometry.
Detect permanent tags and solve their combined board pose from the fixed map. At least two mapped tags must be visible, and their board reprojection error must pass. Compose T_camera_object and project the canonical box center and eight corners.
Space or the Capture button requests a save. The request is refused if no valid label exists, any temporary setup tag is still detected, or a timestamp filename already exists. A partly clipped box is recorded with a flag; an entirely invalid clipped box cannot produce a label.
Keep raw_images for audit. Inpaint permanent tag regions into images for learning, reducing a visible fiducial shortcut. Save depth without annotation graphics; zero means invalid and each integer unit is 0.001 m.
The JSON carries timestamp, camera_color_optical_frame, box_center, calibration revision, metric pose, intrinsics and projected corners. Export the corresponding CenterPose sample, then append image/depth/label paths to samples.jsonl. An export failure is reported after the raw audit files have been saved.
Values below come from the checked-in implementation. Each note identifies its scope; launch arguments can override defaults.
| Setting | Value | Meaning / scope |
|---|---|---|
| Capture depth range | 0.25–1.5 m | Current capture CLI defaults; the live tracking configuration uses a separate minimum and must not be substituted here. |
| Per-view tag reprojection | ≤ 3.0 px | make_label/board_pose default for saved observations. |
| Depth storage | 0.001 m/unit; invalid = 0 | Saved depth PNG metadata declares alignment to the rectified color image. |
Too few mapped permanent tags, excessive reprojection error, missing calibration or a detected setup tag.
The object or permanent-tag arrangement moved relative to the frozen table-to-object transform.
scripts/capture_turntable_dataset.py:71-98turntable_dataset.py:302-365scripts/capture_turntable_dataset.py:558-605BiRefNet proposes foreground; geometry and image heuristics isolate the rigid object. The resulting mask supports segmentation, background replacement and fusion. Previews support human review, but numerical warning gates do not record human approval.
Captured color images and calibrated pose labels
Reviewed object masks paired with captured views
Read the inpainted RGB image and its pose label. Expand the projected box bounding rectangle by 60% of its larger dimension, clip to the image and run the local pretrained BiRefNet at 1024 × 1024. Restore probabilities to original image coordinates.
Threshold foreground probabilities at 0.5, then lower in 0.1 steps toward 0.2 if refinement fails to produce a usable component. If crop inference cannot produce a result, retry full-frame inference. Lower thresholds recover weak foreground; they do not establish mask correctness.
Restrict candidates to the projected 2D bounding rectangle plus 3% padding, with a two-pixel minimum. Subtract changed regions detected between raw and inpainted images. A bright-neutral HSV heuristic also breaks connections through pale paper and surfaces.
Apply an 11-pixel elliptical morphological opening to break thin connections such as cables. Prefer the connected component containing the projected object center; otherwise use the largest. Fill its largest external contour, then subtract the inpaint exclusion again so excluded tag pixels are not filled back in.
Write raw_masks, refined masks, previews and contact sheets. Inspect silhouettes, concavities and thin structures. Warnings abort the staged build by default; --allow-warnings permits them and requires closer review.
Values below come from the checked-in implementation. Each note identifies its scope; launch arguments can override defaults.
| Setting | Value | Meaning / scope |
|---|---|---|
| Threshold ladder | 0.5 → 0.2 in steps of 0.1 | Defaults stop at the first nonempty usable refinement; they do not optimize a ground-truth score. |
| Opening kernel | 11 × 11 elliptical | Pixel-scale heuristic that can remove real narrow object details. |
| Warning gates | inside bbox ≥ 0.95; bbox IoU ≥ 0.2; center inside | These compare foreground and projected box extents; they are not measured segmentation IoU against human labels. |
| Materialized augmentations | 0 per image | Current mask CLI default; training consumes masks for later on-the-fly compositing. |
The opening kernel or bright-neutral disconnect heuristic removes real foreground.
It remains connected to the selected center component or occupies the largest surviving component.
scripts/augment_centerpose_backgrounds.py:98-156scripts/augment_centerpose_backgrounds.py:177-336scripts/augment_centerpose_backgrounds.py:410-431scripts/augment_centerpose_backgrounds.py:503-521Segmentation receives a reviewed silhouette contour; pose receives eight canonical projected box corners. Both use the same images, masks and split membership. These labels describe visible foreground and a virtual 3D box, respectively.
Reviewed masks, source images and projected box corners
Paired YOLO segmentation and eight-keypoint datasets
Use an existing split manifest when available. Otherwise select 12.5% of source views for validation with seed 317. Materialized variants of a held-out source stay out of training; default export uses original images only.
Find external contours, discard small components and simplify with a perimeter-relative tolerance. Require exactly one surviving object polygon. Rasterize it back to a mask and reject excessive disagreement, exposing lost holes or disconnected regions instead of silently accepting a poor representation.
Read all eight finite corner projections in immutable XYZ sign order. When intrinsics and T_camera_object are available, recompute the canonical box projection and require agreement within 0.0001 px. All samples must use the same box dimensions.
Normalize polygon coordinates, the mask-derived object bounding box and in-image keypoints by image dimensions. Encode an off-image corner as (0, 0, 0); do not clamp it to a border. In-image visibility 2 means its projection exists, including a physically occluded virtual corner.
Write matching task images, labels, masks, combined annotations and YAML files with kpt_shape [8, 3]. Background compositing later replaces only pixels outside the mask, preserving foreground positions. Disable whole-image horizontal flips because mirroring does not preserve the corner identity contract.
Values below come from the checked-in implementation. Each note identifies its scope; launch arguments can override defaults.
| Setting | Value | Meaning / scope |
|---|---|---|
| Contour export | minimum area 100 px²; epsilon 0.001 × perimeter | CLI defaults; exactly one exterior polygon must survive. |
| Validation grouping | 12.5% of source views; seed 317 | Fallback CLI policy, overridden by an existing split manifest. Views can still share an acquisition session. |
| Keypoint identity | 8 ordered corners; fliplr = 0 | Order follows −−−, +−−, −+−, ++−, −−+, +−+, −++, +++; training explicitly disables horizontal flips. |
Disconnected foreground, retained clutter or meaningful mask holes cannot fit the required one-exterior-polygon representation.
Corner IDs were reordered or mirrored, or an incompatible calibration revision was mixed into the dataset.
scripts/generate_yolo_seg_pose_dataset.py:136-151scripts/generate_yolo_seg_pose_dataset.py:208-294scripts/generate_yolo_seg_pose_dataset.py:389-438scripts/generate_yolo_seg_pose_dataset.py:557-580scripts/train_yolo_seg_pose.py:55-83The reference is a sibling branch independent of YOLO training. TSDF fusion combines masked depth in box_center using saved camera poses, then crops and filters the surface into a metric cloud for runtime registration.
Reviewed masks, captured depth and calibrated view poses
reference.ply and frame metadata in box_center
TSDF expands to truncated signed distance function. A voxel stores a bounded signed-distance estimate around an observed surface. Integrating another calibrated depth view updates that estimate by weighted averaging, so many views contribute to one surface. Voxel size controls spatial sampling; truncation controls the distance band. Neither is an accuracy measurement.
Open3D 0.19 RGB-D integration ↗Require matching capture, depth, mask and label inputs, current box dimensions and calibration revision. Each saved pose must be a finite rigid transform; depth must be aligned to rectified color. By default require at least eight usable views.
Backproject nonzero masked depth with the saved intrinsics and metric scale. Transform points into box_center and retain those inside the box with a per-axis tolerance max(3 mm, 8% of that dimension). Each view must retain at least 100 depth pixels.
Build a scalable TSDF volume with metric voxel and truncation lengths. Pass T_camera_object directly as its world-to-camera extrinsic because the TSDF world is box_center. Inverting that matrix here would use the wrong transform convention.
Extract a point cloud, crop every axis to calibrated half-dimensions plus 3 mm, and remove statistical outliers with 20 neighbors and a 2.0 standard-deviation ratio. Estimate normals within 10 mm and orient them outward relative to the box origin.
Save reference.ply, frame.json, canonical object_keypoints.yaml and a ZIP bundle. Metadata declares metres, box_center, identity scan/object transforms and capture provenance. Optional crop editing must preserve this frame; an unrelated moving-camera diagnostic scan is a separate artifact.
Values below come from the checked-in implementation. Each note identifies its scope; launch arguments can override defaults.
| Setting | Value | Meaning / scope |
|---|---|---|
| TSDF resolution | 2.5 mm voxel; 12.5 mm truncation | Builder defaults; these are fusion settings, not a measured reference accuracy. |
| Quality minimums | 8 views; 100 pixels/view; 1,000 final points | The point minimum is checked before crop, after crop and after outlier filtering. |
| Saved default-session metadata | 212 views; 3,811 final points | Recorded in datasets/my_object_20260925_r2/references/my_object/frame.json; provenance of an existing artifact, not a new run or accuracy result. |
An inconsistent saved pose, object movement, depth alignment problem or mask contamination misregistered evidence.
Too little valid masked depth, incomplete coverage or an incompatible calibrated crop leaves insufficient geometry.
scripts/build_calibrated_reference.py:30-147nocs_dataset.py:52-80datasets/my_object_20260925_r2/references/my_object/frame.json:67-79scripts/collect_process/04b_crop_reference.sh:4-10The wrappers verify frame consistency and freeze PnP geometry before training two models. Segmentation learns foreground selection. Pose learns the eight image-space corner identities used for initialization and recovery. Their separate checkpoints share one metric corner contract.
Paired datasets, fixed geometry and training backgrounds
Segmentation checkpoint, pose checkpoint and frozen PnP geometry
Copy calibration.json and the exported canonical object_keypoints.yaml into training_pnp, recording SHA-256 hashes and calibration revision. If a snapshot already exists, verify it and refuse a different source box. This pins two geometry files; it is not a complete training-data or checkpoint hash manifest.
Require matching image, label and mask stems in train and val for both tasks, with equal split counts. This prevents training from incomplete paired exports.
The segmentation wrapper starts from the local emergency_stop_frozen_backbone checkpoint. Its current defaults use AdamW, 100 epochs maximum, patience 25, batch 8, image size 640, learning rate 0.0001 and freeze 11. The output run name ends _onthefly_seg.
The pose wrapper overrides the generic trainer defaults: start from my_object_rgbd_unfrozen_pose/weights/best.pt, freeze 0 and learning rate 0.00005, with 100 epochs maximum and patience 25. It writes a separate _pose_refined_pose run; the generic CLI fallback yolo11n-pose.pt is not this wrapper’s initialization.
Both wrappers draw each source 12 times per epoch and replace its background with probability 0.85 before downstream training transforms. Only the background canvas may flip; foreground geometry stays fixed in this compositor. Validation keeps original photographs. Runtime combines both best.pt files with the frozen corners and the independently fused reference.
Values below come from the checked-in implementation. Each note identifies its scope; launch arguments can override defaults.
| Setting | Value | Meaning / scope |
|---|---|---|
| Shared wrapper defaults | 100 epochs max; batch 8; imgsz 640; seed 317 | Saved default-session args.yaml agrees; early stopping can end a run before the requested maximum. |
| Segmentation / pose | freeze 11 / 0; lr0 1e−4 / 5e−5 | Current collection wrappers; saved default-session run arguments record the same settings. |
| Background sampling | 12 draws/source; probability 0.85 | Training only. Replacement preserves the current foreground pixels and corresponding labels. |
Current calibration/keypoints differ from the existing frozen geometry; a changed box requires a new session.
Repeated backgrounds increased sample draws without adding independent foreground geometry or acquisition conditions.
scripts/pnp_snapshot.py:12-60scripts/collect_process/05_train_segmentation.sh:4-18scripts/collect_process/06_train_pose.sh:4-19scripts/train_yolo_seg_pose.py:21-84yolo_background_augmentation.py:44-104training/yolo/my_object_20260925_r2_onthefly_seg/args.yaml:1-105training/yolo/my_object_20260925_r2_pose_refined_pose/args.yaml:1-105scripts/collect_process/07_run_live.sh:4-18Make color pixels, depth samples and intrinsics describe the same rectified camera before any learning or geometry uses them.
Live scene and camera calibration
Color, aligned depth and CameraInfo
The Orbbec backend requires the advertised Close Range Default mode before enumerating profiles, then verifies disparity search range 256 and offset zero. Unsupported mode or property readback fails startup. The configured 40 mm depth cutoff is an input policy and supported range setting; it is not a measured accuracy guarantee.
Software depth-to-color alignment targets zero distortion. The SDK retains raw color, so OpenCV rectifies color separately when its coefficients are nonzero. Checks require matching dimensions and intrinsic matrices, zero aligned-depth distortion and identity depth-to-color extrinsics. Merely resizing two images would not establish this correspondence.
SDK depth scale converts raw counts to metric depth; the worker publishes uint16 millimetres with zero for invalid depth. Color is RGB8. Downscaling adjusts focal lengths and the pixel-center convention for principal points as well as image dimensions. The default downscale of one retains the selected profile.
An isolated SDK worker sends complete RGB-D packets to the ROS bridge. A latest-packet slot replaces superseded frames instead of building a backlog. The camera prefers 30 FPS acquisition; the launch default caps publication at 20 Hz and camera_rate can override it. Neither number promises pose throughput.
Device timestamps bound color/depth skew to half a frame period. A host timestamp becomes the common ROS stamp for color, depth and CameraInfo. The bridge drops packets outside its age window and stops a failed or timed-out worker. A common stamp enables downstream exact synchronization; it does not prove simultaneous exposures.
Values below come from the checked-in implementation. Each note identifies its scope; launch arguments can override defaults.
| Setting | Value | Meaning / scope |
|---|---|---|
| Backend / optical frame | orbbec / camera_color_optical_frame | Phase 4 and launch defaults; backend and serial are launch overrides. |
| Depth interval | 0.04–1.5 m | Current phase4.yaml camera preset; downstream cloud applies the same interval. |
| Publication cap | 20 Hz | Launch default camera_rate; acquisition prefers 30 FPS. Historical 30 Hz overrides are not this default. |
| Age / worker timeouts | 0.75 s / 10 s / 30 s | Maximum packet age, streaming timeout and startup timeout respectively. |
Requested close-range mode, property verification or aligned geometry is unavailable.
Missing pairs, excessive device skew, stale packets or worker timeouts prevent publication.
orbbec_camera.py:17–58, 298–381ros2_ws/src/object_pose_tracking/object_pose_tracking/camera_node.py:25–108ros2_ws/src/object_pose_tracking/object_pose_tracking/camera_worker.py:27–35camera.py:125–134ros2_ws/src/object_pose_tracking/config/phase4.yaml:1–16ros2_ws/src/object_pose_tracking/launch/phase4.launch.py:20–27, 46–53Use two task-specific networks, then associate their detections spatially so a mask and ordered corners refer to the selected object.
Color frame and the two trained checkpoints
Selected foreground mask and corners when initialization is needed
The segmentation adapter validates checkpoint task and target class, converts the incoming RGB array to the BGR convention expected by Ultralytics, and requests original-resolution retina masks. Mask probabilities become a binary foreground region. Detection confidence and per-pixel mask threshold are separate decisions.
Without a remembered box, acquire the highest-confidence segmentation detection. Once acquired, select the candidate with maximum box intersection-over-union against the previous box, requiring the association threshold. A miss emits no selected mask; five consecutive misses clear this spatial association. It is not persistent identity across look-alike objects.
The observation node listens to tracking state. With the current pose_only_for_reinitialization preset, it runs the separate pose model only outside TRACKING and only when segmentation selected an instance. During established tracking it still segments but publishes an eight-entry invalid corner placeholder for synchronization.
Pose detections are matched to the selected segmentation box by maximum box IoU, with a minimum of 0.10. The adapter preserves the trained eight-corner order and records u, v, confidence and validity. It marks nonfinite or all-zero coordinates invalid; the later PnP stage additionally applies its own corner-confidence threshold.
Mask and keypoint messages retain the source color stamp. No segmentation produces an all-zero mask; missing pose produces invalid corners. An expired inference result resets association and returns without publishing it. The CUDA collection launcher overrides the YAML CPU device with cuda:0, keeping FP32; this does not move Phase 4 GICP onto CUDA.
Values below come from the checked-in implementation. Each note identifies its scope; launch arguments can override defaults.
| Setting | Value | Meaning / scope |
|---|---|---|
| Detection confidences | segmentation 0.50; pose 0.25 | Current YAML model-detection thresholds; corner confidence is checked later. |
| Association | IoU ≥ 0.10; reset after 5 misses | Temporal selection of segmentation instances. |
| Pose pairing / scheduling | IoU ≥ 0.10; reinitialization only | Current YAML; code can run pose every frame if the scheduling flag is disabled. |
| Inference execution | 640 image size; FP32 | YAML CPU default; 07_run_live.sh selects the CUDA launcher/device preset, cuda:0. |
Pose detections failed pairing or too few corners survive later validity/confidence checks.
Association uses overlapping boxes, not a persistent identity model.
Result age exceeded 0.75 s; the node resets its selector and drops that result.
ros2_ws/src/object_pose_tracking/object_pose_tracking/observation_node.py:37–126ros2_ws/src/object_pose_tracking/object_pose_tracking/segmentation.py:22–72, 107–124, 158–180scripts/run_phase4_cuda.sh:9–12ros2_ws/src/object_pose_tracking/config/devices_cuda.yaml:6–9ros2_ws/src/object_pose_tracking/config/phase4.yaml:17–32Turn only the selected object’s valid depth pixels into a metric cloud, then reduce density and isolated noise before registration.
Synchronized mask, aligned depth and camera intrinsics
Filtered observed object cloud in metres
Mask, aligned depth, CameraInfo and color must share a timestamp under the default zero-slop synchronizer. The node rejects out-of-order or over-age inputs. Matching image sizes, one optical frame, zero distortion and suitable rectification metadata are checked before using the pinhole equations.
Accept pixels where the mask is nonzero, depth is finite and distance lies inclusively within the configured near/far interval. The geometry function converts uint16 millimetres to metres; it also supports externally supplied float32 metre depth. A zero mask therefore produces no points instead of an unmasked scene cloud.
For every retained pixel, divide its principal-point offset by focal length and multiply by measured Z. The result is camera optical XYZ, not the object frame. Color is sampled at those same pixels, maintaining point/color correspondence. A different configured cloud frame requires an actual timestamped TF transform rather than relabeling coordinates.
Assign XYZ to floor-based 3 mm voxel keys. Replace each occupied cell by its mean point and average its RGB values. This reduces redundant samples in dense regions and controls registration cost. The grid belongs to the observed cloud frame; it is not a learned representation or a guarantee of 3 mm accuracy.
Compute each point’s mean distance to up to 20 other neighbors. Retain points below the global mean plus two standard deviations. Fewer than 30 remaining points results in a published empty cloud with insufficient_object_points status. A processing exception also publishes an empty cloud; an expired result is dropped instead.
Values below come from the checked-in implementation. Each note identifies its scope; launch arguments can override defaults.
| Setting | Value | Meaning / scope |
|---|---|---|
| Depth interval | 0.04 ≤ Z ≤ 1.5 m | Current cloud YAML; pure CloudConfig capability defaults to a different 0.15 m minimum when no preset is supplied. |
| Voxel / outlier filter | 3 mm / 20 neighbors / 2 standard deviations | Current observed-cloud preprocessing; GICP later has its own sampling. |
| Minimum cloud | 30 points | After preprocessing; an empty cloud is published below this count. |
| Synchronization / age | queue 20; slop 0; age ≤ 0.75 s | Current YAML selects exact timestamps; code also supports a positive approximate slop. |
No mask, invalid/out-of-range depth or fewer than 30 retained samples.
Mismatched frame, unrectified calibration, incompatible depth encoding or missing required TF.
Input stamps do not match or inputs exceed the freshness window.
ros2_ws/src/object_pose_tracking/object_pose_tracking/cloud_node.py:23–111ros2_ws/src/object_pose_tracking/object_pose_tracking/geometry.py:28–53, 70–102ros2_ws/src/object_pose_tracking/config/phase4.yaml:33–46Choose a learned geometric initializer at startup/recovery, or reuse the previous accepted raw registration pose during established tracking.
Ordered corners + frozen geometry, or accepted raw pose history
Initial T_camera_object for local registration
INITIALIZATION or LOST requires PnP; TRACKING with a stored pose copies that previous accepted raw GICP transform. The smoothed display pose is never the tracking seed. The node first requires a sufficiently populated observed cloud, so PnP is not attempted without usable depth input.
Frozen object_keypoints.yaml supplies ordered metric 3D corners in box_center. The detector supplies corresponding image coordinates. Reject nonfinite, invalid or low-confidence entries and require at least four. Known metric box size resolves monocular scale; permuting corner IDs changes the physical problem even if the image points appear plausible.
EPNP inside RANSAC proposes object-to-camera transforms while rejecting corner outliers. It requires at least four consensus inliers, then uses iterative solvePnP only on those inliers with the consensus as its initial guess. Validate a finite transform with positive object-origin Z and mean inlier reprojection error no greater than five pixels.
Compare the PnP translation vector with the componentwise median XYZ of the observed cloud. The gate uses full Euclidean distance, not just Z, and allows at most 120 mm. This is a bounded consistency heuristic: a visible-surface median is not necessarily the physical center of the object.
Publish accepted raw PnP for diagnostics first. If enabled and the absolute difference between median cloud Z and PnP Z lies inclusively between 20 and 80 mm, replace seed Z with that median. X, Y and rotation stay unchanged. This correction does not modify published raw PnP and happens only after PnP passes its checks.
Values below come from the checked-in implementation. Each note identifies its scope; launch arguments can override defaults.
| Setting | Value | Meaning / scope |
|---|---|---|
| Corner validity | confidence ≥ 0.35; valid count ≥ 4 | Current PnP preset; eight semantic slots remain fixed even when some are excluded. |
| RANSAC | 200 iterations; 5 px; confidence 0.99 | Solver settings, not a guarantee of correct pose or a calibrated probability. |
| Acceptance | ≥4 inliers; mean ≤5 px; depth distance ≤0.12 m | Mean error is evaluated on RANSAC inliers; depth distance is 3D Euclidean. |
| Seed correction | enabled; 20–80 mm inclusive | Current YAML override enables correction; node capability defaults it off without the preset. |
Too few reliable corners, failed consensus, excessive reprojection error or inconsistent depth.
Corner identity errors or ambiguity can survive a small reprojection residual; later geometry gates remain necessary.
ros2_ws/src/object_pose_tracking/object_pose_tracking/pnp.py:139–204ros2_ws/src/object_pose_tracking/object_pose_tracking/pnp.py:103–122ros2_ws/src/object_pose_tracking/object_pose_tracking/pnp_gicp_node.py:198–241ros2_ws/src/object_pose_tracking/config/phase4.yaml:58–73Use local surface registration to refine a good seed, then require multiple independent geometric quality checks before accepting its pose.
Pose seed, fixed box_center reference and observed cloud
A refined pose candidate with quality checks
Generalized Iterative Closest Point models local surface direction through a covariance for each point. For each matched pair, Open3D combines the source and target covariances, weights the position residual and its Jacobian, and solves a small rigid-motion update. This treats mismatch across a surface differently from mismatch along it. The reported acceptance metrics below are separate from that covariance-weighted optimization.
Open3D 0.19 GICP implementation ↗The immutable reference is the source in box_center; the observed cloud is the target in camera coordinates. Open3D receives the absolute initializer and returns the same object-to-camera transform convention. Reject invalid rigid seeds and insufficient or degenerate observed geometry before fitting.
Transform reference points by the seed and retain positive-depth points inside the camera field of view. When stored normals exist and normal-facing is enabled, retain normals facing the camera. This removes clearly irrelevant back-facing geometry, but does not solve self-occlusion with a depth buffer.
The implementation supports coarse, medium and fine levels, each with independent sampling, correspondence distance and iteration budget. Current YAML disables coarse and medium and enables fine only: 2 mm voxels, 8 mm correspondence distance and one iteration. This is conservative local refinement; the code’s converged flag means enabled levels returned valid results, not proof of full optimizer convergence.
Require at least 30 correspondences, source fitness at least 0.20, inlier RMSE no more than 12 mm and overlap at least 0.10. Fitness is matched-source fraction; overlap counts unique matched observed target indices divided by target count. Many reference points landing on one small target patch cannot inflate the unique-target coverage metric.
After PnP initialization only, project the GICP result and require mean disagreement with PnP’s original inlier detections no greater than 10 px. During tracking, compare the candidate with the stored raw pose and reject translation over 120 mm or rotation over 0.8 rad. The Phase 4 GICP backend is Open3D CPU; the CUDA launch accelerates YOLO, not this solver.
Values below come from the checked-in implementation. Each note identifies its scope; launch arguments can override defaults.
| Setting | Value | Meaning / scope |
|---|---|---|
| Current enabled level | fine only: 2 mm / 8 mm / 1 iteration | Voxel size / maximum correspondence distance / iteration budget. Coarse and medium are disabled despite stale nearby comments. |
| Geometry acceptance | ≥30 pairs; fitness ≥0.20; RMSE ≤12 mm; overlap ≥0.10 | Current YAML; overlap differs from the pure GICPConfig default of 0.15. |
| Visibility | positive depth + FOV + facing normals | Current enabled heuristic; normal test applies only when reference normals are present. |
| Additional guards | PnP agreement ≤10 px; motion ≤120 mm and ≤0.8 rad | PnP agreement runs only on initialization; motion runs when prior raw pose exists. |
Partial visibility, poor mask/depth or a seed outside the local capture basin leaves too little consistent geometry.
It contradicts PnP inlier projections on initialization or exceeds temporal motion limits.
ros2_ws/src/object_pose_tracking/object_pose_tracking/gicp.py:79–102, 132–204ros2_ws/src/object_pose_tracking/object_pose_tracking/pnp_gicp_node.py:240–272ros2_ws/src/object_pose_tracking/config/phase4.yaml:75–108ros2_ws/src/object_pose_tracking/object_pose_tracking/registration.py:60–62Commit validated raw poses to tracking state, smooth only accepted results, and publish an overlay that reflects acceptance for the current observation.
Validated GICP candidate and tracking state
Filtered object pose, box_center TF and camera box overlay
The node checks freshness again after PnP and GICP. A valid final candidate passes geometric, initialization-consistency and temporal-motion gates before state.accept stores the raw transform, clears failures and enters TRACKING. The filter then receives that accepted raw candidate. Rejected fits never replace the seed or contaminate smoothing.
The first accepted pose after a reset initializes the filter unchanged. Later translations use an exponential weighted average with alpha 0.45. Rotations use spherical interpolation between prior filtered orientation and new accepted orientation at fraction 0.45; averaging rotation-matrix elements would generally destroy rigid rotation geometry.
A reject call increments the state failure counter. One failure preserves the prior raw seed while TRACKING; the second consecutive failure sets LOST and clears it. The node resets the filter whenever state needs PnP. The observation node learns that state through ROS and resumes corner inference for recovery.
Stale or out-of-order inputs, expired PnP results and expired GICP results return without calling reject. They therefore do not increment failures or reset tracking. There is no pose-node watchdog that automatically changes TRACKING to LOST solely because synchronized observations stop arriving. Consumers must check timestamps rather than infer freshness from state alone.
Accepted results publish raw GICP, filtered pose, compatibility /object/pose and the box_center TF. Optional debug TF and reference clouds aid inspection. The box overlay projects filtered corners only when their camera depths are positive; rejection publishes a current image without an accepted box. Base-frame pose is conditional on an available timestamped base-to-camera TF and does not block camera-frame acceptance.
Values below come from the checked-in implementation. Each note identifies its scope; launch arguments can override defaults.
| Setting | Value | Meaning / scope |
|---|---|---|
| Loss threshold | 2 consecutive reject calls | Acceptance clears the counter; stale/expired early returns do not count as rejects. |
| Filter alpha | translation 0.45; rotation 0.45 | Per accepted update; first accepted pose after reset passes through unchanged. |
| Frames / debug | box_center; base_link; debug TF enabled | Camera-frame output is primary; base output requires a valid external TF. |
| Freshness | maximum_data_age 0.75 s | Checked on inputs and completed computation; not a state-loss timeout. |
Silence or stale/expired inputs do not invoke reject or a loss watchdog in this node.
The base-to-camera transform is unavailable for that observation timestamp.
The configured counter reaches LOST, clears the raw seed and resets the filter.
ros2_ws/src/object_pose_tracking/object_pose_tracking/pose_filter.py:8–65ros2_ws/src/object_pose_tracking/object_pose_tracking/pnp_gicp_node.py:187–280ros2_ws/src/object_pose_tracking/object_pose_tracking/pnp_gicp_node.py:157–185ros2_ws/src/object_pose_tracking/object_pose_tracking/pnp_gicp_node.py:98–110training/yolo/SESSION_onthefly_seg/weights/best.pt selects the foreground object.
training/yolo/SESSION_pose_refined_pose/weights/best.pt provides ordered image corners for startup and recovery.
datasets/SESSION/references/CATEGORY/reference.ply is fused in box_center. The launcher prefers reference_aligned.ply when present.
datasets/SESSION/training_pnp/ stores calibration.json, object_keypoints.yaml and a hash manifest; the launcher verifies this snapshot and the reference frame.
Read the collection workflow, Phase 4 guide and runtime configuration.