Add AC/BC RTCP programs and 3D machine manager

This commit is contained in:
2026-09-20 12:31:12 +08:00
parent 1c1e5f9672
commit 8aab531b02
363 changed files with 53213 additions and 58 deletions

View File

@@ -50,20 +50,22 @@ for (const [code, expected] of [["M429", 0], ["M428", 1], ["M430", 2]]) {
switchRows.push({ code, tick: result.simulation_tick, active_type: expected, state_hash: result.payload.panel_snapshot.state_hash });
}
// Direct panel selection must preserve the live WASM TP pose at a non-zero
// position for every pair of IDENTITY/TCP:XYZAC/USERK transitions.
// Direct panel selection must preserve physical joints and keep the new
// coordinate pose synchronized with TP for every mode transition.
const move = send("MDI_EXECUTE", "seed-position", { block: "G0 X10 Y5 Z20 A30 C45" });
assert.equal(move.kind, "COMMAND_RESULT");
for (let cycle = 0; cycle < 1000 && session.wasmMotion.read().state.queue_depth > 0; cycle += 1) send("SIM_STEP", `seed-step-${cycle}`, { cycles: 1 });
assert.equal(session.wasmMotion.read().state.queue_depth, 0);
const directSwitches = [];
for (const expected of [0, 1, 2, 0, 1, 2, 0]) {
const physicalJoints = session.wasmMotion.read().state.joint_commanded;
const result = send("KINEMATICS_SELECT", `direct-${expected}-${seq}`, { type: expected });
assert.equal(result.kind, "COMMAND_RESULT");
assert.equal(result.payload.kinematics.active_type, expected);
const pose = result.payload.kinematics.pose;
const tpPose = result.payload.wasm_motion.state.position;
for (const axis of ["x", "y", "z", "a", "b", "c", "u", "v", "w"]) assert.ok(Math.abs(Number(pose[axis]) - Number(tpPose[axis])) <= 1e-9, `${axis}: ${pose[axis]} != ${tpPose[axis]}`);
result.payload.wasm_motion.state.joint_commanded.forEach((value, i) => assert.ok(Math.abs(value - physicalJoints[i]) < 1e-8, `switch must preserve physical joint ${i}`));
directSwitches.push({ active_type: expected, state_hash: result.payload.kinematics.state_hash });
}