Arm2 Arucos anzeigen, MatrixArbeit

This commit is contained in:
chk
2026-05-28 12:51:55 +02:00
parent c535458b2f
commit 1bd0d35567
12 changed files with 29 additions and 2584 deletions

View File

@@ -12,8 +12,6 @@ from mathutils import Matrix
ROBOT_JSON_FILE = r"C:\Users\kech\SynologyDrive\2026-AppServer-AppRobot\appRobotRendering\robot.json"
OUTPUT_FILE = r"C:\Users\kech\SynologyDrive\2026-AppServer-AppRobot\appRobotRendering\render.png"
RENDER_WIDTH = 1280
RENDER_HEIGHT = 720
# ============================================================
# DEFAULT MATERIALS
@@ -628,17 +626,17 @@ for link_name, link_info in links_def.items():
)
# Marker-Normale im Welt-/Linkraum
normal_world = (
marker_obj.matrix_world.to_quaternion()
# Marker-Normale im lokalen Link-Raum (aus Marker-Rotation)
normal_local = (
marker_obj.rotation_quaternion
@ mathutils.Vector((0, 0, 1))
)
normal_world.normalize()
normal_local.normalize()
# minimal vorziehen gegen Z-Fighting
# minimal vorziehen gegen Z-Fighting (lokaler Versatz)
marker_obj.location = (
mathutils.Vector(marker_pos)
+ normal_world * mm_to_m(0.5)
+ normal_local * mm_to_m(0.5)
)
marker_mat = create_aruco_material(
@@ -675,16 +673,14 @@ for link_name, link_info in links_def.items():
plate_obj.rotation_mode = "QUATERNION"
plate_obj.rotation_quaternion = marker_obj.rotation_quaternion.copy()
# Normale des Markers im Welt-/Linkraum
normal_world = marker_obj.matrix_world.to_quaternion() @ mathutils.Vector((0, 0, 1))
normal_world.normalize()
# Normale des Markers im lokalen Link-Raum (aus Marker-Rotation)
normal_local = marker_obj.rotation_quaternion @ mathutils.Vector((0, 0, 1))
normal_local.normalize()
# Platte liegt "hinter" dem Marker
# Platte liegt "hinter" dem Marker (lokaler Versatz)
plate_obj.location = (
marker_obj.location
- normal_world * mm_to_m((plate_thickness_mm * 0.5) + gap_mm)
- normal_local * mm_to_m((plate_thickness_mm * 0.5) + gap_mm)
)
# exakte Abmessungen: 26 x 26 x 1 mm