-
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...
-
Thanks @resam, that explains it. I now remember making that change so that homing wouldn't be messed up by workplace coordinates.
-
To fix it, I think I could change it so as not to apply that sticky G53 in the case of running resume.g. That would mean that if resume.g does any moves apart from ones to restore the original position (e.g. wiping the nozzle on a FDM printer), they would need to be prefixed by G53. Does that sound a reasonable solution?
-
An alternative would be to record all restore point coordinates in machine coordinates, and to use machine coordinates always when the R parameter is used on a G1 command.
In answer to your other question, whenever a macro file is run the relative/absolute movement and extrusion states are remembered at the start and restored at the end.
-
-
I don't really know what G53 and G54 do - and I don't think I want to bother with them in a 3d-printing task (I guess I can only speak for 3d-printing use cases, as I don't run CNC-style jobs). Most people I believe already have difficulties with G90/G91.
In my case, I just want to move the head to to a parking position during pause, and move back to the last position on resume.
I wasn't even aware that RRF already provides this hard-coded - I assumed it has to be specified in
resume.g
- thats also what the examples did, so I copied it. I will try to remove myG1 R1 ...
commands from myresume.g
at let the firmware do it. -
This is getting complicated. Currently there is an inconsistency in how tool offsets, workplace coordinate offsets (which includes M206 offsets) and Z-hop offsets are applied to restore points. So I'm trying to find a unified scheme for handling restore point coordinates.
What I think is required is:
-
When moving to a restore point (using the G1 R parameter), tool offsets are taken into account. This means you can create a restore point, switch tool, then send the new tool to the same point even if it has a different offset. This is needed e.g. when switching between extruders on a dual extruder FDM printer.
-
When moving to a restore point at the end of resume.g, the same workplace coordinate offsets that were in effect when the restore point was created should be applied, even though workplace coordinates are not normally applied when running resume.g.
-
So this begs the question: suppose you create a restore point (G60), do something, change to a different workplate coordinate system or change the offsets of the current one, then use G1 R1 to go back to the restore point. Should it go to the same machine position as before, assuming that there has been no change to the tool offset? Or should it go to the same user position, which will be a different machine position if the workplace coordinate offsets have changed?
The NIST standard doesn't define G60, so no help there.
Currently I am considering storing the user coordinates offset by the current workplace offsets in the restore point. This would mean that in case#3, the point in space that the tool moves back to would be unaffected by changes to the workplace coordinate system since the restore point was created. I think that's safe and sensible, although it would preclude the use of a restore point to save position, change workplace coordinates as part of a step-and-repeat operation, and then use G1 R1 to move to the corresponding position in the new coordinate system.
-
-
I believe the answer to all scenarios is "consider the control point":
The control point is the "tip" of the tool. All work coordinate offsets, too lengths, etc, contribute to that.
There are ONLY two exceptions, that I'm aware of:
-
Hardware home. This ignores the control point and offsets completely. Axis "hit" something (switch, stall, etc). Control point literally "n/a" during this operation.
-
Tool change. For pragmatic reasons of "tool holders", it also ignores many types of offset. Note that the NIST standard is very unclear about how this really works, but many big CNC makers are quite clear in their documentation: No offsets active.
Those two cases aside, EVERYTHING should result in putting the "Control Point" in the "correct" position.
I realize that's a very 'soft' description... but... with some thought applied to it, it does seem to be a very useful way to validate or invalidate scenarios.
-