Preserve RTCP compensation across rotary jog stops
This commit is contained in:
@@ -31,9 +31,11 @@ assert.equal(blocked.payload.code, "axis_gate");
|
||||
assert.equal(blocked.payload.reason, "xyzac_machine_off");
|
||||
assert.equal(blocked.payload.message_key, "xyzac_machine_off");
|
||||
first.send("POWER", { active: true });
|
||||
first.send("HOME", { all: true });
|
||||
first.send("PROGRAM_LOAD", { source: PROGRAM, path: "followups.ngc" });
|
||||
first.send("PROGRAM_RUN");
|
||||
assert.equal(first.send("HOME", { all: true }).kind, "COMMAND_RESULT");
|
||||
for (let tick = 0; tick < 500 && !first.session.wasmHomeLimit.read().state.homed; tick++) first.send("SIM_STEP", { cycles: 1 });
|
||||
assert.equal(first.session.wasmHomeLimit.read().state.homed, true);
|
||||
assert.equal(first.send("PROGRAM_LOAD", { source: PROGRAM, path: "followups.ngc" }).kind, "COMMAND_RESULT");
|
||||
assert.equal(first.send("PROGRAM_RUN").kind, "COMMAND_RESULT");
|
||||
const compact = first.send("SIM_STEP", { cycles: 1, response: "motion_delta" });
|
||||
assert.equal(compact.payload.snapshot_mode, "motion_delta");
|
||||
assert.equal(compact.payload.panel_snapshot, undefined);
|
||||
|
||||
@@ -95,7 +95,15 @@ export class WasmLinuxcncTp {
|
||||
setVelocityScale(value) { if (!this.available) return this.read(); const result = call(this.core, "sim_linuxcnc_tp_set_velocity_scale", "number", ["number", "number"], [this.planner, Number(value)]); if (result !== 0) throw new Error(`linuxcnc_tp_velocity_scale_${result}`); return this.read(); }
|
||||
setJogScale(value) { if (!this.available) return this.read(); const result = call(this.core, "sim_linuxcnc_tp_set_jog_scale", "number", ["number", "number"], [this.planner, Number(value)]); if (result !== 0) throw new Error(`linuxcnc_tp_jog_scale_${result}`); return this.read(); }
|
||||
setAxisLimit(axis, minimum, maximum) { if (!this.available) return this.read(); const result = call(this.core, "sim_linuxcnc_tp_set_axis_limit", "number", ["number", "number", "number", "number"], [this.planner, Number(axis), Number(minimum), Number(maximum)]); if (result !== 0) throw new Error(`linuxcnc_tp_axis_limit_${result}`); return this.read(); }
|
||||
jog(axis, direction, increment, tag = 0) { if (!this.available) return { status: "blocked", code: "linuxcnc_tp_unavailable" }; const result = call(this.core, "sim_linuxcnc_tp_jog", "number", ["number", "number", "number", "number", "number"], [this.planner, Number(axis), Number(direction), Number(increment), Number(tag)]); return result === 0 ? { status: "verified", command: "JOG_START" } : { status: "error", code: `linuxcnc_tp_jog_${result}` }; }
|
||||
jog(axis, direction, increment, tag = 0) {
|
||||
if (!this.available) return { status: "blocked", code: "linuxcnc_tp_unavailable" };
|
||||
const result = call(this.core, "sim_linuxcnc_tp_jog", "number", ["number", "number", "number", "number", "number"], [this.planner, Number(axis), Number(direction), Number(increment), Number(tag)]);
|
||||
if (result !== 0) return { status: "error", code: `linuxcnc_tp_jog_${result}` };
|
||||
// The native jog tag is a segment ID, not a kinematics mode. Replace any
|
||||
// earlier program-line mapping with this jog's current coordinate frame.
|
||||
if (Number(tag) > 0) this.segmentTags.set(Number(tag), this.activeTag);
|
||||
return { status: "verified", command: "JOG_START" };
|
||||
}
|
||||
jogVelocity(axis) { if (!this.available) return 0; const index = { x: 0, y: 1, z: 2, a: 3, b: 4, c: 5, u: 6, v: 7, w: 8 }[String(axis).toLowerCase()]; return index === undefined ? 0 : Number(call(this.core, "sim_linuxcnc_tp_jog_velocity", "number", ["number", "number"], [this.planner, index])); }
|
||||
setPaused(value) { this.controls.paused = Boolean(value); if (this.available) call(this.core, "sim_linuxcnc_tp_set_paused", "number", ["number", "number"], [this.planner, this.controls.paused ? 1 : 0]); return this.read(); }
|
||||
stepLine() {
|
||||
@@ -214,7 +222,13 @@ export class WasmLinuxcncTp {
|
||||
}
|
||||
|
||||
reset() { if (this.available) call(this.core, "sim_linuxcnc_tp_reset", "number", ["number"], [this.planner]); this.controls.paused = false; this.activeTag = 0; this.segmentTags.clear(); this.lastActiveId = 0; this.queueDepthOverride = null; this.executionState = 3; return this.read(); }
|
||||
abort() { if (this.available) call(this.core, "sim_linuxcnc_tp_abort", "number", ["number"], [this.planner]); this.activeTag = 0; this.segmentTags.clear(); this.lastActiveId = 0; this.queueDepthOverride = null; this.executionState = 3; return this.read(); }
|
||||
abort() {
|
||||
if (this.available) call(this.core, "sim_linuxcnc_tp_abort", "number", ["number"], [this.planner]);
|
||||
// Stopping motion is not M429: keep the coordinate frame of the stopped
|
||||
// pose, so its WASM inverse and the next jog retain RTCP compensation.
|
||||
this.segmentTags.clear(); this.lastActiveId = 0; this.queueDepthOverride = null; this.executionState = 3;
|
||||
return this.read();
|
||||
}
|
||||
exportState() {
|
||||
const current = this.read();
|
||||
const segments = [];
|
||||
|
||||
Reference in New Issue
Block a user