a forearm
This commit is contained in:
@@ -320,63 +320,7 @@ function buildFeatureFromCandidates(result, key, title, method, candidates) {
|
||||
return feature;
|
||||
}
|
||||
|
||||
async function calculate() {
|
||||
const result = createAnalysisResult({
|
||||
sourceScript: "calculateActions.js"
|
||||
});
|
||||
|
||||
try {
|
||||
addLog(result, "Starte Berechnung...");
|
||||
|
||||
const { data, headers, rows } = await fetchCSV();
|
||||
|
||||
result.inputs = {
|
||||
source: {
|
||||
filename: data.filename,
|
||||
mtime: data.mtime
|
||||
},
|
||||
headers,
|
||||
rowCount: rows.length
|
||||
};
|
||||
|
||||
addLog(result, `CSV-Daten geladen: ${rows.length} Zeilen, ${headers.length} Spalten.`);
|
||||
|
||||
const getRow = (id, seenBy = null) => {
|
||||
const row = rows.find(r => r.id == id && (seenBy === null || r.seen_by == seenBy));
|
||||
if (row) {
|
||||
addObservation(
|
||||
result,
|
||||
`row-${id}${seenBy !== null ? `-seenBy-${seenBy}` : ""}`,
|
||||
row,
|
||||
seenBy === 3 ? 0.95 : 0.75,
|
||||
[
|
||||
`id=${id}`,
|
||||
seenBy !== null ? `seen_by=${seenBy}` : "seen_by=any"
|
||||
]
|
||||
);
|
||||
} else {
|
||||
addLog(result, `Zeile nicht gefunden: id=${id}${seenBy !== null ? `, seen_by=${seenBy}` : ""}`, "warn");
|
||||
}
|
||||
return row;
|
||||
};
|
||||
|
||||
const shoulderAxisY = 115;
|
||||
const shoulderAxisZ = 61;
|
||||
|
||||
// Oberarm / shoulder
|
||||
const row243 = getRow(243, 3);
|
||||
const row229 = getRow(229, 3);
|
||||
const row198 = getRow(198, 3);
|
||||
const row197 = getRow(197);
|
||||
const row218 = getRow(218, 3);
|
||||
const row219 = getRow(219, 3);
|
||||
const row226 = getRow(226, 3);
|
||||
const row242 = getRow(242, 3);
|
||||
const row200 = getRow(200, 3);
|
||||
const row204 = getRow(204, 3);
|
||||
const row222 = getRow(222, 3); // Ellbow
|
||||
const row223 = getRow(223, 3); // Lower Arm
|
||||
|
||||
function calculate_angleY(row243, row229, row198, row197, shoulderAxisY, shoulderAxisZ, result) {
|
||||
const angleYCandidates = [];
|
||||
|
||||
if (row243) {
|
||||
@@ -388,12 +332,13 @@ async function calculate() {
|
||||
valueRad: a1,
|
||||
weight: 1
|
||||
});
|
||||
|
||||
/*
|
||||
angleYCandidates.push({
|
||||
source: "row243.roll_deg",
|
||||
valueRad: a2,
|
||||
weight: 1
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
if (row229) {
|
||||
@@ -463,6 +408,108 @@ async function calculate() {
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async function calculate() {
|
||||
const result = createAnalysisResult({
|
||||
sourceScript: "calculateActions.js"
|
||||
});
|
||||
|
||||
try {
|
||||
addLog(result, "Starte Berechnung...");
|
||||
|
||||
const { data, headers, rows } = await fetchCSV();
|
||||
|
||||
result.inputs = {
|
||||
source: {
|
||||
filename: data.filename,
|
||||
mtime: data.mtime
|
||||
},
|
||||
headers,
|
||||
rowCount: rows.length
|
||||
};
|
||||
|
||||
addLog(result, `CSV-Daten geladen: ${rows.length} Zeilen, ${headers.length} Spalten.`);
|
||||
|
||||
const getRow = (id, seenBy = null) => {
|
||||
const row = rows.find(r => r.id == id && (seenBy === null || r.seen_by == seenBy));
|
||||
if (row) {
|
||||
addObservation(
|
||||
result,
|
||||
`row-${id}${seenBy !== null ? `-seenBy-${seenBy}` : ""}`,
|
||||
row,
|
||||
seenBy === 3 ? 0.95 : 0.75,
|
||||
[
|
||||
`id=${id}`,
|
||||
seenBy !== null ? `seen_by=${seenBy}` : "seen_by=any"
|
||||
]
|
||||
);
|
||||
} else {
|
||||
addLog(result, `Zeile nicht gefunden: id=${id}${seenBy !== null ? `, seen_by=${seenBy}` : ""}`, "warn");
|
||||
}
|
||||
return row;
|
||||
};
|
||||
|
||||
const shoulderAxisY = 115;
|
||||
const shoulderAxisZ = 61;
|
||||
|
||||
|
||||
const row200 = getRow(200, 3); // Base
|
||||
const row204 = getRow(204, 3); // Base
|
||||
const row201 = getRow(201, 3); // Base
|
||||
|
||||
|
||||
const row198 = getRow(198, 3); // Bizeps oben-hinten
|
||||
const row242 = getRow(242, 3); // Bizeps unten
|
||||
const row243 = getRow(243, 3); // Bizeps vorne
|
||||
const row229 = getRow(229, 3); // Bizeps oben
|
||||
const row197 = getRow(197); // Bizeps Seiten-Abdeckung
|
||||
|
||||
const row222 = getRow(222, 3); // Ellbow
|
||||
const row226 = getRow(226, 3); // Ellbow
|
||||
|
||||
const row223 = getRow(223, 3); // Forearm
|
||||
const row228 = getRow(228, 3); // Forearm
|
||||
const row218 = getRow(218, 3); // Forearm 90°
|
||||
const row219 = getRow(219, 3); // Forearm 90°
|
||||
|
||||
const row212 = getRow(212, 3); // Hand
|
||||
|
||||
|
||||
|
||||
// Bizeps > Y-Achse der Schulter: angleYCandidates
|
||||
calculate_angleY(row243, row229, row198, row197, shoulderAxisY, shoulderAxisZ, result);
|
||||
|
||||
// Forearm rotation: a axis:
|
||||
|
||||
listForearmID = [row223, row228, row218, row219];
|
||||
listForearmAngle = [60, 145, -90, -90];
|
||||
addLog(result, "Berechnung der Unterarm-Rotation (a axis) aus x Positionen von Forearm und Ellbogen...");
|
||||
for(let r = 0; r < listForearmID.length; r++){
|
||||
if (listForearmID[r] && (row222 || row226)) {
|
||||
dx = listForearmID[r].x_mm - (row222 ? row222.x_mm : row226.x_mm);
|
||||
if(dx > 35 || dx < -35){
|
||||
addLog(result, `dx=${dx.toFixed(2)} mm ist zu groß für eine realistische Unterarm-Rotation. Überspringe...`, "warn");
|
||||
continue;
|
||||
}
|
||||
addLog(result, `dx between ${listForearmID[r].id} and Ellbow: ${dx.toFixed(2)} mm results in angle: ${Math.asin(dx / 35)*180/Math.PI}°`);
|
||||
|
||||
var angleRad = Math.asin(dx / 35) + listForearmAngle[r] * Math.PI / 180
|
||||
if(row222){angleRad = -angleRad }
|
||||
const angleDeg = angleRad * 180 / Math.PI;
|
||||
addLog(result, `(a axis from ${listForearmID[r].id} with dx ${dx.toFixed(2)} mm: ${angleDeg.toFixed(2)}° = ${angleRad.toFixed(4)} rad ) aus x von ${listForearmID[r].id} und Ellbogen`);
|
||||
|
||||
|
||||
addCalculation(result, {
|
||||
type: "forearmrotationAFromX",
|
||||
input: {
|
||||
dx,
|
||||
r
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Unterarm / z
|
||||
const angleZCandidates = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user