-
I understand your perspective that NIST doesn't define responses, not M114 nor anything else.
What it does define is that a CNC machine is always in one of the work coordinate systems. It is literally not possible for a controller to be "in" the machine coordinate system; in particular, G53 overrides only the line on which it occurs. Therefore, a controller should never return anything but the work coordinate that represents its current position (unless explicitly marked as machine in a separate field).
And, I'd also note that M114 and M408 are in conflict with each other.
Dave, it is certainly possible for an HMI/Console to parse any response, in any pre-agreed fashion. Formally, any "Interface Contract" will work as long as it is stable. However, that does not make the response correct. M114, as seen by a human at a serial terminal, is wrong as it stands.
-
Catalin, good to hear about CNCjs. I'll look at doing a fork and a Duet/RepRap tab. As Dave pointed out, that will most likely use the M408 JSON response. (If I do it, it certainly will).
Dave: Would you have a preference regarding the "short name" of the tab in the CNCjs GUI? "Duet", "Duet3D", "RepRap", or something else?
-
M114 and M408 are not in conflict, because they don't use the same labels.
I don't plan to change how M114 behaves until I know how other CNC firmwares that support M114 behave.
-
Dave, you asked about LinuxCNC and M114 M408. It does not support any G or M command that returns a response, primarily because the displays are all "built in". The displays can be "skinned" to user preference… and almost all of those skins have the current work coordinate displayed quite large, and the machine displayed small or not at all. Example (white numbers are labeled "Current Position", aqua blue numbers "Machine Coords"):
My interpretation of this is "neutral", because the motion controller and the display are not separate, there is no "message format" to follow.
-
M114 responses, Work or Machine, by firmware:
NIST - Does not specify M114 (or any other way to solicit a coordinate position response).
NIST does document "Parameters" to read the state of the controller. NIST further documents which "Parameter" sets contain work coordinates for the various G54 and onward states (5221 onward). NIST also documents a separate parameter that selects which set is active (5220). NIST further states: It is an error for the value of parameter 5220 to be anything but a whole number between one and nine. (corresponding to G54 through G59.1).
Any hypothetical DRO/HMI/Console interfaces to the NIST controller would need to read the parameters, and it should be noted there are not parameters (documented) for absolute machine coordinates. So any hypothetical "Tell me your position" response would have to read 5220 and use it to decide with group of 5221 onward to display… put simply, it could only respond with "Work". Per NIST documentation, it is not possible to respond with anything else. Machine coordinates can only be "back calculated" from the currently active offset.
My interpretation of this is "Work" should be displayed, because it is the only thing that NIST 'externalizes'.
-
M114 responses, Work or Machine, by firmware (continued):
Marlin - N/A, does not have the concept of Work vs. Machine.
Smoothieware - M114 shows Work. M114.2 shows Machine.
Repetier - N/A does not have concept of Work vs. Machine.
GRBL - Does not support M114. ? can be set to return one of W or M. ?? returns both, and a matrix of all offsets.
TinyG - Does not support M114. JSON and/or Text responses can be configured to return Work, Machine, or both. When configured to return Work and/or Machine JSON uses POSX: and MPOX:, respectively. Text responses return a large block of text, with "X Position: nnn.nnn" on a line by itself, etc. These are work positions. A different line has the currently active coordinate systems (G54, etc).
Summary (skipping the N/A):
Smoothie: G54 Yes. M114 Yes. M114 returns work. (M114.2 returns machine).
TinyG: G54 Yes. M114 No. TinyG does have its own status and/or response formats, both text and JSON. They all return Work in the "POSX" or "X: Position" fields. They all can be configured to return machine, in fields such as MPOX:.
Even more summarized: All firmwares that do respond, always return work in the "normally named" fields, and only return machine in subset commands or fields who's names start with "M".
-
Thanks. I'll probably follow the Smoothieware format in a future firmware release.
-
Dave,
I've checked G10 L2 and L20, using M408 S1 for response, on Release 1.21 (final), combined with various G1 and G0 moves. Everything appears to behave correctly in every scenario I could think of to test (I did not do a rigorous analysis of test cases).
-
However…
Per NIST standard documentation, work offsets are supposed to be persistent, including across reboots and power cycles. In the case of Duet3D/RepRap, they are not.
In case you are wondering, persistence is an important feature for CNC machinists, because the various G55, G56, etc. are quite often used for "Fixtures" that are mounted to the CNC bed for extended periods of time (weeks or months). Having to "re-find" or "re-touch" fixtures every time the machine is reset would be quite contrary to the way people are accustomed to operating.
-
I've added this to the list of thing to look into for the next firmware version.
-
While agreeing on the advantages of persistent work offsets, I don't really miss it with Duet3D. One could write extremely simple one liners with the G10 L20 Pn codes. Having them stored as macros also simplifies usage a lot as those macros can have meaningful names, usually much better than a Post-It on the machine telling the operator that "G56 is for round fixture in right-rear corner"…
As already mentioned in the other thread (https://www.duet3d.com/forum/thread.php?id=5006) I have re-connected the Duet3D to my WorkBee and did a lot of movement tests, including a camera for finding X/Y on workpiece and a movable tool finder for Z. I simply removed all predefined macros and added three of my own that do all the tricks.
-
While agreeing on the advantages of persistent work offsets, I don't really miss it with Duet3D. One could write extremely simple one liners with the G10 L20 Pn codes. Having them stored as macros also simplifies usage a lot as those macros can have meaningful names, usually much better than a Post-It on the machine telling the operator that "G56 is for round fixture in right-rear corner"….
That works great if you are willing to transcribe coordinates into the macros. When I mount a fixture, and switch to G55 (or whatever), I then Z Probe it, and use an edge finder to touch the edges (usually the edges of the stock in the fixture, not the fixture itself).
Anyway… Once the physical part is done, I hit the "Zero Work Coordinates" button and it is now "saved". No human errors copying long numbers from the DRO to the macro.
-
What do you all think should be the mechanism for saving coordinate systems to the SD card?
(a) Automatically save them whenever they are changed. This could result excessive wear on the SD card if they are changed frequently.
(b) Save them whenever a job is paused.
(c) Save them when you ask to save them explicitly, using M500 or a similar command.
(d) Something else?
-
Option C would be best in my opinion. If a user wants the coordinate system to autosave, they can setup macros to send the command and then autosave.
-
Option C sounds best compromise to me as well!
-
Thanks, both of you. I'll add the workplace coordinate settings to the M500 saved parameters.
-
@dc42 said in CNC Coordinate Systems:
Thanks, both of you. I'll add the workplace coordinate settings to the M500 saved parameters.
Fantastic!
I did not respond quickly enough... option (c) is indeed what I would have voted.
-
@dc42 Thanks for making them changes. I have tested it out and it all works as expected.
One other thing i have noticed is that when pausing a file, and then resuming it, the machine goes back to machine coordinates and forgets which work coordinate system it was in. The way to solve this is to select the work coordinate system at the start of the resume.g file. Selecting the work system through the g-code console while in pause mode doesn't work, it has to be set in resume.g as far as i can see.
The effect of this is that the pause button can only practically be used in one coordinate system. As to use it in the others would require the resume file to be changed to select the correct one before resuming.
I am sure that before i upgraded the Duet to the latest firmware version it used to remember the work coordinate system when paused.
Ryan
-
@ryan-lock said in CNC Coordinate Systems:
One other thing i have noticed is that when pausing a file, and then resuming it, the machine goes back to machine coordinates and forgets which work coordinate system it was in. The way to solve this is to select the work coordinate system at the start of the resume.g file. Selecting the work system through the g-code console while in pause mode doesn't work, it has to be set in resume.g as far as i can see.
The effect of this is that the pause button can only practically be used in one coordinate system. As to use it in the others would require the resume file to be changed to select the correct one before resuming.
I am sure that before i upgraded the Duet to the latest firmware version it used to remember the work coordinate system when paused.
I am surprised by that, because I don't recall making any changes in that area. In fact, I expect the pause.g and resume.g files to use the current workplace coordinates, which of course means that you would probably need to use G53 before all the movement commands in those files except for any G1 R1 moves at the end of resume.g. Anyway, I'll test it before I do another 2.02RC.
PS - are you sure that you don't have any commands in pause.g that reset the coordinate offsets to zero?
-
sounds like the same problem I reported here: https://forum.duet3d.com/topic/7940/firmware-2-02rc5-now-available/7
@dc42 in RRF, when you call
resume.g
to runDoFileMacro
, there is this line:
gb.MachineState().useMachineCoordinatesSticky = true; // running a system macro e.g. homing or tool change, so don't use workplace coordinates
Not sure if thats the actual problem - but something to know about.
Related question: is pause+resume aware of "relative positioning" and "relative extrusion" and does it reset the correct state as it was before pausing? While paused the user could have changed it to move around...