Complete 3axis tutorial native and Web/WASM parity tools
This commit is contained in:
@@ -16,6 +16,11 @@ assert.equal(twin.setFollowingError(0.02).state.fault, "following_error");
|
||||
const checkpoint = twin.export();
|
||||
const restoredTwin = new MotionState();
|
||||
assert.deepEqual(restoredTwin.restore(checkpoint), checkpoint);
|
||||
const partialHome = new MotionState();
|
||||
assert.deepEqual(partialHome.home("z").state.homed_axes, [false, false, true]);
|
||||
assert.equal(partialHome.state.homed, false);
|
||||
assert.deepEqual(partialHome.home("x").state.homed_axes, [true, false, true]);
|
||||
assert.equal(partialHome.home("y").state.homed, true);
|
||||
|
||||
const core = await createModule({ wasmBinary: await readFile(new URL("../../build-wasm/linuxcnc-sim-core.wasm", import.meta.url)) });
|
||||
const session = new SimSession(core, { sessionId: "motion-state" });
|
||||
@@ -25,6 +30,7 @@ send("HELLO", 1);
|
||||
send("SESSION_ATTACH", 2, "attach");
|
||||
send("LOAD_WORKSPACE", 3, "workspace", { root_path: "/workspace" });
|
||||
assert.equal(send("HOME", 4, "home").payload.state.homed, true);
|
||||
assert.deepEqual(session.motion.export().homed_axes, [true, true, true]);
|
||||
send("JOG_START", 5, "jog", { axis: "x", direction: 1, speed: 10 });
|
||||
const stepped = send("SIM_STEP", 6, "step", { cycles: 2 });
|
||||
assert.equal(stepped.payload.snapshot.state_hash, stepped.payload.state_hash);
|
||||
|
||||
Reference in New Issue
Block a user