Validate LinuxCNC tool length offsets
This commit is contained in:
@@ -20,6 +20,7 @@ void cnc_sim_init_minimal_linuxcnc_tooldata() {
|
|||||||
tool.toolno = 1;
|
tool.toolno = 1;
|
||||||
tool.pocketno = 1;
|
tool.pocketno = 1;
|
||||||
tool.diameter = 6.0;
|
tool.diameter = 6.0;
|
||||||
|
tool.offset.tran.z = 12.5;
|
||||||
tooldata_put(tool, 1);
|
tooldata_put(tool, 1);
|
||||||
tooldata_last_index_set(1);
|
tooldata_last_index_set(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ int main() {
|
|||||||
(event.type == CNC_SIM_EVENT_COMMENT &&
|
(event.type == CNC_SIM_EVENT_COMMENT &&
|
||||||
event.line == 2 &&
|
event.line == 2 &&
|
||||||
event.reserved == 430 &&
|
event.reserved == 430 &&
|
||||||
event.start.z == 0.0);
|
near(event.start.z, 12.5));
|
||||||
saw_tool_length_clear = saw_tool_length_clear ||
|
saw_tool_length_clear = saw_tool_length_clear ||
|
||||||
(event.type == CNC_SIM_EVENT_COMMENT &&
|
(event.type == CNC_SIM_EVENT_COMMENT &&
|
||||||
event.line == 3 &&
|
event.line == 3 &&
|
||||||
|
|||||||
@@ -188,6 +188,7 @@ This matrix tracks LinuxCNC feature coverage for the web/WASM simulator. A featu
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| Basic modal motion `G0/G1/G2/G3` | covered | `tests/gcode/linuxcnc_basic_motion.ngc`, `tests/gcode/basic_mill.ngc` |
|
| Basic modal motion `G0/G1/G2/G3` | covered | `tests/gcode/linuxcnc_basic_motion.ngc`, `tests/gcode/basic_mill.ngc` |
|
||||||
| Tool select/change `T... M6` | covered with minimal native tooldata | `tests/gcode/basic_mill.ngc` |
|
| Tool select/change `T... M6` | covered with minimal native tooldata | `tests/gcode/basic_mill.ngc` |
|
||||||
|
| Tool length offset `G43/G49` | covered with nonzero tool-table offset through LinuxCNC native/source backends | `tests/gcode/linuxcnc_tool_length.ngc` |
|
||||||
| RTCP controls `G43.4/G43.5/G49` | covered as simulator-owned control lines | `tests/gcode/linuxcnc_rtcp_controls.ngc` |
|
| RTCP controls `G43.4/G43.5/G49` | covered as simulator-owned control lines | `tests/gcode/linuxcnc_rtcp_controls.ngc` |
|
||||||
| Kinematics switch `M428/M429/M430` | covered as simulator-owned control lines | `tests/gcode/linuxcnc_rtcp_controls.ngc` |
|
| Kinematics switch `M428/M429/M430` | covered as simulator-owned control lines | `tests/gcode/linuxcnc_rtcp_controls.ngc` |
|
||||||
| Canned cycle `G81/G80` | covered for drilling expand-to-canon path | `tests/gcode/linuxcnc_canned_cycle.ngc` |
|
| Canned cycle `G81/G80` | covered for drilling expand-to-canon path | `tests/gcode/linuxcnc_canned_cycle.ngc` |
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ if not any(
|
|||||||
event["type"] == "comment" and
|
event["type"] == "comment" and
|
||||||
event["line"] == 2 and
|
event["line"] == 2 and
|
||||||
event["reserved"] == 430 and
|
event["reserved"] == 430 and
|
||||||
event["start"]["z"] == 0
|
event["start"]["z"] == 12.5
|
||||||
for event in tool_length
|
for event in tool_length
|
||||||
):
|
):
|
||||||
raise SystemExit("missing G43 H1 tool length offset event")
|
raise SystemExit("missing G43 H1 tool length offset event")
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ CNC_SIM_RS274_VAR="$var_file" \
|
|||||||
CNC_SIM_RS274_VAR="$var_file" \
|
CNC_SIM_RS274_VAR="$var_file" \
|
||||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_rtcp_controls.ngc \
|
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_rtcp_controls.ngc \
|
||||||
>/tmp/cnc_sim_linuxcnc_source_rtcp_controls.json
|
>/tmp/cnc_sim_linuxcnc_source_rtcp_controls.json
|
||||||
|
CNC_SIM_RS274_VAR="$var_file" \
|
||||||
|
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_tool_length.ngc \
|
||||||
|
>/tmp/cnc_sim_linuxcnc_source_tool_length.json
|
||||||
CNC_SIM_RS274_VAR="$var_file" \
|
CNC_SIM_RS274_VAR="$var_file" \
|
||||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_canned_cycle.ngc \
|
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_canned_cycle.ngc \
|
||||||
>/tmp/cnc_sim_linuxcnc_source_canned_cycle.json
|
>/tmp/cnc_sim_linuxcnc_source_canned_cycle.json
|
||||||
@@ -147,6 +150,24 @@ rtcp = [event for event in controls if event["type"] == "rtcp-state"]
|
|||||||
if [(event["line"], event["tool"], event["feed"]) for event in rtcp] != [(3, 0, 0), (4, 7, 1)]:
|
if [(event["line"], event["tool"], event["feed"]) for event in rtcp] != [(3, 0, 0), (4, 7, 1)]:
|
||||||
raise SystemExit("unexpected source-linked RTCP state sequence")
|
raise SystemExit("unexpected source-linked RTCP state sequence")
|
||||||
|
|
||||||
|
tool_length = json.loads(Path("/tmp/cnc_sim_linuxcnc_source_tool_length.json").read_text())
|
||||||
|
if not any(
|
||||||
|
event["type"] == "comment" and
|
||||||
|
event["line"] == 2 and
|
||||||
|
event["reserved"] == 430 and
|
||||||
|
event["start"]["z"] == 12.5
|
||||||
|
for event in tool_length
|
||||||
|
):
|
||||||
|
raise SystemExit("missing source-linked G43 H1 tool length offset event")
|
||||||
|
if not any(
|
||||||
|
event["type"] == "comment" and
|
||||||
|
event["line"] == 3 and
|
||||||
|
event["reserved"] == 430 and
|
||||||
|
event["start"]["z"] == 0
|
||||||
|
for event in tool_length
|
||||||
|
):
|
||||||
|
raise SystemExit("missing source-linked G49 tool length clear event")
|
||||||
|
|
||||||
cycle = json.loads(Path("/tmp/cnc_sim_linuxcnc_source_canned_cycle.json").read_text())
|
cycle = json.loads(Path("/tmp/cnc_sim_linuxcnc_source_canned_cycle.json").read_text())
|
||||||
motions = [event for event in cycle if event["type"] in {"rapid", "linear-feed"}]
|
motions = [event for event in cycle if event["type"] in {"rapid", "linear-feed"}]
|
||||||
expected_cycle = [
|
expected_cycle = [
|
||||||
@@ -249,6 +270,7 @@ PY
|
|||||||
echo "linuxcnc rs274 source link smoke passed (${#objects[@]} local objects)"
|
echo "linuxcnc rs274 source link smoke passed (${#objects[@]} local objects)"
|
||||||
echo "dumped /tmp/cnc_sim_linuxcnc_source_basic_mill.json"
|
echo "dumped /tmp/cnc_sim_linuxcnc_source_basic_mill.json"
|
||||||
echo "dumped /tmp/cnc_sim_linuxcnc_source_rtcp_controls.json"
|
echo "dumped /tmp/cnc_sim_linuxcnc_source_rtcp_controls.json"
|
||||||
|
echo "dumped /tmp/cnc_sim_linuxcnc_source_tool_length.json"
|
||||||
echo "dumped /tmp/cnc_sim_linuxcnc_source_canned_cycle.json"
|
echo "dumped /tmp/cnc_sim_linuxcnc_source_canned_cycle.json"
|
||||||
echo "dumped /tmp/cnc_sim_linuxcnc_source_canned_cycles_extended.json"
|
echo "dumped /tmp/cnc_sim_linuxcnc_source_canned_cycles_extended.json"
|
||||||
echo "dumped /tmp/cnc_sim_linuxcnc_source_cutter_comp.json"
|
echo "dumped /tmp/cnc_sim_linuxcnc_source_cutter_comp.json"
|
||||||
|
|||||||
Reference in New Issue
Block a user