board rotation - fix 0

This commit is contained in:
chk
2026-06-10 18:08:18 +02:00
parent 9105dc5eac
commit b1950ffa5a
5 changed files with 104 additions and 25 deletions

View File

@@ -212,13 +212,15 @@ def get_marker_rotation(marker: Dict[str, Any]) -> np.ndarray:
return np.eye(3, dtype=np.float32)
def load_marker_lookup(robot_json_path: str) -> Dict[int, Dict[str, Any]]:
def load_marker_lookup(robot_json_path: str, ref_set: Optional[str] = None) -> Dict[int, Dict[str, Any]]:
"""
Supports the new format:
robot_data["links"]["Board"]["markers"]
Fallback:
robot_data["Marker"]
ref_set: wenn angegeben, werden nur Marker mit passendem "set"-Feld als Referenz verwendet.
"""
robot_json_path = resolve_path(robot_json_path)
with open(robot_json_path, "r", encoding="utf-8") as f:
@@ -248,6 +250,10 @@ def load_marker_lookup(robot_json_path: str) -> Dict[int, Dict[str, Any]]:
if marker_id < 0:
continue
# Referenz-Set-Filter: nur Marker mit passendem set-Wert verwenden
if ref_set and str(marker.get("set", "")) != ref_set:
continue
if "position" not in marker:
continue
@@ -583,13 +589,18 @@ def main() -> None:
parser.add_argument("--maxRmsPx", type=float, default=None,
help="Optional soft warning threshold for final reprojection RMS in pixels")
parser.add_argument("--epsJac", type=float, default=1e-6, help="Finite-difference epsilon")
parser.add_argument("--refSet", default=None,
help="Nur Marker dieses Sets als Referenz verwenden (z.B. 'A0', 'rail'). "
"Leer = alle Marker aus links.Board.")
args = parser.parse_args()
detection_path = resolve_path(args.input)
robot_path = resolve_path(args.robot)
detection = load_json(detection_path)
marker_lookup = load_marker_lookup(robot_path)
marker_lookup = load_marker_lookup(robot_path, ref_set=args.refSet)
if args.refSet:
print(f"[INFO] Referenz-Set: '{args.refSet}'{len(marker_lookup)} Referenz-Marker")
K, D = load_intrinsics_from_detection(detection)