GPT: Constraints

This commit is contained in:
chk
2026-05-29 17:20:01 +02:00
parent 1008c9f7fd
commit dd95d56790
15 changed files with 2321 additions and 145 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,121 +1,122 @@
{
"schema_version": "1.0",
"created_utc": "2026-05-29T07:55:17Z",
"schema_version": "1.1",
"stage": "initial_triangulation",
"created_utc": "2026-05-29T11:11:53Z",
"summary": {
"stage": "initial_triangulation",
"num_cameras": 3,
"num_markers": 8
"num_markers": 8,
"num_constraints": 31
},
"markers": [
{
"marker_id": 122,
"position_m": [
0.18520598113536835,
-0.21684008836746216,
0.13996362686157227
0.14895405123790784,
-0.2643844341363741,
0.16564713440852427
],
"position_mm": [
185.2059783935547,
-216.840087890625,
139.963623046875
148.95405123790783,
-264.38443413637407,
165.64713440852427
],
"link": "Arm2"
},
{
"marker_id": 198,
"position_m": [
0.12119491398334503,
-0.046654392033815384,
0.13240119814872742
0.11667067734641628,
-0.05481782829770797,
0.13564627196635054
],
"position_mm": [
121.19491577148438,
-46.65439224243164,
132.4011993408203
116.67067734641628,
-54.81782829770797,
135.64627196635055
],
"link": "Arm1"
},
{
"marker_id": 210,
"position_m": [
0.020141778513789177,
-0.01963355578482151,
7.823568921594415e-06
0.020141782836696105,
-0.019633567005699154,
7.847443788934222e-06
],
"position_mm": [
20.14177894592285,
-19.633556365966797,
0.007823568768799305
20.141782836696105,
-19.633567005699152,
0.007847443788934223
],
"link": "Board"
},
{
"marker_id": 211,
"position_m": [
0.24960945546627045,
-0.009326362982392311,
-0.0005378762143664062
0.2496094175197415,
-0.009326316290609264,
-0.0005379225707190097
],
"position_mm": [
249.6094512939453,
-9.326362609863281,
-0.5378761887550354
249.6094175197415,
-9.326316290609263,
-0.5379225707190097
],
"link": "Board"
},
{
"marker_id": 214,
"position_m": [
0.3498840034008026,
-0.009714338928461075,
-2.6824214728549123e-05
0.3498840022857963,
-0.009714324911855806,
-2.6845703214407957e-05
],
"position_mm": [
349.8840026855469,
-9.714339256286621,
-0.026824215427041054
349.8840022857963,
-9.714324911855806,
-0.026845703214407955
],
"link": "Board"
},
{
"marker_id": 215,
"position_m": [
0.2497633397579193,
-0.0896778479218483,
-0.00011857203207910061
0.24976330898445626,
-0.08967780487999989,
-0.00011862459122980862
],
"position_mm": [
249.76333618164062,
-89.67784881591797,
-0.11857203394174576
249.76330898445624,
-89.6778048799999,
-0.11862459122980862
],
"link": "Board"
},
{
"marker_id": 229,
"position_m": [
0.12001997977495193,
-0.13270698487758636,
0.14000186324119568
0.11592480843458029,
-0.1392249195451953,
0.14252312456392438
],
"position_mm": [
120.01998138427734,
-132.7069854736328,
140.00186157226562
115.9248084345803,
-139.22491954519532,
142.52312456392437
],
"link": "Arm1"
},
{
"marker_id": 243,
"position_m": [
0.11871032416820526,
-0.17057909071445465,
0.09964759647846222
0.11871032400722982,
-0.17057910506578056,
0.0996476225849942
],
"position_mm": [
118.7103271484375,
-170.57908630371094,
99.64759826660156
118.71032400722981,
-170.57910506578057,
99.6476225849942
],
"link": "Arm1"
}

View File

@@ -1,121 +1,121 @@
{
"schema_version": "1.0",
"created_utc": "2026-05-29T07:55:18Z",
"schema_version": "1.1",
"created_utc": "2026-05-29T11:11:54Z",
"summary": {
"num_cameras": 3,
"num_markers": 8,
"num_constraints": 124
"num_constraints": 31
},
"markers": [
{
"marker_id": 122,
"position_m": [
0.17089422820752076,
-0.25275415714542,
0.1764152549525782
0.17089422820567965,
-0.25275415672150703,
0.17641525453920115
],
"position_mm": [
170.89422820752077,
-252.75415714541998,
176.4152549525782
170.89422820567964,
-252.75415672150703,
176.41525453920116
],
"link": "Arm2"
},
{
"marker_id": 198,
"position_m": [
0.11820089367579532,
-0.047715698531904785,
0.13484286564203027
0.0782893264155328,
-0.04392881888831051,
0.12370444588754521
],
"position_mm": [
118.20089367579533,
-47.715698531904785,
134.84286564203026
78.2893264155328,
-43.92881888831051,
123.70444588754522
],
"link": "Arm1"
},
{
"marker_id": 210,
"position_m": [
0.019901746801827637,
-0.019634665689316648,
9.617254460632054e-06
0.09810874978803365,
0.04840357531258377,
-0.061619957949719154
],
"position_mm": [
19.901746801827638,
-19.63466568931665,
0.009617254460632054
98.10874978803365,
48.40357531258377,
-61.61995794971915
],
"link": "Board"
},
{
"marker_id": 211,
"position_m": [
0.2499096083030422,
-0.00981801346837422,
7.989879950350478e-05
0.26424764035228315,
-0.0563864907759364,
0.05844872874629282
],
"position_mm": [
249.9096083030422,
-9.81801346837422,
0.07989879950350479
264.24764035228316,
-56.3864907759364,
58.448728746292815
],
"link": "Board"
},
{
"marker_id": 214,
"position_m": [
0.3499095633806716,
-0.009897723015074432,
0.00018350870717776096
0.34990989719464827,
-0.024224263154301,
0.01810457272024633
],
"position_mm": [
349.90956338067156,
-9.897723015074432,
0.18350870717776097
349.9098971946483,
-24.224263154301,
18.10457272024633
],
"link": "Board"
},
{
"marker_id": 215,
"position_m": [
0.24984585113464844,
-0.08981799168050893,
8.39071085193236e-05
0.24658646632630482,
-0.07931906684450687,
-0.016131019201613698
],
"position_mm": [
249.84585113464843,
-89.81799168050892,
0.08390710851932359
246.58646632630482,
-79.31906684450688,
-16.131019201613697
],
"link": "Board"
},
{
"marker_id": 229,
"position_m": [
0.11749065839484758,
-0.137499932562534,
0.14103531580163794
0.1138713279648291,
-0.12617149104964914,
0.1320972625673932
],
"position_mm": [
117.49065839484759,
-137.499932562534,
141.03531580163795
113.8713279648291,
-126.17149104964915,
132.09726256739322
],
"link": "Arm1"
},
{
"marker_id": 243,
"position_m": [
0.11810035461635551,
-0.17482765346898027,
0.10853212349724542
0.1181663829394805,
-0.16401370137352922,
0.1004795056960036
],
"position_mm": [
118.10035461635552,
-174.82765346898026,
108.53212349724542
118.1663829394805,
-164.01370137352922,
100.4795056960036
],
"link": "Arm1"
}

View File

@@ -0,0 +1,105 @@
#!/usr/bin/env python3
"""
check_robot_marker_uniqueness.py
Standalone checker for duplicate / invalid marker IDs in robot.json.
Use this before running bundle adjustment:
python check_robot_marker_uniqueness.py -robot robot.json
Exit codes:
0 = no duplicates found
1 = duplicates or structural problems found
"""
from __future__ import annotations
import argparse
import json
import os
import sys
from collections import defaultdict
from typing import Any, Dict, List, Tuple
def resolve_path(path: str) -> str:
path = os.path.expanduser(path)
if os.path.isabs(path):
return path
return os.path.abspath(path)
def load_json(path: str) -> Dict[str, Any]:
with open(resolve_path(path), "r", encoding="utf-8") as f:
return json.load(f)
def main() -> None:
parser = argparse.ArgumentParser(description="Check marker ID uniqueness in robot.json")
parser.add_argument("-robot", "--robot", required=True, help="Path to robot.json")
parser.add_argument(
"--strict",
action="store_true",
help="Return exit code 1 if any duplicate or invalid marker is found",
)
args = parser.parse_args()
robot = load_json(args.robot)
links = robot.get("links", {}) or {}
id_locations: Dict[int, List[Tuple[str, int, str]]] = defaultdict(list)
invalid_entries: List[str] = []
total_markers = 0
for link_name, link_data in links.items():
markers = link_data.get("markers", []) or []
for idx, marker in enumerate(markers):
total_markers += 1
marker_id = marker.get("id", None)
if marker_id is None:
invalid_entries.append(f"link='{link_name}' marker_index={idx}: missing id")
continue
try:
marker_id_int = int(marker_id)
except Exception:
invalid_entries.append(f"link='{link_name}' marker_index={idx}: non-integer id={marker_id!r}")
continue
name = str(marker.get("name", f"marker_{marker_id_int}"))
id_locations[marker_id_int].append((link_name, idx, name))
pos = marker.get("position", None)
if pos is None or not isinstance(pos, list) or len(pos) != 3:
invalid_entries.append(
f"link='{link_name}' marker_id={marker_id_int}: invalid/missing 3D position"
)
duplicates = {mid: locs for mid, locs in id_locations.items() if len(locs) > 1}
print(f"[INFO] Total marker entries: {total_markers}")
print(f"[INFO] Unique marker IDs : {len(id_locations)}")
print(f"[INFO] Duplicate IDs : {len(duplicates)}")
print(f"[INFO] Invalid entries : {len(invalid_entries)}")
if duplicates:
print("\n[DUPLICATES]")
for mid in sorted(duplicates.keys()):
print(f" marker_id={mid}")
for link_name, idx, name in duplicates[mid]:
print(f" - link='{link_name}' marker_index={idx} name='{name}'")
if invalid_entries:
print("\n[INVALID ENTRIES]")
for item in invalid_entries:
print(f" - {item}")
if duplicates or invalid_entries:
print("\n[WARN] robot.json is not clean for deterministic constraint generation.")
if args.strict:
sys.exit(1)
else:
print("\n[OK] No duplicate marker IDs found.")
if __name__ == "__main__":
main()

View File

@@ -1,6 +1,6 @@
{
"schema_version": "1.0",
"created_utc": "2026-05-29T07:55:16Z",
"created_utc": "2026-05-29T11:11:52Z",
"vision_config": {
"MarkerType": "DICT_4X4_250",
"MarkerSize": 0.025
@@ -46,7 +46,7 @@
},
"detections": [
{
"observation_id": "2ee8a896-adc4-44a7-8e21-00bf2d2bdb29",
"observation_id": "3fe0abea-8ee3-488d-afdd-ca173488bac8",
"type": "aruco",
"marker_id": 124,
"marker_size_m": 0.025,
@@ -100,7 +100,7 @@
"confidence": 0.6862086405991146
},
{
"observation_id": "122847ec-48d6-477c-a833-61a1cbb5620b",
"observation_id": "4ad28655-628f-4970-aee7-ac0464a422dd",
"type": "aruco",
"marker_id": 243,
"marker_size_m": 0.025,
@@ -154,7 +154,7 @@
"confidence": 0.953171926139578
},
{
"observation_id": "4efd7b96-c897-44c5-9f63-6dfccdb0dcf0",
"observation_id": "39c9ae85-1343-4abd-a776-aead564c7ba2",
"type": "aruco",
"marker_id": 122,
"marker_size_m": 0.025,
@@ -208,7 +208,7 @@
"confidence": 0.5964639370258038
},
{
"observation_id": "c7a43ad5-e272-4673-af80-a17d11161ae4",
"observation_id": "2d4f27e1-f896-4714-bea0-d66f354f65bc",
"type": "aruco",
"marker_id": 102,
"marker_size_m": 0.025,
@@ -262,7 +262,7 @@
"confidence": 0.3578323322772018
},
{
"observation_id": "7d8958be-4ff2-4929-a78a-0e3239574df7",
"observation_id": "2b4ed846-8c7c-40a4-9d78-6dde96b7fb77",
"type": "aruco",
"marker_id": 229,
"marker_size_m": 0.025,
@@ -316,7 +316,7 @@
"confidence": 0.4396423002158715
},
{
"observation_id": "dea83763-ba79-4211-ace5-2fb4693ec614",
"observation_id": "5ce4384f-4a4e-4dfb-9e84-cfb04b1ee009",
"type": "aruco",
"marker_id": 210,
"marker_size_m": 0.025,
@@ -370,7 +370,7 @@
"confidence": 0.23718801109435655
},
{
"observation_id": "04e86e9d-49e6-4cc3-b104-8cc4bddae5e1",
"observation_id": "b0f54f4e-c981-4c68-91f4-71796b2e1b7e",
"type": "aruco",
"marker_id": 198,
"marker_size_m": 0.025,
@@ -424,7 +424,7 @@
"confidence": 0.27797680859006363
},
{
"observation_id": "d844a883-c800-4e9c-8f99-fdb379cf9d6a",
"observation_id": "2291dd23-8cfd-4fc8-8268-3f51a4f477e3",
"type": "aruco",
"marker_id": 205,
"marker_size_m": 0.025,
@@ -478,7 +478,7 @@
"confidence": 0.19676029488014599
},
{
"observation_id": "e1194640-f6cb-4af1-8fe3-41d19817b79e",
"observation_id": "1aa4305f-42cd-4a6b-bbd9-3c4779159e9f",
"type": "aruco",
"marker_id": 206,
"marker_size_m": 0.025,
@@ -532,7 +532,7 @@
"confidence": 0.23511362818048806
},
{
"observation_id": "1aa5ff5a-71ef-4362-aeb0-2f000b6c7f37",
"observation_id": "67d472aa-5a55-495c-84f3-9f9867b5e6bb",
"type": "aruco",
"marker_id": 207,
"marker_size_m": 0.025,

View File

@@ -1,6 +1,6 @@
{
"schema_version": "1.0",
"created_utc": "2026-05-29T07:55:17Z",
"created_utc": "2026-05-29T11:11:53Z",
"source": {
"detection_json": "C:\\Users\\kech\\SynologyDrive\\2026-AppServer-AppRobot\\appRobotRendering\\pipeline\\render_3a_aruco_detection.json",
"robot_json": "C:\\Users\\kech\\SynologyDrive\\2026-AppServer-AppRobot\\appRobotRendering\\robot.json"

View File

@@ -1,6 +1,6 @@
{
"schema_version": "1.0",
"created_utc": "2026-05-29T07:55:16Z",
"created_utc": "2026-05-29T11:11:51Z",
"vision_config": {
"MarkerType": "DICT_4X4_250",
"MarkerSize": 0.025
@@ -46,7 +46,7 @@
},
"detections": [
{
"observation_id": "37e350d1-d7f5-4006-9e7c-eabb597891bb",
"observation_id": "d0acb2d6-f00e-4abb-9182-0aba44eb37b5",
"type": "aruco",
"marker_id": 243,
"marker_size_m": 0.025,
@@ -100,7 +100,7 @@
"confidence": 0.8522257252911212
},
{
"observation_id": "fb1bfc74-794b-4065-b35e-f49b5e413a94",
"observation_id": "912b4c1f-fa4d-488b-ae55-6c159b08259f",
"type": "aruco",
"marker_id": 122,
"marker_size_m": 0.025,
@@ -154,7 +154,7 @@
"confidence": 0.2874514216623714
},
{
"observation_id": "6766568d-a40c-4c97-87fd-77e5243838fb",
"observation_id": "d713f49f-d43d-4181-b2c3-802fae7ac4c6",
"type": "aruco",
"marker_id": 229,
"marker_size_m": 0.025,
@@ -208,7 +208,7 @@
"confidence": 0.5547001883002887
},
{
"observation_id": "958853a3-10c7-486a-8985-8fa8eab7fb7a",
"observation_id": "b540ca35-2454-4485-b5c9-0edcffa7d655",
"type": "aruco",
"marker_id": 208,
"marker_size_m": 0.025,
@@ -262,7 +262,7 @@
"confidence": 0.6072727689079809
},
{
"observation_id": "0ba8ce36-cbf9-42b2-8829-3c1b5adcf247",
"observation_id": "fd9ca8aa-3703-4a75-99dd-61e9d6da7096",
"type": "aruco",
"marker_id": 215,
"marker_size_m": 0.025,
@@ -316,7 +316,7 @@
"confidence": 0.6168610191628993
},
{
"observation_id": "3e48e695-6ede-4e3d-932c-161c06a03ac7",
"observation_id": "b9dfaf55-fe73-4bac-a011-9ff31f13c491",
"type": "aruco",
"marker_id": 214,
"marker_size_m": 0.025,
@@ -370,7 +370,7 @@
"confidence": 0.5524643209674667
},
{
"observation_id": "386a4b8c-7efc-4cad-a7e0-c02ce8d15271",
"observation_id": "5e971f45-cf73-466b-ade5-bd09a71a0f8e",
"type": "aruco",
"marker_id": 211,
"marker_size_m": 0.025,
@@ -424,7 +424,7 @@
"confidence": 0.5730650050844824
},
{
"observation_id": "cb63df83-5a11-4455-89ae-c741e2c649dd",
"observation_id": "48a160b7-02c3-47de-8eba-01d6c15d5d42",
"type": "aruco",
"marker_id": 198,
"marker_size_m": 0.025,
@@ -478,7 +478,7 @@
"confidence": 0.4163346774695628
},
{
"observation_id": "36b8474a-1769-40d3-86ad-98031727ad2e",
"observation_id": "3280ec54-b129-45ec-bffb-7eb3c61d3bdd",
"type": "aruco",
"marker_id": 210,
"marker_size_m": 0.025,

View File

@@ -1,6 +1,6 @@
{
"schema_version": "1.0",
"created_utc": "2026-05-29T07:55:17Z",
"created_utc": "2026-05-29T11:11:52Z",
"source": {
"detection_json": "C:\\Users\\kech\\SynologyDrive\\2026-AppServer-AppRobot\\appRobotRendering\\pipeline\\render_3b_aruco_detection.json",
"robot_json": "C:\\Users\\kech\\SynologyDrive\\2026-AppServer-AppRobot\\appRobotRendering\\robot.json"

View File

@@ -1,6 +1,6 @@
{
"schema_version": "1.0",
"created_utc": "2026-05-29T07:55:15Z",
"created_utc": "2026-05-29T11:11:51Z",
"vision_config": {
"MarkerType": "DICT_4X4_250",
"MarkerSize": 0.025
@@ -46,7 +46,7 @@
},
"detections": [
{
"observation_id": "d51ce37d-1f1f-40ad-a6a2-a6c8f49b43ff",
"observation_id": "342af2b4-08bf-4f4c-9d28-1285278e24c1",
"type": "aruco",
"marker_id": 219,
"marker_size_m": 0.025,
@@ -100,7 +100,7 @@
"confidence": 0.7735450417034769
},
{
"observation_id": "1806bda1-4af5-4faa-b0a3-0091bd35eabc",
"observation_id": "d02166a7-4c7b-4cd0-8210-124de5d533d7",
"type": "aruco",
"marker_id": 218,
"marker_size_m": 0.025,
@@ -154,7 +154,7 @@
"confidence": 0.7950075578135153
},
{
"observation_id": "82259a28-11c6-4355-967d-d2c525cba254",
"observation_id": "e51ac6d6-f1ea-42af-b51d-903b881ddf01",
"type": "aruco",
"marker_id": 122,
"marker_size_m": 0.025,
@@ -208,7 +208,7 @@
"confidence": 0.8202207056111124
},
{
"observation_id": "97b9df19-3ff6-4315-8c74-470848b59a8e",
"observation_id": "805ea7a3-250b-4fb6-afd6-4641c83240d6",
"type": "aruco",
"marker_id": 214,
"marker_size_m": 0.025,
@@ -262,7 +262,7 @@
"confidence": 0.1700115058329765
},
{
"observation_id": "6e25efa5-9cfb-4415-8be0-1c253eb68b9c",
"observation_id": "ccb99515-0a32-410b-b271-75f6e0e0c1c8",
"type": "aruco",
"marker_id": 215,
"marker_size_m": 0.025,
@@ -316,7 +316,7 @@
"confidence": 0.9372326698512834
},
{
"observation_id": "8411563f-277d-44a1-b331-70ea22f8f316",
"observation_id": "f689811a-b001-4d21-87a2-e01ad38c1a01",
"type": "aruco",
"marker_id": 244,
"marker_size_m": 0.025,
@@ -370,7 +370,7 @@
"confidence": 0.7137086345973509
},
{
"observation_id": "20756782-3ad5-4dc0-9e2b-eea48226a4e7",
"observation_id": "cc2ffd45-0d44-4dad-83b2-46e2dec24bc0",
"type": "aruco",
"marker_id": 229,
"marker_size_m": 0.025,
@@ -424,7 +424,7 @@
"confidence": 0.8888336147757544
},
{
"observation_id": "022ae18d-f34f-420e-8117-ec22aa3f52e4",
"observation_id": "f5127d88-2b68-4a22-b216-fdf19b4d72a2",
"type": "aruco",
"marker_id": 211,
"marker_size_m": 0.025,
@@ -478,7 +478,7 @@
"confidence": 0.8902520865668376
},
{
"observation_id": "22a306fc-a02a-46c3-b9e1-d240ddb40ee6",
"observation_id": "e418b70b-2b7e-4381-b86d-b7dc425de6f0",
"type": "aruco",
"marker_id": 246,
"marker_size_m": 0.025,
@@ -532,7 +532,7 @@
"confidence": 0.7343609168978227
},
{
"observation_id": "76dba603-04ec-4e63-bc5e-8ea448020025",
"observation_id": "d8ade844-05ae-46f2-b1c1-ab84179b062f",
"type": "aruco",
"marker_id": 247,
"marker_size_m": 0.025,
@@ -586,7 +586,7 @@
"confidence": 0.72560382306579
},
{
"observation_id": "173b2222-1e89-405e-8e94-0c43f4773db1",
"observation_id": "4386d50e-2ec2-4cbb-974a-d147e3498171",
"type": "aruco",
"marker_id": 198,
"marker_size_m": 0.025,

View File

@@ -1,6 +1,6 @@
{
"schema_version": "1.0",
"created_utc": "2026-05-29T07:55:16Z",
"created_utc": "2026-05-29T11:11:52Z",
"source": {
"detection_json": "C:\\Users\\kech\\SynologyDrive\\2026-AppServer-AppRobot\\appRobotRendering\\pipeline\\render_3c_aruco_detection.json",
"robot_json": "C:\\Users\\kech\\SynologyDrive\\2026-AppServer-AppRobot\\appRobotRendering\\robot.json"

View File

@@ -38,7 +38,7 @@ python 2_estimate_camera_from_observations.py -i render_3a_aruco_detection.json
echo.
echo [STEP 3] Triangulate marker positions from multi-view observations
python 3_multiview_bundle_adjustment.py ^
python 3_multiview_bundle_adjustment_v2.py ^
-det render_3a_aruco_detection.json ^
-det render_3b_aruco_detection.json ^
-det render_3c_aruco_detection.json ^