drop hardcoded lookup table
This commit is contained in:
+3
-53
@@ -73,52 +73,7 @@ const LIMITS = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ── Letter / number position lookup table ────────────────────────
|
// ── Letter / number position lookup table ────────────────────────
|
||||||
// Directly ported from PositionControl.cpp
|
// (Removed: superseded by spots.json dynamic loading)
|
||||||
const LOOKUP_TABLE = {
|
|
||||||
'Q': { x: -66.5, y: 91.6 },
|
|
||||||
'W': { x: 70.8, y: 92.0 },
|
|
||||||
'E': { x: -41.4, y: 125.5 },
|
|
||||||
'R': { x: -44.0, y: 96.0 },
|
|
||||||
'T': { x: 1.3, y: 97.8 },
|
|
||||||
'Y': { x: 117.8, y: 91.7 },
|
|
||||||
'U': { x: 22.5, y: 98.3 },
|
|
||||||
'I': { x: 53.5, y: 124.5 },
|
|
||||||
'O': { x: -112.0, y: 82.0 },
|
|
||||||
'P': { x: -90.0, y: 89.0 },
|
|
||||||
'A': { x: -143.0, y: 99.0 },
|
|
||||||
'S': { x: -19.8, y: 98.0 },
|
|
||||||
'D': { x: -68.5, y: 121.7 },
|
|
||||||
'F': { x: -19.5, y: 127.0 },
|
|
||||||
'G': { x: 4.0, y: 128.4 },
|
|
||||||
'H': { x: 31.3, y: 127.3 },
|
|
||||||
'J': { x: 72.5, y: 121.0 },
|
|
||||||
'K': { x: 93.0, y: 116.8 },
|
|
||||||
'L': { x: 114.3, y: 110.2 },
|
|
||||||
'Z': { x: 130.0, y: 75.0 },
|
|
||||||
'X': { x: 95.9, y: 87.3 },
|
|
||||||
'C': { x: -94.0, y: 116.0 },
|
|
||||||
'V': { x: 44.5, y: 97.0 },
|
|
||||||
'B': { x: -119.0, y: 109.0 },
|
|
||||||
'N': { x: -135.4, y: 75.1 },
|
|
||||||
'M': { x: 132.0, y: 100.5 },
|
|
||||||
|
|
||||||
'+': { x: -110.0, y: 1.0 },
|
|
||||||
'-': { x: 110.0, y: 1.0 },
|
|
||||||
'*': { x: 110.0, y: -24.0 },
|
|
||||||
',': { x: -110.0, y: -24.0 },
|
|
||||||
|
|
||||||
'0': { x: -130.4, y: 44.2 },
|
|
||||||
'1': { x: -101.1, y: 53.3 },
|
|
||||||
'2': { x: -71.5, y: 60.4 },
|
|
||||||
'3': { x: -41.7, y: 65.2 },
|
|
||||||
'4': { x: -13.0, y: 66.5 },
|
|
||||||
'5': { x: 16.3, y: 68.0 },
|
|
||||||
'6': { x: 45.8, y: 64.0 },
|
|
||||||
'7': { x: 75.7, y: 61.1 },
|
|
||||||
'8': { x: 103.6, y: 53.8 },
|
|
||||||
'9': { x: 132.1, y: 45.0 },
|
|
||||||
};
|
|
||||||
|
|
||||||
// ── IK solver — exact port of calculateInverseKinematics() ───────
|
// ── IK solver — exact port of calculateInverseKinematics() ───────
|
||||||
/**
|
/**
|
||||||
* Compute motor angles for a given target end-effector position.
|
* Compute motor angles for a given target end-effector position.
|
||||||
@@ -312,11 +267,6 @@ function checkWorkspace(x, y) {
|
|||||||
return { ok: true, reason: '' };
|
return { ok: true, reason: '' };
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Lookup ────────────────────────────────────────────────────────
|
|
||||||
function lookup(char) {
|
|
||||||
return LOOKUP_TABLE[char.toUpperCase()] ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Unit converters ───────────────────────────────────────────────
|
// ── Unit converters ───────────────────────────────────────────────
|
||||||
function stepsToRad(steps) {
|
function stepsToRad(steps) {
|
||||||
// Physical motors are wired such that + steps is CW.
|
// Physical motors are wired such that + steps is CW.
|
||||||
@@ -346,7 +296,7 @@ function radToDeg(rad) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
ARM, LIMITS, LOOKUP_TABLE,
|
ARM, LIMITS,
|
||||||
solve, forward, armsCrossed, checkWorkspace, lookup,
|
solve, forward, armsCrossed, checkWorkspace,
|
||||||
stepsToRad, radToSteps, radToStepsAbsolute, stepsToDeg, radToDeg,
|
stepsToRad, radToSteps, radToStepsAbsolute, stepsToDeg, radToDeg,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user