Skip to content

Commit cc6839b

Browse files
jaysukclaude
andcommitted
fix: iterate A/V every cycle and push the feed-forward harder
The chart after 5 cycles settled to ~zero (P/D/I good) but still showed a steady-speed lag (V too low) and accel/decel spikes (A too low), because A/V were only tuned on the final cycle and gave up early. Now A/V run every cycle (true coordinate-descent iteration with P/D/I), with a tighter plateau (5%), lower cruise target (3), higher caps (A 2e6 / V 10000) and a couple more attempts, so they push further toward zero error during the move. 48 tests green; typecheck + verify-build OK. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent d86f1ad commit cc6839b

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/components/ClosedLoopTuning.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,9 +811,9 @@ async function runAutoTune(): Promise<void> {
811811
if (autoCancel.value) { ok = false; break; }
812812
if (!(await autoTuneTerm(strategy))) { ok = false; break; }
813813
}
814-
// A/V feed-forward (needs a G1 move + an axis) — only on the final cycle, after P/D/I have
815-
// settled, since they're slower and far less coupled to the P/D/I iteration.
816-
if (ok && !autoCancel.value && cycle === totalCycles) {
814+
// A/V feed-forward (needs a G1 move + an axis) — run every cycle so they iterate alongside
815+
// P/D/I (a too-low V leaves a steady-speed lag; a too-low A leaves accel/decel spikes).
816+
if (ok && !autoCancel.value) {
817817
if (axisLetterForDriver()) {
818818
log("Tuning A/V on a moving axis…");
819819
for (const strategy of AUTOTUNE_FF_SEQUENCE) {

src/model/autotune.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ export interface MoveTermStrategy {
161161
decide(attempts: Array<MoveAttempt>): AutoDecision;
162162
}
163163

164-
export const A_MAX = 1_000_000;
165-
export const V_MAX = 5000;
166-
export const AV_PLATEAU = 0.1; // <10% improvement → stop raising
167-
export const V_CRUISE_OK = 5; // |mean P term| in cruise considered ~zero
164+
export const A_MAX = 2_000_000;
165+
export const V_MAX = 10000;
166+
export const AV_PLATEAU = 0.05; // <5% improvement → stop raising (push further before settling)
167+
export const V_CRUISE_OK = 3; // |mean P term| in cruise considered ~zero
168168

169169
const noMove: AutoDecision = { kind: "fail", reason: "No steady-speed move detected — increase the A/V test move length or speed so the axis reaches cruise." };
170170

@@ -177,7 +177,7 @@ export const A_STRATEGY: MoveTermStrategy = {
177177
term: "a",
178178
label: "A (accel feed-forward)",
179179
start: 0,
180-
maxAttempts: 8,
180+
maxAttempts: 10,
181181
decide(attempts) {
182182
const last = attempts[attempts.length - 1];
183183
if (!last.metrics.hasMove) { return noMove; }
@@ -204,7 +204,7 @@ export const V_STRATEGY: MoveTermStrategy = {
204204
term: "v",
205205
label: "V (velocity feed-forward)",
206206
start: 0,
207-
maxAttempts: 9,
207+
maxAttempts: 11,
208208
decide(attempts) {
209209
const last = attempts[attempts.length - 1];
210210
if (!last.metrics.hasMove) { return noMove; }

0 commit comments

Comments
 (0)