Possible Bug in G-code Interpreter
Posted: Wed Feb 03, 2021 11:55 am
Hello,
I report a possible bug in g-code interpreter in 4.35b (no mention found in next test releases).
I'll try to explain at my best:
during simulation of g-code I noticed that, if you have tools with different length offset (as usual, but I noticed in a case with big differences between tools), the interpreter fails to correct address Z coordinate if, after a tool change, we make a simple in-plane move before involving Z axis in any motion.
Let's make an example: suppose we have T5 with 100mm length and then T6 with 200mm length (just to better view the difference)
T5 M6 G43 H5
.....
G0 Z5
T6 M6 G43 H6
G0 X10 Y10 Z5
In this case everything is correct. But if I want to make first in-plane move a then Z move like this:
....
T6 M6 G43 H6
G0 X10 Y10
Z5
you will see, in G-viewer, that the tool will drop down in Z of the selected tool length and then, when interpreter executes (G0) Z5, it is restored at correct coordinate.
Looking under the skin, it is a normal behavious of the interpreter, because the G43 Hxx processing only updates the current_z of the interpreter and the find_ends function will only take into account possible deviation from current position due to tool radius compensation (just x and Y) but not in Z: in practice if there is not an explicit Z param in G0 line, the interpreter is stuck to current_z value that is correctly updated with tool length offset, but not in synch with programmed position if no explicit Z is given in G0. So I think it is perfectly normal that behaves like this.
Fortunately, in real life, we have to resynch position after a tool change, and this will cover the bug with respect to aactual axis motion. But it leads to a wrong visualization of the tool path and possible issues during operation (i.e. if position after tool change is not to be synch for any reason) .
I hope my explanation is clear
Best regards
Giancarlo
I report a possible bug in g-code interpreter in 4.35b (no mention found in next test releases).
I'll try to explain at my best:
during simulation of g-code I noticed that, if you have tools with different length offset (as usual, but I noticed in a case with big differences between tools), the interpreter fails to correct address Z coordinate if, after a tool change, we make a simple in-plane move before involving Z axis in any motion.
Let's make an example: suppose we have T5 with 100mm length and then T6 with 200mm length (just to better view the difference)
T5 M6 G43 H5
.....
G0 Z5
T6 M6 G43 H6
G0 X10 Y10 Z5
In this case everything is correct. But if I want to make first in-plane move a then Z move like this:
....
T6 M6 G43 H6
G0 X10 Y10
Z5
you will see, in G-viewer, that the tool will drop down in Z of the selected tool length and then, when interpreter executes (G0) Z5, it is restored at correct coordinate.
Looking under the skin, it is a normal behavious of the interpreter, because the G43 Hxx processing only updates the current_z of the interpreter and the find_ends function will only take into account possible deviation from current position due to tool radius compensation (just x and Y) but not in Z: in practice if there is not an explicit Z param in G0 line, the interpreter is stuck to current_z value that is correctly updated with tool length offset, but not in synch with programmed position if no explicit Z is given in G0. So I think it is perfectly normal that behaves like this.
Fortunately, in real life, we have to resynch position after a tool change, and this will cover the bug with respect to aactual axis motion. But it leads to a wrong visualization of the tool path and possible issues during operation (i.e. if position after tool change is not to be synch for any reason) .
I hope my explanation is clear
Best regards
Giancarlo