kinematic motion controller

This commit is contained in:
osiu97
2026-07-08 18:14:17 +02:00
parent e1416f6979
commit 57ea3f7b4a
6 changed files with 220 additions and 138 deletions
+8
View File
@@ -176,6 +176,14 @@ The sidebar is in `index.html` (not in any section). It is a collapsible panel o
hamburger (`☰`) button. It contains `<button data-route="...">` nav items that call
`Router.navigate(route)`. The active item gets `class="active"` via the router.
### Kinematic Motion Controller (`web/js/motion.js`)
Centralised trajectory generation and streaming module.
- **Why**: Moving side-to-side linearly in joint space causes the arms to arc dangerously out-of-bounds at the top.
- **How it works**: Intercepts `Motion.goto(x, y)`, slices the Cartesian straight line into small segments (max `25 mm` by default, configurable in `Motion.CONFIG.SEGMENT_SIZE_MM`), and streams them to the ESP32.
- **Dynamic Blending**: It monitors `P:` positional updates from the ESP32 and fires the next waypoint *before* `AccelStepper` decelerates (when within `BLEND_THRESHOLD_STEPS`). This produces a seamless Cartesian trajectory with no MCU code changes and allows for future "visual flavor" movement effects (e.g. snaky, erratic).
- **Simulation Sync**: In simulation mode, `Motion.goto()` instantly updates its internal steps and manually dispatches a fake `ble:status` event containing `P:s1,s2`. This allows all UI components to effortlessly sync their visual state using their existing BLE listeners.
---
## 6. Kinematics (`web/js/kinematics.js`)