Marlin Coordinate systems?

Greetings All,

Does anyone know if Marlin has multiple coordinate systems? It seems that everything is done in Machine coordinates.

The Marlin documentation does not mention G54, G55, G56 … G59 which is where coordinate systems are usually selected.

It seems a lot of CNC functionality is missing from Marlin and some commands like G10 (normally for setting parameters) have been re-purposed to do other things.

Is Marlin ever going to have multiple coordinate systems?

Is there a way to set a work offset? I want to flip parts made in Fusion 360.

Thanks

Marlin has g54-g59, but you have to uncomment define (CNC coordinate systems). I guess Ryan enabled it in latest update

You may try to use it this way:

Use g54 as machine coordinate system. Then move to required offset, switch to g55 (as example) and then perform g92 x0 y0 z0. So 55 coordinate system will have the offset.

I didn’t try that, but i saw marlin sources. I think it should work

1 Like

Marlin is based off of grbl, and a lot has changed to support 3D printers. It’s only now that it’s getting back some of the CNC functionality it had removwd. I’m not sure what “normal” you’re referring to, since grbl doesn’t use G10 either. Marlin uses gcodes for each setting so M92 is used to querry and set the steps per mm. Also look up M500-M503. They are used to clear, load, store, and read all the eeprom settings.

Give it a chance. It’s really very good firmware and it works on very good and cheap hardware. By the way, it’s totally free and open source. So feel free to change it if you want.

1 Like

Thanks! You guys rock!

#define CNC_COORDINATE_SYSTEMS is located in Configuration_adv.h and indeed it has been commented out!

Yeah Marlin is pretty great really. I was missing coordinate systems and looking at this list http://marlinfw.org/meta/gcode/ there is no mention of G54-G59. This document also seems a little short on examples and expalnations fo some of the G-code. But if I can use coordinate systems that’s great.

Also Marlin doesn’t have the commands that are used in GRBL G10 and the commands are demonstrated in this video https://www.youtube.com/watch?v=fGtbkVJBXyE He uses G10 L20 P0 X0 Y0 Z0 to set the currently selected coordinate system to absolute values. But in Marlin, G10 is Retract… Anyway, if we can use G92 as a workaround, then i’m sure that will be fine!

Thanks for your help Guffy and Jeff

i forgot to say that it seems marlin also support g53. so
G53 G1 X10 Y10 Z10
will move to 10\10\10 in machine coordinates and ignore offsets of current coordinate systems

The new firmware has that enabled for a couple revisions.

There are a few was to accomplish the same thing, if you can find something that does not refer to GRBL you would be much better off. Marlin’s interpretation of Gcode is really trying hard to follow all the industry standards, and keeps getting closer with each update, but does not try to match anything with GRBL commands.

Guys, I uncommented the line, but I get “G55 unknown command” in the serial monitor when I run test G Code containing G55. So does it actually work?

[attachment file=“79951”]
[attachment file=“79950”]

 

Here’s the testing code I ran:

 

;Testing to see that machine limits are still respected even when using a different coordinate system

;Basic Procedure:
; 1) home x and y to set machine coordinates
; 2) move x by 1mm
; 3) change coordinate systems to G55
; 4) set the new home for G55
; 5) attempt to move X to the machine limit - this test should fail because we are already 1mm from the lower limit, thus we can no longer go to upper limit.

;set machine units to mm
G21

;switch to absolute positioning
G90

; Switch to Coordinate System 1
G54

;home x and y to set machine coordinates
G28 X Y

;move x by 1mm
G0 X1 F10 ;going super slow for fun

;change coordinate systems to G55
G55 ;Select coord system 2

;set the new XY home for G55
G92 X0 Y0

;attempt to move X to the machine limit - this test should fail because we are already 1mm from the lower limit, thus we can no longer go to upper limit. If it does actually move there, it shouldn’t break the machine only moving 1mm extra…

;X limit is 890mm so we move 885 quickly then to 890mm super slowly
G0 X889 F500
G0 X890 F15

;Results
;After running this test
;Serial port reported that G55 is an unknown command!
;Limit was respected.

Guys, I uncommented the line, but I get “G55 unknown command” in the serial monitor when I run test G Code containing G55. So does it actually work?

[attachment file=79958]
[attachment file=79959]

I also tested sending G53, G54, G56, G56 X10 Y10 but none of these commands were recognised by Marlin 2.0.x bugfix

Here’s the testing code I ran:

;Testing to see that machine limits are still respected even when using a different coordinate system

;Basic Procedure:
; 1) home x and y to set machine coordinates
; 2) move x by 1mm
; 3) change coordinate systems to G55
; 4) set the new home for G55
; 5) attempt to move X to the machine limit - this test should fail because we are already 1mm from the lower limit, thus we can no longer go to upper limit.

;set machine units to mm
G21

;switch to absolute positioning
G90

; Switch to Coordinate System 1
G54

;home x and y to set machine coordinates
G28 X Y

;move x by 1mm
G0 X1 F10 ;going super slow for fun

;change coordinate systems to G55
G55 ;Select coord system 2

;set the new XY home for G55
G92 X0 Y0

;attempt to move X to the machine limit - this test should fail because we are already 1mm from the lower limit, thus we can no longer go to upper limit. If it does actually move there, it shouldn’t break the machine only moving 1mm extra…

;X limit is 890mm so we move 885 quickly then to 890mm super slowly
G0 X889 F500
G0 X890 F15

;Results
;After running this test
;Serial port reported that G55 is an unknown command!
;Limit was respected.

Maybe it is a pronterface thing, try repetier or straight from an SD to verify. I am pretty sure a few others are using it.

The G-code file was on an SD card and in that test Pronterface was only listening to the serial port (I could have read those error messages with Arduino’s serial monitor too). Also note though: unless you listen on the serial port with a serial monitor, you would never get those errors - they are never reported on the LCD.

Still, I’ll try this Repetier if it’s free.

Has anyone actually used CNC coordinate systems (G54-G59.3) in Marlin?

 

Maybe you can tell me what you are trying to actually do and I can give you an alternative way to do it.

I have no idea if those codes work 100% or not, no one ever even wanted them until a few weeks ago and I can’t see why they would help anything to be easier. CAM is sooooo much easier than it used to be, and machines are cheaper. I literally just insert work offsets into my CAM. If you know your offset why not just draw a bounding box in your part, or CAM? Work offsets only seem useful if you have one giant quarter million dollar machine with a vise that has been meticulously dialed in and a tombstone on the other end of the bed, even then, why not just use a probe?

Thanks Ryan,

I just wanted to create work offsets so I can home X and Y and flip my part. I thought that G54 etc was the way to go.

Now since G54 etc is not recognised, I have given up on using them for now. I solved the problem by doing something similar to you, I think. In Fusion 360, I draw a rectangle that represents my machine’s work area. I create a center line for my part and use CAM to drill a hole at each end. I make sure the holes line up with the grid of holes on the machine (5cm apart). Then when I flip the part I locate it and fix it with the two holes. This works fine and is less confusing than using coordinate systems.

Still, I would like to master coordinate systems just for the sake of getting familiar with machining techniques.

Next I’m going to try to get laser cutting working. :slight_smile:

Yes exactly. Coordinate systems, like I said. in this day and age of simple CAD/CAM I really do not see the need unless you have a fixture/jig table in a production environment, no other reason makes sense to me.

Support of work coordinate system probably could be handy for perform a tool changing in machine coordinates. I dont know yet is it possible, but i will try.

As example, a job with current tool changing code based on g0 x0 y0 z50 and then g28 z looks really ugly in cncjs preview.

But of course works perfectly if you run it just from sd card with lcd.

I was wanting this functionality for a certain thing I’m working on with MPCNC, and I can confirm it is not working (“Unknown command”), even with CNC_COORDINATE_SYSTEMS defined (which it is by default in Ryan’s fork).

I went digging in the code and it appears to be only missing the parsing commands in gcode.cpp. I tried submitting a pull request against Marlin bugfix-2.0.x but I am a newbie when it comes to GitHub workflow. So even though the code appears to work, there is a decent chance I might have messed up the submission.

Anyway the patch is fairly simple and if anyone is interested it’s available through the PR: https://github.com/MarlinFirmware/Marlin/pull/13654

Hopefully this helps someone.

Interesting, Seems half finished and you had to fill in the important part.

From my very limited experience with Marlin, as long as you based that off of the current bugfix branch I will get merged. Thanks for fixing it!

i had already made same fix a month ago (just didn’t find a time to make pull request) and tested commands.
it seems g54-g59 works well.
but g53 looks like still broken. i didn’t spent time to find a reason.

I could not tell if G53 was working or not. It appeared it was not working but I did not look closely (and I’m not confident in my expectations for what it should be doing). I could easily believe that G53 is still broken.

All I tried was G54 and G55 together with jogs and G92 and M114 and it looked like the workspace coordinates were being respected, but it was just a few minutes of testing.

If upstream Marlin accepts it, then it should propagate and we should be good officially. If not, then anyone who truly needs G54-G59 (which is almost nobody) can still patch their own copy with 11 lines of code.

I hope it’s not so bad.

Two workspaces can be useful to perform tool changing aside of a stock. That’s can be handy for a case when stock too tall so you just haven’t enough space on top of it to take off the bit from the collet. Another case is when you have to change tools during a 3d job and top side just became not flat.

Also workspace could be handy together with g38 with X or Y probing - to find zero point of a stock.

I am in agreement with you Guffy. I’m wanting to experiment in the direction you’re describing, with probing in X and Y and Z and deterministic tool changes.

I am not a machinist but I gather that for serious CNC machining, work offsets are indispensable. At the same time, I also gather that the typical MPCNC use case is more informal, hence not much demand.

The good news is that MPCNC is so easily moddable, we can have it both ways. Nevermind if anyone else cares about work offsets.