Thing-O-Matic: Broken G91 Relative Motion

It would be handy, while doing the fast / coarse home stuff, to switch to G91 relative positioning mode and back off the switches by 2 mm by using a simple G0 X2 Y2 Z-2 that doesn’t depend on knowing the exact coordinates of the endpoint, but it seems relative positioning doesn’t work for any but the most trivial cases.

After some fiddling, this short routine produces a very fast, very long, fully coordinated XY move to some position in the +X +Y direction at the G1 X2 F100 command after the G91 command sets relative motions; it should move 2 mm away from the X switch. When the machine arrives at the new (unexpected) position, it then does the expected slow 2 mm Y and Z moves:

G21 (set units to mm)
G90 (set positioning to absolute)
(- coarse home axes)
G162 Z F1000 (home Z to get nozzle out of danger zone)
G161 Y F4000 (retract Y to get X out of front opening)
G161 X F4000 (now safe to home X)
(- back off switches)
G1 X2 F100
G1 Y2 F100
G1 Z-2 F100

I gave up and used an absolute move with hardcoded XYZ coordinates that should be pretty close to the stored values.

There’s a RepG ticket for that.

Obviously, I’m going where no other Thing-O-Matic operator has gone before. I do that a lot, don’t I?


  1. #1 by engunneer on 2011-07-14 - 13:11

    Did you try putting the g91 on the same line as the g1?

    Not near my machine now, but might be a workaround. I use a few relative moves at my end of print, but all absolute at the start (even with no home switches)

    • #2 by Ed on 2011-07-14 - 17:14

      g91 on the same line as the g1?

      G91 is modal (well, in all other G-Code dialects), so all subsequent moves use relative coordinates until you switch back to absolute mode with a G90.

      As it turns out, I just discovered that homing also screws up absolute moves: I’m getting uncommanded Z motion for G0 X0 after retracting the Z stage using a G162. That worked in RepG 24, so I think RepG 25’s code refactoring may have been somewhat under-tested.

  1. OpenSCAD vs. Skeinforge 40: Bogus G-Code « The Smell of Molten Projects in the Morning