G30 during G28 issue
-
@dc42 said in G30 during G28 issue:
For example: suppose you home the printer, then send G1 X150 Y150. Ignore any error that this point. Then send G30 zero or more times; then send G1 X160 Y160. Does the head position at this point (relative to where the head was after the G1 X150 Y150) depend on how many times you sent G30?
First I'll go
X120 Y120
without probing the Z.User X position is: 120.000 Machine X position is: 119.997 User Y position is: 120.000 Machine Y position is: 120.000
And the results:
Probe #1 User X position is: 119.147 Machine X position is: 119.147 User Y position is: 120.000 Machine Y position is: 120.000 Probe #2 User X position is: 119.147 Machine X position is: 119.147 User Y position is: 120.000 Machine Y position is: 120.000 Probe #3 User X position is: 117.447 Machine X position is: 117.447 User Y position is: 120.000 Machine Y position is: 120.000 Probe #4 User X position is: 116.597 Machine X position is: 116.597 User Y position is: 120.000 Machine Y position is: 120.000 Probe #5 User X position is: 115.747 Machine X position is: 115.747 User Y position is: 120.000 Machine Y position is: 120.000
You're right. Repeating
G30
without moving the toolhead, actually is altering the coordinatesRepeating the same procedure, this time at X160 Y160 without rehoming
User X position is: 160.000 Machine X position is: 159.996 User Y position is: 160.000 Machine Y position is: 159.988
And the results:
Probe #1 User X position is: 158.896 Machine X position is: 158.896 User Y position is: 159.988 Machine Y position is: 159.988 Probe #2 User X position is: 157.796 Machine X position is: 157.796 User Y position is: 159.988 Machine Y position is: 159.988 Probe #3 User X position is: 156.696 Machine X position is: 156.696 User Y position is: 159.988 Machine Y position is: 159.988 Probe #4 User X position is: 155.596 Machine X position is: 155.596 User Y position is: 159.988 Machine Y position is: 159.988 Probe #5 User X position is: 154.496 Machine X position is: 154.496 User Y position is: 159.988 Machine Y position is: 159.988
Now,
G1 X0 Y0
goes to X4 Y0 (correct offsets)
G92 X0 Y0
goes to X4 Y0
G1 H4 X-50
And the resultUser X position is: -24.837 Machine X position is: -24.837 User Y position is: 0.00 Machine Y position is: 0.00
Well.. wow.. this is the biggest shift so far
-
Just FYI - G92 is not a movement command, it merely sets the current axis position to whatever value present.
So G92 X123 Y456 sets the logical X position to 123 and the logical Y position to 456.
Frederick
-
@fcwilt Yes. In this case I only used G92 to measure the distance between logical and physical positions
Hmm.. I did it wrong?
I'm referring to G1 H4 command. It was better to measure from let's say X80 to the endstop? -
@Leonard03 said in G30 during G28 issue:
I'm referring to G1 H4 command. It was better to measure from let's say X80 to the endstop?
I'm not sure what you mean by "measure".
Frederick
-
@fcwilt Since every G30 command alters the X coordinate without physically moving the stepper, after the initial homing, I don't know where the toolhead is.
By setting its physical position to X0 Y0, using G92, I can measure the distance between the reported and actual positions relative to endstop.
Let's say I move the nozzle to X80 and perform 10 probes at that point; the reported coordinate is no longer X80, regardless of the actual physical position. If I set that position as the zero position and perform a G1 H4 move toward the endstop, the reported X position afterward is the offset amount. I want to obtain that value from a theoretical zero point.
Normally, if I move to X80 and return by pressing the endstop blade, the actual and reported coordinates should be close (accounting for endstop accuracy), but currently, they are not. I do this out of curiosity to see "how much."
Hope this make sense -
@Leonard03 said in G30 during G28 issue:
M556 S100 X0.69
I just noticed you have axis skew compensation enabled in your config.g. Can you try with this disabled?
Ian
-
@droftarts Sure, why not
Starting with this:Axis compensations - XY: 0.00000, YZ: 0.00000, ZX: 0.00000
G28 X Y Z
, again, using individual homing files, noG30
involved for now.
Axis positions:User X position is: 4.000 Machine X position is: 4.000 User Y position is: -2.000 Machine Y position is: -2.000
Move to
G1 X120 Y120
Probe #1 User X position is: 120.000 Machine X position is: 120.000 User Y position is: 120.000 Machine Y position is: 120.000 Probe #2 User X position is: 120.000 Machine X position is: 120.000 User Y position is: 120.000 Machine Y position is: 120.000 Probe #3 User X position is: 120.000 Machine X position is: 120.000 User Y position is: 120.000 Machine Y position is: 120.000 Probe #4 User X position is: 120.000 Machine X position is: 120.000 User Y position is: 120.000 Machine Y position is: 120.000
Well.. this is something in the right direction
Now,G1 X160 Y160
Probe #1 User X position is: 160.000 Machine X position is: 160.000 User Y position is: 160.000 Machine Y position is: 160.000 Probe #2 User X position is: 160.000 Machine X position is: 160.000 User Y position is: 160.000 Machine Y position is: 160.000 Probe #3 User X position is: 160.000 Machine X position is: 160.000 User Y position is: 160.000 Machine Y position is: 160.000 Probe #4 User X position is: 160.000 Machine X position is: 160.000 User Y position is: 160.000 Machine Y position is: 160.000
From X160 Y160, going to X0 Y0
User X position is: 4.000 Machine X position is: 4.000 User Y position is: 0.00 Machine Y position is: 0.00
And the toolhead parked against the endstop blade! As it should
So @droftarts, you are right. Skew compensation is involved in this
Update:homeall.g
works as expected without the skew compensation -
@Leonard03 Okay, thanks for testing! I'll highlight this to @dc42, hopefully it gives him something to focus on fixing.
I guess a follow up question is: do you need skew compensation enabled?
Ian
-
@droftarts Thank you
@droftarts said in G30 during G28 issue:
I guess a follow up question is: do you need skew compensation enabled?
This a very good question. I can answer with a maybe. But since in normal operation I don't encounter this bug, I think I leave skew compensation enabled for now.
Only time when this bug presents itself (and how I discovered it) is after "Resume after power loss". In that case I can rehome only the X and Y (Z axis remains enabled) without the probe. This gives a pretty substantial layer shift in the printed model after resume.As a background: I use UPS and a mains power feedback thru a phone charger, a relay powered by the charger and two of the switching contacts of the relay connected to the
duex.e3stop
This way, if power is out, I stop the print, disable nozzle heater, X and Y (and the UVW) but keep the bed up to temperature and Z steppers active as long as the UPS can provide power (about an hour). If the mains power comes back, I callM916
to do the resume. At this stage problems with this occurred. -
@Leonard03 can you confirm that if you disable skew compensation, the original problem that occurred during homing no longer occurs?
-
@dc42 I'm pretty sure he did:
@Leonard03 said in G30 during G28 issue:
And the toolhead parked against the endstop blade! As it should
So @droftarts, you are right. Skew compensation is involved in this
Update: homeall.g works as expected without the skew compensationIan
-
@dc42 @droftarts yes, I can confirm. Without skew compensation enabled the issue is solved
-
@Leonard03 thanks.
I found a bug that may account for this issue. Please try the new firmware build at https://www.dropbox.com/scl/fo/dumsdufoej44q97ek9joo/AIBRnU-wtKfMrbWPzZwH_XY?rlkey=idmyinvvcuiwmycbb1l2obz38&dl=0.
-
undefined gloomyandy referenced this topic
-
@dc42 Thank you very much. I tested the new binary.
The issue is still there, but is way better.
Now, if I resume a print, the shift in X- direction got smaller - from 10mm to ~2mm. Not quite there, but much better -
As a visual representation; all 3 prints had a "power failure" occurred to them
-
@dc42 It seems that the latest change has helped with this problem: https://forum.duet3d.com/topic/37913/3-6-0-rc2-error-g30-z-probe-readings-not-consistent
-
@Leonard03 thanks for your feedback.
Please try the new frmware build at https://www.dropbox.com/scl/fo/xk6t4cibc602j0s3qmp48/AGouwT4mDySsLdBItGjDUcM?rlkey=k8j1rrfx18ixoyvizvs0hbehz&dl=0 and report whether it is better/same/worse.
-
@dc42 Thank you for the update
Sadly, is still the same. 2mm shift in X-
The left is without M556
The right with M556
-
@Leonard03 Thanks for your continued testing. Was the calibration cube on the right caused by a pause/resume, or by a "power failure" (please explain how you did this!)?
I've just been testing this too, and find that I was able to provoke the bug when using G30 and skew compensation in 3.6.0-rc.3, but that it works correctly in 3.6.0-rc.3+1.
With one bug resolved, I think there's something else going on when you pause and/or 'simulate a power failure', then resume/resurrect. It would seem that skew compensation is not applied, or the position is reset. When a print is paused, or there is a power failure, RRF creates a 'resurrect.g' file in the /sys folder, which is then used to return the tool to the correct position a resume the job. It could be that it is not applying skew compensation at the correct point during this.
Could you:
- Start a print normally.
- Pause the print, or 'simulate a power failure'
- Send M556 to show the current skew compensation setting
- Copy the 'resurrect.g' file from /sys and post it
- resume the print and see if it shifts
- Post your pause.g, resume.g and the output of M556 (in case it has changed, or isn't being applied any longer)
Thanks!
Ian
-
@droftarts I also thank you for the continued help with this issue
Those are fair questions, and I will split my answer in two parts:
How it works and what actually happensMy printer has two power plugs (one and a half actually
)
First, is the main power plug. Is the power plug for the UPS. Then, in the UPS is plugged the printer's ATX power supply and from it the Duet and DueX are powered.
The second, is a phone charger. A 5V 500mA power supply that serves as a power feedback.
From it I powering a 5V simple relay. The switching contacts of that relay (two of them) are wired toduex.e3stop
On that input, I have defined two triggers in config.g:
M950 J2 C"^duex.e3stop" ; Input 1 uses e2stop pin, pullup enabled (power feedback for UPS) M581 P2 T2 S1 R1 ; external trigger 1, trigger occurs on the inactive-to-active edge, trigger at any time (UPS Backup power) M581 P2 T3 S0 R2 ; external trigger 1, trigger occurs on the active-to-inactive edge, trigger only when not printing from SD card (AC back, resume prompt)
Trigger2.g senses if that relay has power to it, so if a print is in progress, it will be executed.
It's macro is this:; Called when mains power is intrerrupted and UPS battery is in use M118 S"Running on backup power !" L0 ; display warning message when using UPS battery M25 ; Pause printing process M400 M0 ; cancel current job M568 P0 A0 ; turn off nozzle heater G91 ; G1 Z-5 M18 X Y E0 ; Disable steppers to conserve battery power, but leave Z stepper energized M552 S-1 ; Disable Wi-Fi adapter if global.MMUmode = true echo >>"0:/sys/MMU Control/errLog.txt" state.time, ",", "Blackout occured", "Z="^move.axes[2].machinePosition-5 ; -5 is the Z lift in pause.g M18 UVW ; disable MMU steppers
If the power goes out, the printer will continue to run on the UPS's battery, in the end safely shutting down the printer.
From what I intended to happen.. is as follows:-
Show a dialog that the power is lost (really this never shows because of the pause dialog that is shown after that; not a problem)
-
list itemPause the print (using the M25), stage that the ressurect is created (if I'm not mistaken)
-
Cancel the print (M0) (stop.g behaves a bit differently in this case, compared with a normal job end, I will describe it later)
-
Turn off the nozzle heater, for a safe shutdown if the power is not restored in time
-
Disable X, Y and extruder steppers to conserve power
-
Disable the WiFi adapter (if the power goes out, the router will be also powered off, so to prevent the board from continuing to search for the network and flood the PanelDue interface with dialogs complaining that it can't find the network)
-
If the MMU is enabled, disable its steppers as well (to conserve power) and log this event to a file.
As stated above, regarding the M0 or
stop.g
in this scenario:; stop.g ; called when M0 (Stop) is run (e.g. when a print from SD card is cancelled) ; ; generated by RepRapFirmware Configuration Tool v3.2.0 on Tue Dec 29 2020 16:23:44 GMT+0200 (Eastern European Standard Time) G91 G1 Z10 F6000 ; lift z by 10mm if global.MMUmode = false M221 S100 D0 T-1 M106 P0 S0 else M221 S100 D0 M221 S100 D1 M221 S100 D2 M221 S100 D3 M221 S100 D4 M572 D{state.currentTool} S0 G1 E3 F800 M106 P0 S0 T-1 M98 P"0:/sys/MMU Control/moveIdler.g" S5 M98 P"0:/sys/MMU Control/counterCheck.g" G90 G0 X0 Y300 F3600 ; go to the back left corner M18 X Y E0 ; disable X, Y and E steppers if global.MMUmode = true ; if MMU is enabled M18 U V W ; disable MMU steppers if state.status = "processing" echo >>"0:/sys/MMU Control/errLog.txt" state.time, ",", "Print complete!" M568 P0 A0 ; turn off tool 0 heater if sensors.gpIn[1].value = 1 M140 S-273.15 ; turn off bed heater if move.axes[2].machinePosition < 150 G1 Z150 M400 M18 Z M81 S1 ; turn off ATX after nozzle cooldown
In normal operation, at the end of the print, I lift the nozzle above the print, reset extrude factor override percentage just in case it was modified during the print, disable pressure advance, and an attempt to give the filament end a nice, sharp tip , so it can be loaded easily next time, then unload the filament.
Then move the bed forward, park the tool carriage to endstop, disable the MMU steppers and turn off the nozzle heater.Now, if the power feedback says that there is no mains power (the charger, relay and
duex.e3stop
input), keep the bed at the print temperature, so the print will not detach from the print surface, and don't rise the Z too much but keep the Z steppers energized, so they keep their positions set by theG32
at the start of the print. Also, keep the power supply turned on (opposite to the M81 S1 if there are no power related issues)After this is completed, the printer will wait until the power is recovered. The UPS cand provide almost one and a half time to resume.
How I resume after a power failure:
If the printer is still powered on using the UPS and the mains power comes back, the phone charger will receive power again, turning on the relay. The relay, will tell the bord that power is back, so in the rising edge of theduex.e3stop
will use thetrigger3.g
:; Called when mains power is back M118 S"Back on AC power" L0 ; display warning message when using UPS battery M552 S1 ; Enable Wi-Fi adapter again if fileexists("0:/sys/resurrect.g") M291 P"Back on AC power. Resume print ?" R"UPS Status" S3 ; Prompt if printing can be resumed M916 ; Resume print after power loss if global.MMUmode = true echo >>"0:/sys/MMU Control/errLog.txt" state.time, ",", "Blackout recovered"
Now that everything is good to go:
-
Reenable the WiFi module and reconect to the router
-
Search for the ressurrect.g and if it is found, ask if the print can be resumed.
-
If I confirm, run the
M916
command to go ahead.
Resurrect-prologue.g is this:
M17 E0 G28 X Y ; home X and Y, hope that Z hasn't moved if global.MMUmode = true M98 P"0:/sys/MMU Control/homeMMU.g" G91 G1 Z-5
- Reenable the extruder stepper (this is a very old bug in RRF. I can't use the MMU to load filament if the extruder stepper is disabled, so enable it before anything else)
- Home X and Y axis (Z axis has never been disabled)
- Rehome the MMU (UVW axis)
- Lower the Z axis (I can't remember exactly why this is necessary, but it works)
And after, RRF executes ressurrect.g.
Until now, is anything that seems out of place?
Pause.g is this, but is complicated:
; pause.g ; called when a print from SD card is paused ; ; generated by RepRapFirmware Configuration Tool v3.2.0 on Tue Dec 29 2020 16:23:44 GMT+0200 (Eastern European Standard Time) if global.MMUmode = false M83 ; relative extruder moves G10 G91 ; relative positioning G1 Z5 F600 ; lift Z by 5mm G90 ; absolute positioning G1 X0 Y0 F6000 ; go to X=0 Y=0 M591 D0 S0 else if state.status != "paused" echo >>"0:/sys/MMU Control/errLog.txt" state.time, ",", "Pause" set global.pause = false if state.status = "pausing" if global.errQueue[#global.errQueue-1] = "SELECTOR_CANNOT_HOME" || global.errQueue[#global.errQueue-1] = "SELECTOR_CANNOT_MOVE" || global.errQueue[#global.errQueue-1] = "INSPECT_FINDA" M18 U elif global.errQueue[#global.errQueue-1] = "PULLEY_CANNOT_MOVE" M18 V elif global.errQueue[#global.errQueue-1] = "IDLER_CANNOT_HOME" || global.errQueue[#global.errQueue-1] = "IDLER_CANNOT_MOVE" M18 W if global.spoolJoin = false && global.loadNext = false M83 ; relative extruder moves G10 G91 ; relative positioning G1 Z5 F600 ; lift Z by 5mm G90 ; absolute positioning G1 X0 Y0 F6000 ; go to X=0 Y=0 M98 P"0:/sys/MMU Control/moveIdler.g" S5 elif global.spoolJoin = true if global.loadNext = false M83 ; relative extruder moves G10 G91 ; relative positioning G1 Z5 F600 ; lift Z by 5mm G90 ; absolute positioning G1 X0 Y0 F6000 ; go to X=0 Y=0 M98 P"0:/sys/MMU Control/moveIdler.g" S5 else M83 G10 ; retract G91 ; relative positioning G1 Z5 ; lift G90 G1 X310 Y0 ; go outside bed G11 ; unretract if state.currentTool = #tools - 1 T0 else T{state.currentTool + 1} if global.errQueue[#global.errQueue-1] = null G1 E30 F300 ; purge air from the nozzle G10 ; retract
During normal operation, or at least for now, commands after line 21 are not used
Pausing and resuming a print (not a power failure) works without problems, and the skew compensation has its normal value.
M556 is defined only in config.g, and for testing purposes I comment or uncomment it.
So I can do a power failure simply by unplugging the charger from its mains socketBoth cubes in the photo above, had a "power failure", the only difference between them is the skew compensation
A side note: the ressurect.g contains a resume command, but it behaves like a M24 P0 because it don't run the
resume.g
-