diff --git a/public/calculateActions.js b/public/calculateActions.js index 8fe4f6f..79c1e69 100755 --- a/public/calculateActions.js +++ b/public/calculateActions.js @@ -468,7 +468,7 @@ async function calculate() { angleZCandidates.push({ source: "row218-row219.relative", valueRad: lowerArmAngle, - weight: 1 + weight: 200 // Hohes gewicht, da ich sicher bin, dass es korrekt ist }); } diff --git a/test/calculateAction.02_FetchDifferentCSV.test.js b/test/calculateAction.02_FetchDifferentCSV.test.js index 506a482..212662c 100755 --- a/test/calculateAction.02_FetchDifferentCSV.test.js +++ b/test/calculateAction.02_FetchDifferentCSV.test.js @@ -42,13 +42,12 @@ describe("calculate() Snapshot Tests", () => { snapshotFile = "snapshot_video0_1774805028717_two_cam.csv"; - await calculate(); + var result = await calculate(); expect(global.fetch).toHaveBeenCalledWith("/api/latest-snapshot"); - const logValue = document.getElementById("analysis-log").value; - expect(logValue).toMatch(/Starte Berechnung/); - expect(logValue).toMatch(/CSV-Daten geladen/); + // Problem: (zMotor = -137.28° = -2.3960 rad) aus roll_deg von ID = 226 + //console.log("Berechnungsergebnis:", result.features["forearm.angleZ"].valueDeg); }); @@ -60,10 +59,40 @@ describe("calculate() Snapshot Tests", () => { expect(global.fetch).toHaveBeenCalledWith("/api/latest-snapshot"); - const logValue = document.getElementById("analysis-log").value; - console.log("Log Value:", logValue); + //const logValue = document.getElementById("analysis-log").value; + //console.log("Log Value:", logValue); //expect(logValue).toMatch(/Starte Berechnung/); //expect(logValue).toMatch(/CSV-Daten geladen/); }); + + + test("Snapshot 1775053356508 wird korrekt geladen. Hatte in der Vergangenheit Fehler", async () => { + + snapshotFile = "snapshot_video0_1775053356508_two_cam.csv"; + + await calculate(); + + expect(global.fetch).toHaveBeenCalledWith("/api/latest-snapshot"); + + //expect(logValue).toMatch(/Starte Berechnung/); + //expect(logValue).toMatch(/CSV-Daten geladen/); + }); + + test("Snapshot video0_1775055007798 wird korrekt geladen. Hatte in der Vergangenheit Fehler", async () => { + + snapshotFile = "snapshot_video0_1775055007798_two_cam.csv"; + + var result =await calculate(); + + expect(global.fetch).toHaveBeenCalledWith("/api/latest-snapshot"); + + var valueDeg = result.features["forearm.angleZ"].valueDeg + + expect(valueDeg).toBeCloseTo(0, 10); // Erwartet ca. -137.28° mit 1 Dezimalstelle Genauigkeit + //expect(logValue).toMatch(/Starte Berechnung/); + //expect(logValue).toMatch(/CSV-Daten geladen/); + }); + + }); \ No newline at end of file diff --git a/test/snapshots/snapshot_video0_1775053356508.jpg b/test/snapshots/snapshot_video0_1775053356508.jpg new file mode 100644 index 0000000..e91b9f0 Binary files /dev/null and b/test/snapshots/snapshot_video0_1775053356508.jpg differ diff --git a/test/snapshots/snapshot_video0_1775053356508_two_cam.csv b/test/snapshots/snapshot_video0_1775053356508_two_cam.csv new file mode 100644 index 0000000..25c77ff --- /dev/null +++ b/test/snapshots/snapshot_video0_1775053356508_two_cam.csv @@ -0,0 +1,22 @@ +id,x_mm,y_mm,z_mm,roll_deg,pitch_deg,yaw_deg,seen_by +camera 0,-180.29,-582.70,606.22,-120.352,-2.507,-45.132 +camera 1,460.46,-302.03,1195.08,-166.423,0.441,12.545 +197,313.01,-137.43,64.84,-43.919,10.863,-137.223,1 +198,358.37,-49.95,97.32,122.783,-37.930,-66.831,3 +200,288.12,-27.96,119.65,0.121,-1.297,0.397,3 +201,250.61,48.77,108.94,88.676,1.721,-89.698,1 +204,289.63,123.83,127.01,128.096,-25.179,-53.030,3 +205,831.89,-75.89,-90.45,-0.162,-9.649,-0.268,2 +207,819.67,10.39,-42.80,-3.626,-3.520,-0.994,2 +208,497.75,-82.54,-53.87,20.918,-10.309,0.439,2 +210,-2.99,-0.71,0.50,2.377,0.184,-0.194,3 +211,199.46,0.22,-0.80,-3.189,0.906,-1.252,3 +212,438.01,-373.57,72.38,-85.854,-1.602,106.131,1 +214,399.90,5.55,-27.95,-0.378,-9.866,-0.703,2 +215,199.39,-90.08,-0.83,-5.507,3.929,-0.594,3 +217,612.87,21.73,-85.09,14.839,-16.092,-4.602,2 +218,448.81,-245.94,109.39,-8.326,-1.595,-0.978,3 +219,450.42,-352.53,124.37,-8.411,-0.066,0.365,3 +226,449.75,-134.02,93.73,137.977,-47.849,-89.841,3 +229,359.92,-140.80,97.55,117.461,-45.015,-68.639,3 +243,389.93,-147.98,30.40,90.803,1.786,1.255,1 diff --git a/test/snapshots/snapshot_video0_1775053356508_two_cam.json b/test/snapshots/snapshot_video0_1775053356508_two_cam.json new file mode 100644 index 0000000..544b60a --- /dev/null +++ b/test/snapshots/snapshot_video0_1775053356508_two_cam.json @@ -0,0 +1,292 @@ +{ + "metadata": { + "timestamp": "2026-04-01 14:22:36", + "reference_markers": [ + 210, + 211, + 215 + ], + "dict": "DICT_4X4_250", + "marker_size_mm": 25.0, + "rms_refs_px_cam1": 3.378740906255586, + "rms_refs_px_cam2": 2.390546911098745, + "description": "Two-camera joint optimization with triangulation" + }, + "cameras": [ + { + "id": "camera1", + "position_mm": [ + -180.2934873693634, + -582.7026829125251, + 606.2184304092095 + ], + "orientation_deg": { + "roll": -120.35196168779923, + "pitch": -2.5067814319660724, + "yaw": -45.132040949405415 + } + }, + { + "id": "camera2", + "position_mm": [ + 460.46087398323533, + -302.0267548206375, + 1195.0793038725305 + ], + "orientation_deg": { + "roll": -166.4230925326533, + "pitch": 0.44085388226781036, + "yaw": 12.544632747684963 + } + } + ], + "markers": [ + { + "id": 197, + "position_mm": [ + 313.0117745005052, + -137.42631952618396, + 64.83905421949487 + ], + "orientation_deg": { + "roll": -43.91856484056828, + "pitch": 10.863239798498853, + "yaw": -137.22269306865633 + } + }, + { + "id": 198, + "position_mm": [ + 358.36993408203125, + -49.945735931396484, + 97.31610870361328 + ], + "orientation_deg": { + "roll": 122.78291647929343, + "pitch": -37.929947259478986, + "yaw": -66.83115727760695 + } + }, + { + "id": 200, + "position_mm": [ + 288.1150817871094, + -27.963459014892578, + 119.65457153320312 + ], + "orientation_deg": { + "roll": 0.1210738004558989, + "pitch": -1.2970108600504175, + "yaw": 0.39708319324064106 + } + }, + { + "id": 201, + "position_mm": [ + 250.61174241952338, + 48.770039813857856, + 108.94316659289433 + ], + "orientation_deg": { + "roll": 88.67560594063735, + "pitch": 1.7209374574508063, + "yaw": -89.6983104558761 + } + }, + { + "id": 204, + "position_mm": [ + 289.6269226074219, + 123.83003234863281, + 127.01192474365234 + ], + "orientation_deg": { + "roll": 128.09632036201617, + "pitch": -25.178855713196512, + "yaw": -53.02971002864366 + } + }, + { + "id": 205, + "position_mm": [ + 831.8898605678013, + -75.89247746062189, + -90.45386690292467 + ], + "orientation_deg": { + "roll": -0.16232733180350478, + "pitch": -9.649209331493775, + "yaw": -0.26791412328043324 + } + }, + { + "id": 207, + "position_mm": [ + 819.6683212110961, + 10.38529231370039, + -42.7984497155689 + ], + "orientation_deg": { + "roll": -3.6257896782979877, + "pitch": -3.5199633579751333, + "yaw": -0.9942169763678559 + } + }, + { + "id": 208, + "position_mm": [ + 497.74753008086935, + -82.53579513512224, + -53.866445255438045 + ], + "orientation_deg": { + "roll": 20.91787896896225, + "pitch": -10.309477347748961, + "yaw": 0.4391253791011457 + } + }, + { + "id": 210, + "position_mm": [ + -2.9949965476989746, + -0.7070890069007874, + 0.4990556538105011 + ], + "orientation_deg": { + "roll": 2.3765744907389035, + "pitch": 0.18354391966658565, + "yaw": -0.19394999101273383 + } + }, + { + "id": 211, + "position_mm": [ + 199.46054077148438, + 0.22055648267269135, + -0.8021777868270874 + ], + "orientation_deg": { + "roll": -3.1894548301416297, + "pitch": 0.9063881330354913, + "yaw": -1.2515674795990612 + } + }, + { + "id": 212, + "position_mm": [ + 438.0072384873113, + -373.57227963165116, + 72.37967352624774 + ], + "orientation_deg": { + "roll": -85.85407193298983, + "pitch": -1.6016557024095894, + "yaw": 106.13093524852962 + } + }, + { + "id": 214, + "position_mm": [ + 399.89880467989553, + 5.5511391070884315, + -27.954999082773433 + ], + "orientation_deg": { + "roll": -0.37842131135239854, + "pitch": -9.865515152918247, + "yaw": -0.7025976073158033 + } + }, + { + "id": 215, + "position_mm": [ + 199.38986206054688, + -90.07653045654297, + -0.8274731040000916 + ], + "orientation_deg": { + "roll": -5.506676560559792, + "pitch": 3.928848268426832, + "yaw": -0.5936686302418879 + } + }, + { + "id": 217, + "position_mm": [ + 612.8670546452795, + 21.725382219876465, + -85.09371706544333 + ], + "orientation_deg": { + "roll": 14.838545293335498, + "pitch": -16.09170411323534, + "yaw": -4.6019356858139515 + } + }, + { + "id": 218, + "position_mm": [ + 448.805419921875, + -245.9364471435547, + 109.39110565185547 + ], + "orientation_deg": { + "roll": -8.325659635675745, + "pitch": -1.5954280938665324, + "yaw": -0.9783401776101657 + } + }, + { + "id": 219, + "position_mm": [ + 450.4158020019531, + -352.5322265625, + 124.3732681274414 + ], + "orientation_deg": { + "roll": -8.41121918492422, + "pitch": -0.06643397955297632, + "yaw": 0.3647803563168519 + } + }, + { + "id": 226, + "position_mm": [ + 449.75091552734375, + -134.0245819091797, + 93.72562408447266 + ], + "orientation_deg": { + "roll": 137.9774086127801, + "pitch": -47.84854652853605, + "yaw": -89.84086658243513 + } + }, + { + "id": 229, + "position_mm": [ + 359.9160461425781, + -140.80027770996094, + 97.5535659790039 + ], + "orientation_deg": { + "roll": 117.46114650914454, + "pitch": -45.01461049381471, + "yaw": -68.63853132083344 + } + }, + { + "id": 243, + "position_mm": [ + 389.93076591403826, + -147.9809413320975, + 30.402230114854877 + ], + "orientation_deg": { + "roll": 90.80307584205956, + "pitch": 1.7855453555902752, + "yaw": 1.255488086563549 + } + } + ] +} \ No newline at end of file diff --git a/test/snapshots/snapshot_video0_1775053356508_two_cam_annotated.jpg b/test/snapshots/snapshot_video0_1775053356508_two_cam_annotated.jpg new file mode 100644 index 0000000..7142dfb Binary files /dev/null and b/test/snapshots/snapshot_video0_1775053356508_two_cam_annotated.jpg differ diff --git a/test/snapshots/snapshot_video0_1775053356508_two_cam_overlay.png b/test/snapshots/snapshot_video0_1775053356508_two_cam_overlay.png new file mode 100644 index 0000000..5ac7170 Binary files /dev/null and b/test/snapshots/snapshot_video0_1775053356508_two_cam_overlay.png differ diff --git a/test/snapshots/snapshot_video0_1775055007798.jpg b/test/snapshots/snapshot_video0_1775055007798.jpg new file mode 100755 index 0000000..62be9e2 Binary files /dev/null and b/test/snapshots/snapshot_video0_1775055007798.jpg differ diff --git a/test/snapshots/snapshot_video0_1775055007798_two_cam.csv b/test/snapshots/snapshot_video0_1775055007798_two_cam.csv new file mode 100755 index 0000000..f647871 --- /dev/null +++ b/test/snapshots/snapshot_video0_1775055007798_two_cam.csv @@ -0,0 +1,22 @@ +id,x_mm,y_mm,z_mm,roll_deg,pitch_deg,yaw_deg,seen_by +camera 0,-169.31,-590.54,610.01,-120.637,-1.900,-44.583 +camera 1,458.47,-305.28,1194.04,-166.289,0.328,12.512 +197,324.32,-128.91,52.99,-43.555,88.628,136.364,1 +198,358.37,-50.86,97.71,121.842,-36.827,-64.694,3 +200,288.19,-29.23,120.74,0.355,-0.669,0.931,3 +201,268.29,74.43,89.17,87.299,3.171,-87.487,1 +204,289.32,123.34,127.81,127.695,-24.616,-52.323,3 +205,831.85,-75.87,-90.35,-0.004,-9.729,-0.328,2 +207,826.71,16.46,-66.93,28.597,-23.307,-4.231,2 +208,498.32,-79.52,-72.61,-5.766,-5.010,3.401,2 +210,-3.00,-0.70,0.48,0.889,1.615,-0.186,3 +211,199.46,0.23,-0.81,-2.974,1.541,-0.709,3 +212,448.84,-370.86,63.64,-82.887,-2.480,107.806,1 +214,400.05,5.55,-27.63,0.768,-13.728,-1.991,2 +215,199.39,-90.07,-0.84,-1.925,0.092,-0.797,3 +217,601.77,4.98,-7.30,127.401,-43.177,-81.888,3 +218,448.79,-246.94,109.56,-7.267,-0.743,0.665,3 +219,450.53,-353.60,124.89,-7.360,0.853,1.939,3 +226,449.55,-134.78,93.36,136.418,-48.850,-87.466,3 +229,359.88,-141.90,98.27,-1.498,0.759,-1.139,3 +243,395.41,-144.10,24.43,90.157,2.426,2.271,1 diff --git a/test/snapshots/snapshot_video0_1775055007798_two_cam.json b/test/snapshots/snapshot_video0_1775055007798_two_cam.json new file mode 100755 index 0000000..53bd827 --- /dev/null +++ b/test/snapshots/snapshot_video0_1775055007798_two_cam.json @@ -0,0 +1,292 @@ +{ + "metadata": { + "timestamp": "2026-04-01 14:50:08", + "reference_markers": [ + 210, + 211, + 215 + ], + "dict": "DICT_4X4_250", + "marker_size_mm": 25.0, + "rms_refs_px_cam1": 3.3833364222651165, + "rms_refs_px_cam2": 2.3948313887470385, + "description": "Two-camera joint optimization with triangulation" + }, + "cameras": [ + { + "id": "camera1", + "position_mm": [ + -169.31458303053114, + -590.5403610290119, + 610.0127251550674 + ], + "orientation_deg": { + "roll": -120.63665543950516, + "pitch": -1.8997417867976514, + "yaw": -44.58333266603719 + } + }, + { + "id": "camera2", + "position_mm": [ + 458.4659172415876, + -305.28148627217706, + 1194.0391686265923 + ], + "orientation_deg": { + "roll": -166.28853383194823, + "pitch": 0.32795062397009933, + "yaw": 12.511685833826132 + } + } + ], + "markers": [ + { + "id": 197, + "position_mm": [ + 324.3247308236978, + -128.91145206215703, + 52.99066700405597 + ], + "orientation_deg": { + "roll": -43.554638825384735, + "pitch": 88.62847879336204, + "yaw": 136.36440070030667 + } + }, + { + "id": 198, + "position_mm": [ + 358.3747863769531, + -50.85673141479492, + 97.70661926269531 + ], + "orientation_deg": { + "roll": 121.84182973454827, + "pitch": -36.82690204167092, + "yaw": -64.69420708943247 + } + }, + { + "id": 200, + "position_mm": [ + 288.1910705566406, + -29.227956771850586, + 120.73944854736328 + ], + "orientation_deg": { + "roll": 0.35491692297975885, + "pitch": -0.6687106593921792, + "yaw": 0.9308350860841724 + } + }, + { + "id": 201, + "position_mm": [ + 268.28853167785013, + 74.4343022759153, + 89.17126866326308 + ], + "orientation_deg": { + "roll": 87.29869403373556, + "pitch": 3.17059549901763, + "yaw": -87.4865738038031 + } + }, + { + "id": 204, + "position_mm": [ + 289.31732177734375, + 123.33594512939453, + 127.8097152709961 + ], + "orientation_deg": { + "roll": 127.69456389724971, + "pitch": -24.616158306756613, + "yaw": -52.32280627187357 + } + }, + { + "id": 205, + "position_mm": [ + 831.846649411246, + -75.87216662846943, + -90.34781727034935 + ], + "orientation_deg": { + "roll": -0.0038036571613558673, + "pitch": -9.729424436105697, + "yaw": -0.32844424012560414 + } + }, + { + "id": 207, + "position_mm": [ + 826.7088162246658, + 16.458956554079528, + -66.92776701864634 + ], + "orientation_deg": { + "roll": 28.597259453047982, + "pitch": -23.306976307999538, + "yaw": -4.230746330404859 + } + }, + { + "id": 208, + "position_mm": [ + 498.3242290903246, + -79.5216628500659, + -72.61168548772746 + ], + "orientation_deg": { + "roll": -5.765535990336847, + "pitch": -5.009518267469449, + "yaw": 3.4008252850838274 + } + }, + { + "id": 210, + "position_mm": [ + -2.9961342811584473, + -0.7001294493675232, + 0.4807419180870056 + ], + "orientation_deg": { + "roll": 0.8889903603083815, + "pitch": 1.6145819456543633, + "yaw": -0.1863768906781964 + } + }, + { + "id": 211, + "position_mm": [ + 199.45684814453125, + 0.2268103063106537, + -0.8084065318107605 + ], + "orientation_deg": { + "roll": -2.9737223132542323, + "pitch": 1.5411387108876151, + "yaw": -0.7091968440272908 + } + }, + { + "id": 212, + "position_mm": [ + 448.83953992389416, + -370.85819275525984, + 63.6379004483264 + ], + "orientation_deg": { + "roll": -82.88706716542909, + "pitch": -2.4795452659396653, + "yaw": 107.80633782293525 + } + }, + { + "id": 214, + "position_mm": [ + 400.050655349458, + 5.548394967649584, + -27.63426543948677 + ], + "orientation_deg": { + "roll": 0.7676438060259367, + "pitch": -13.727583830436073, + "yaw": -1.9911687380860292 + } + }, + { + "id": 215, + "position_mm": [ + 199.38528442382812, + -90.0677719116211, + -0.8434966802597046 + ], + "orientation_deg": { + "roll": -1.9252063462559639, + "pitch": 0.09199236439016495, + "yaw": -0.7971196767320616 + } + }, + { + "id": 217, + "position_mm": [ + 601.7681274414062, + 4.977344989776611, + -7.298913478851318 + ], + "orientation_deg": { + "roll": 127.40051420343804, + "pitch": -43.17667838615246, + "yaw": -81.88821632493182 + } + }, + { + "id": 218, + "position_mm": [ + 448.7939453125, + -246.93736267089844, + 109.56390380859375 + ], + "orientation_deg": { + "roll": -7.2669292967605985, + "pitch": -0.7431452682869975, + "yaw": 0.6650860748689267 + } + }, + { + "id": 219, + "position_mm": [ + 450.5305480957031, + -353.6015319824219, + 124.88739776611328 + ], + "orientation_deg": { + "roll": -7.36023767190836, + "pitch": 0.8525757408322348, + "yaw": 1.9391643429117837 + } + }, + { + "id": 226, + "position_mm": [ + 449.55108642578125, + -134.7753448486328, + 93.36372375488281 + ], + "orientation_deg": { + "roll": 136.41757016103372, + "pitch": -48.8501623661583, + "yaw": -87.46581530976329 + } + }, + { + "id": 229, + "position_mm": [ + 359.8786315917969, + -141.90289306640625, + 98.27476501464844 + ], + "orientation_deg": { + "roll": -1.498485798574588, + "pitch": 0.7590119621991104, + "yaw": -1.1391200277129534 + } + }, + { + "id": 243, + "position_mm": [ + 395.40653314762807, + -144.09700934058307, + 24.42709826582479 + ], + "orientation_deg": { + "roll": 90.15741676846092, + "pitch": 2.426387551762009, + "yaw": 2.270649362467167 + } + } + ] +} \ No newline at end of file diff --git a/test/snapshots/snapshot_video0_1775055007798_two_cam_annotated.jpg b/test/snapshots/snapshot_video0_1775055007798_two_cam_annotated.jpg new file mode 100755 index 0000000..e2e20fc Binary files /dev/null and b/test/snapshots/snapshot_video0_1775055007798_two_cam_annotated.jpg differ diff --git a/test/snapshots/snapshot_video0_1775055007798_two_cam_overlay.png b/test/snapshots/snapshot_video0_1775055007798_two_cam_overlay.png new file mode 100755 index 0000000..e5070fa Binary files /dev/null and b/test/snapshots/snapshot_video0_1775055007798_two_cam_overlay.png differ diff --git a/test/snapshots/snapshot_video1_1775053356508.jpg b/test/snapshots/snapshot_video1_1775053356508.jpg new file mode 100644 index 0000000..839b301 Binary files /dev/null and b/test/snapshots/snapshot_video1_1775053356508.jpg differ diff --git a/test/snapshots/snapshot_video1_1775053356508_two_cam_annotated.jpg b/test/snapshots/snapshot_video1_1775053356508_two_cam_annotated.jpg new file mode 100644 index 0000000..63adc8b Binary files /dev/null and b/test/snapshots/snapshot_video1_1775053356508_two_cam_annotated.jpg differ diff --git a/test/snapshots/snapshot_video1_1775053356508_two_cam_overlay.png b/test/snapshots/snapshot_video1_1775053356508_two_cam_overlay.png new file mode 100644 index 0000000..610ddf6 Binary files /dev/null and b/test/snapshots/snapshot_video1_1775053356508_two_cam_overlay.png differ diff --git a/test/snapshots/snapshot_video1_1775055007798.jpg b/test/snapshots/snapshot_video1_1775055007798.jpg new file mode 100755 index 0000000..37cfbd4 Binary files /dev/null and b/test/snapshots/snapshot_video1_1775055007798.jpg differ diff --git a/test/snapshots/snapshot_video1_1775055007798_two_cam_annotated.jpg b/test/snapshots/snapshot_video1_1775055007798_two_cam_annotated.jpg new file mode 100755 index 0000000..40b9d1b Binary files /dev/null and b/test/snapshots/snapshot_video1_1775055007798_two_cam_annotated.jpg differ diff --git a/test/snapshots/snapshot_video1_1775055007798_two_cam_overlay.png b/test/snapshots/snapshot_video1_1775055007798_two_cam_overlay.png new file mode 100755 index 0000000..f75cd31 Binary files /dev/null and b/test/snapshots/snapshot_video1_1775055007798_two_cam_overlay.png differ