Extend simulation runtime coverage and kinematics support

This commit is contained in:
2026-08-21 10:57:10 +08:00
parent 554b72dae8
commit 2ef2d82db3
71 changed files with 24232 additions and 1867 deletions

View File

@@ -43,14 +43,19 @@ def generate(root: Path, output: Path) -> dict[str, object]:
wasm_all = run_json(["node", str(root / "build-wasm/sim_kinematics_wasm_test.js")], root)
native = {"pentapod": native_all["pentapod"], "boundaries": native_all["delta_edges"]["pentapod"]}
wasm = {"pentapod": wasm_all["pentapod"], "boundaries": wasm_all["delta_edges"]["pentapod"]}
config_text = (root / INPUTS["config"]).read_text(encoding="utf-8")
report = {
"schema": "pentapod-kinematics-report.v1", "status": "partial", "implementation_status": "verified",
"source_records": {name: {"path": path, "sha256": sha256(root / path)} for name, path in INPUTS.items()},
"configuration_candidate": {"path": INPUTS["config"], "kinematics": "pentakins", "joints": 5, "coordinates": "XYZAB", "scan": "KINEMATICS = pentakins" in (root / INPUTS["config"]).read_text(encoding="utf-8"), "hal_geometry": parse_hal(root / INPUTS["hal"]), "hal_pins": ["last-iterations", "max-iterations", "limit-iterations", "max-error", "convergence-criterion", "tool-offset"]},
"geometry": {"struts": 5, "orientation": "roll/pitch only; yaw fixed at zero", "units": "configuration units; XYZ linear and AB degrees"},
"configuration_candidate": {"path": INPUTS["config"], "kinematics": "pentakins", "joints": 5, "coordinates": "XYZAB", "scan": "KINEMATICS = pentakins" in config_text and "JOINTS = 5" in config_text, "provenance": "shipped LinuxCNC simulation", "hal_geometry": parse_hal(root / INPUTS["hal"]), "hal_pins": ["last-iterations", "max-iterations", "limit-iterations", "max-error", "convergence-criterion", "tool-offset"]},
"configuration_candidates": [
{"id": "shipped-pentapod", "path": INPUTS["config"], "kind": "real", "coordinates": "XYZAB", "joints": 5},
{"id": "offset-seed-regression", "path": "wasm-core/tests/sim_kinematics_test.c", "kind": "derived", "coordinates": "XYZAB", "joints": 5, "initial_pose": [0.0, 500.0, 300.0, 0.0, 0.0], "target_pose": [0.0, 500.0, 300.0, 0.01, -0.01], "purpose": "non-zero roll/pitch Newton convergence and native/WASM comparison"},
],
"geometry": {"struts": 5, "orientation": "roll/pitch only; yaw is constrained to zero in the forward result", "units": "configuration units; XYZ linear and AB degrees", "tool_offset": "applied to both base and effector HAL z coordinates"},
"mapping": {"coordinates": "XYZAB", "kinematics_joint_count": 5, "joint_semantics": ["strut-0", "strut-1", "strut-2", "strut-3", "strut-4"], "extra_joint_policy": "rejected"},
"solver": {"inverse": "closed-form radial/z strut lengths", "forward": "Newton-Raphson 5x5 numerical Jacobian", "seed": [0.0, 500.0, 300.0, 0.0, 0.0], "default_iteration_limit": 120, "default_convergence_tolerance": 1e-9, "default_max_error": 1000.0, "alternate_seed_flag": "SIM_KIN_GENHEX_ALTERNATE_SEED bit 1; negative-z seed is explicitly bounded"},
"workspace_and_boundaries": {"nominal": native["pentapod"], "alternate_seed": native["boundaries"]["alternate_pose"], "alternate_seed_error": native["boundaries"]["alternate_status"], "nonpositive_joint_error": native["boundaries"]["nonpositive"], "iteration_limit_error": native["boundaries"]["iteration_limit"], "max_error_boundary": native["boundaries"]["max_error"], "singular_jacobian_error": native["boundaries"]["singular"], "joint_limit_error": native["boundaries"]["limit_error"], "iterations": native["pentapod"]["iterations"], "residual": native["pentapod"]["residual"]},
"solver": {"inverse": "closed-form radial/z strut lengths", "forward": "Newton-Raphson 5x5 numerical Jacobian", "seed": [0.0, 500.0, 300.0, 0.0, 0.0], "seed_units": "XYZ in configuration units; A/B in radians internally", "default_iteration_limit": 120, "default_convergence_tolerance": 1e-9, "default_max_error": 1000.0, "alternate_seed_flag": "SIM_KIN_GENHEX_ALTERNATE_SEED bit 1; negative-z seed is explicitly bounded"},
"workspace_and_boundaries": {"nominal": native["pentapod"], "alternate_seed": native["boundaries"]["alternate_pose"], "alternate_seed_error": native["boundaries"]["alternate_status"], "alternate_seed_iterations": native["boundaries"].get("alternate_iterations", 0), "nonpositive_joint_error": native["boundaries"]["nonpositive"], "nonpositive_joint_iterations": native["boundaries"].get("nonpositive_iterations", 0), "iteration_limit_error": native["boundaries"]["iteration_limit"], "iteration_limit_iterations": native["boundaries"].get("iteration_limit_iterations", 0), "max_error_boundary": native["boundaries"]["max_error"], "max_error_iterations": native["boundaries"].get("max_error_iterations", 0), "singular_jacobian_error": native["boundaries"]["singular"], "singular_jacobian_iterations": native["boundaries"].get("singular_iterations", 0), "joint_limit_error": native["boundaries"]["limit_error"], "posture_constraint": "C/yaw is not a configured joint and forward output is exactly zero", "iterations": native["pentapod"]["iterations"], "residual": native["pentapod"]["residual"]},
"samples": {"native": native, "wasm": wasm, "byte_identical_json": json.dumps(native, sort_keys=True, separators=(",", ":")) == json.dumps(wasm, sort_keys=True, separators=(",", ":")), "state_hash_identical": native["pentapod"]["state_hash"] == wasm["pentapod"]["state_hash"]},
"native_wasm": {"status": "passed", "native_command": "build-native/sim_kinematics_test", "wasm_command": "node build-wasm/sim_kinematics_wasm_test.js"},
"oracle": {"status": "blocked", "reason": "linuxcnc/unit_tests/kinematics is absent from the locked source", "blocked_samples": ["nominal five-strut pose", "negative-z seed", "nonpositive strut", "iteration limit", "maximum error", "singular Jacobian", "joint limit"]},