Tests
This commit is contained in:
@@ -124,8 +124,8 @@ async function calculate() {
|
||||
const row229 = rows.find(r => r.id == 229 && r.seen_by == 3)
|
||||
if(row229){
|
||||
angleY += await calculateAngleFromPosition(row229, shoulderAxisY, shoulderAxisZ, 250, 35);
|
||||
angleY +=calculateAngleFromRollColumn(row229, 0, 0, 0);
|
||||
angleYcount+=2;
|
||||
//angleY +=calculateAngleFromRollColumn(row229, 0, 0, 0); // Roll ist extrem unzuverlässig
|
||||
angleYcount+=1;
|
||||
}
|
||||
console.log(angleY, angleYcount);
|
||||
const row198 = rows.find(r => r.id == 198 && r.seen_by == 3)
|
||||
@@ -140,6 +140,13 @@ async function calculate() {
|
||||
angleYcount += 3;
|
||||
}
|
||||
|
||||
const row197 = rows.find(r => r.id == 197)
|
||||
if(row197){
|
||||
var angleDeg = 90 - row197.pitch_deg;
|
||||
var angleRad = angleDeg * Math.PI / 180;
|
||||
appendToAnalysis(`(yMotor = ${angleDeg.toFixed(2)}° = ${angleRad.toFixed(4)} rad ) aus Pitch von ${row197.id}`);
|
||||
}
|
||||
|
||||
// Unterarm:
|
||||
|
||||
// 218 und 219, wenn die sichtbar sind, ist auch die Schulter eindeutig definiert
|
||||
@@ -161,15 +168,95 @@ async function calculate() {
|
||||
console.log("z", angleZ);
|
||||
|
||||
if(angleYcount > 0 && angleYcount > 0){
|
||||
// appendToAnalysis(`Suggestion: G92 y${(angleY/angleYcount).toFixed(3)} z${(angleZ/angleZcount).toFixed(3)} (Set to coordinats. Angles in rad)`);
|
||||
strActionOptionA = `G92 y${(angleY*180/(angleYcount*Math.PI)).toFixed(1)} z${(angleZ*180/(Math.PI*angleZcount)).toFixed(1)} (Set Coord. Angles in deg)`;
|
||||
strActionOptionB = `M92 y${(angleY/(angleYcount)).toFixed(3)} z${(angleZ/(angleZcount)).toFixed(3)} (Set Coord. Angles in rad)`;
|
||||
|
||||
appendToAnalysis(`Suggestion: ${strActionOptionA}`);
|
||||
appendToAnalysis(`Suggestion: ${strActionOptionB}`);
|
||||
|
||||
// ToDo: Change
|
||||
}
|
||||
|
||||
// Ellbow
|
||||
const row242 = rows.find(r => r.id == 242 && r.seen_by == 3)
|
||||
const row200 = rows.find(r => r.id == 200 && r.seen_by == 3)
|
||||
const row204 = rows.find(r => r.id == 204 && r.seen_by == 3)
|
||||
// Ellenbogen-Rotation aus x-Position 218 219
|
||||
// dazu brauche ich genaue x-Position von 226
|
||||
if(row226 || row229 || row198 || row243 || row242 || row200 || row200){
|
||||
var x226 = 0;
|
||||
var xCount = 0;
|
||||
if(row226){
|
||||
x226 += row226.x_mm * 5;
|
||||
xCount += 5;
|
||||
}
|
||||
if(row229){
|
||||
x226 += row229.x_mm + 90;
|
||||
xCount += 1;
|
||||
}
|
||||
if(row198){
|
||||
x226 += row198.x_mm + 90;
|
||||
xCount += 1;
|
||||
}
|
||||
if(row243){
|
||||
x226 += row243.x_mm + 90;
|
||||
xCount += 1;
|
||||
}
|
||||
if(row242){
|
||||
x226 += row242.x_mm + 90;
|
||||
xCount += 1;
|
||||
}
|
||||
if(row200){
|
||||
x226 += row200.x_mm + 154;
|
||||
xCount += 1;
|
||||
}
|
||||
if(row204){
|
||||
x226 += row204.x_mm + 160;
|
||||
xCount += 1;
|
||||
}
|
||||
x226 = x226 / xCount;
|
||||
appendToAnalysis(`Ellebogen x226=${x226}`)
|
||||
|
||||
// Wenn 218 und/oder 219 sicher gesehen wird, kann ich daraus x-pos bestimmen
|
||||
if(row218 || row219){
|
||||
var x219 = 0;
|
||||
xCount = 0;
|
||||
if(row218){
|
||||
x219 += row218.x_mm;
|
||||
xCount += 1;
|
||||
}
|
||||
if(row219){
|
||||
x219 += row219.x_mm;
|
||||
xCount += 1;
|
||||
}
|
||||
x219 = x219 / xCount;
|
||||
appendToAnalysis(`Ellebogen x219=${x219}`)
|
||||
var xDelta = x219 - x226;
|
||||
if(Math.abs(xDelta) < 35){
|
||||
|
||||
appendToAnalysis(`Ellebogen xDelta / 35=${xDelta / 35}`)
|
||||
var angleRad = Math.asin(xDelta / 35)
|
||||
var angleDeg = 90 -angleRad*180/Math.PI;
|
||||
appendToAnalysis(`(xEllbow = ${angleDeg.toFixed(2)}° = ${angleRad.toFixed(4)} rad ) aus x von 218 bzw. 219`);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = {
|
||||
calculateAngleFromPosition,
|
||||
calculateAngleFromRollColumn,
|
||||
calculateAngleFromRelativePosition,
|
||||
calculate
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Export für Module, falls benötigt
|
||||
// export { fetchCSV, calculate };
|
||||
Reference in New Issue
Block a user