Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Suggestion for change to implementation of baby-steps

    Scheduled Pinned Locked Moved
    General Discussion
    13
    100
    10.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gnydickundefined
      gnydick @dc42
      last edited by

      @dc42 Baby-stepping is remembered after homing. Here's the simple sequence...

      G28 ; home
      G1 X150 Y150 Z0 ; roughly middle of the bed with nozzle touching
      M290 S5
      G28 Z ; re-home Z
      G1 Z0 ; bring back the bed to the nozzle
      M290 R0 S0 ; ***ENJOY THE CRASH***
      
      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @gnydick
        last edited by dc42

        @gnydick said in Suggestion for change to implementation of baby-steps:

        @dc42 Baby-stepping is remembered after homing. Here's the simple sequence...

        G28 ; home
        G1 X150 Y150 Z0 ; roughly middle of the bed with nozzle touching
        M290 S5
        G28 Z ; re-home Z
        G1 Z0 ; bring back the bed to the nozzle
        M290 R0 S0 ; ***ENJOY THE CRASH***
        

        What should happen is that the G1 Z0 command should leave the head at 0 + 5mm = 5mm above the bed. Then M290 R0 S0 should lower the head to the bed. Is that not what happens? How are you homing Z?

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        deckingmanundefined gnydickundefined 2 Replies Last reply Reply Quote 0
        • deckingmanundefined
          deckingman @dc42
          last edited by deckingman

          @dc42

          For info, I just tried this out on my machine. It seems to work as you say with one exception. When I input M290 S5, I only get an offset of 1mm. I'm guessing that there is a 1mm limit on baby stepping? If not, then something is amiss.

          Anyway, here is what I got......

          G28; home all - after which....
          Measured nozzle height =10.00mm (as expected with the commands I use)
          DWC shows Z= 10.00
          Baby stepping offset shows 0 mm.

          G1 Z0 - after which......
          Measured nozzle height =0mm
          DWC shows Z= 0.00
          Baby stepping offset shows 0 mm.

          M290 S5 - after which....
          Measured nozzle height =1.0mm
          DWC shows Z= 0.00
          Baby stepping offset shows 1 mm.

          G28 Z - after which
          Measured nozzle height =10.0mm
          DWC shows Z= 9.00
          Baby stepping offset shows 1 mm.

          G1 Z0 - after which
          Measured nozzle height =1.0mm
          DWC shows Z= 0.00
          Baby stepping offset shows 1 mm.

          M290 R0 S0 - after which
          Measured nozzle height =0.0mm
          DWC shows Z= 0.00
          Baby stepping offset shows 0 mm.

          HTH

          Edit. This is just for your info - I don't use baby stepping myself but I had a few minutes to spare so ran those tests.

          Ian
          https://somei3deas.wordpress.com/
          https://www.youtube.com/@deckingman

          1 Reply Last reply Reply Quote 0
          • dc42undefined
            dc42 administrators
            last edited by

            @deckingman said in Suggestion for change to implementation of baby-steps:

            For info, I just tried this out on my machine. It seems to work as you say with one exception. When I input M290 S5, I only get an offset of 1mm. I'm guessing that there is a 1mm limit on baby stepping?

            Thanks for running this test. There is indeed a limit of 1mm in any babystepping command, unless you use the R0 parameter to specify an absolute babystepping offset.

            Do you home Z using a homing switch or a Z probe? It might make a difference.

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

            deckingmanundefined 1 Reply Last reply Reply Quote 0
            • deckingmanundefined
              deckingman @dc42
              last edited by deckingman

              @dc42 said in Suggestion for change to implementation of baby-steps:

              Do you home Z using a homing switch or a Z probe? It might make a difference.

              That depends on your definition. Essentially it's a switch connected to the nozzle mount which can move in Z, so the nozzle is the probe. But because the switch has an LED in series, I have to use it as an analogue switch. I get a reading of about 524 when it isn't triggered and 1000 when it is.

              Here is relevant line from my config.g
              G31 P700 X0 Y0 Z-0.4

              Edit. Ohh and M558 P1 X0 Y0 Z1 F180 T6000 I0 (so yes, a P1 type probe).

              Ian
              https://somei3deas.wordpress.com/
              https://www.youtube.com/@deckingman

              1 Reply Last reply Reply Quote 0
              • gnydickundefined
                gnydick @dc42
                last edited by gnydick

                @dc42

                conditions here are that this is a moving bed with a switch at Z-max.

                That's not happening at all. When you home, the firmware automatically sets the Z position to the max. If baby-stepping is still on, your bed will indeed be at the correct max position. If you then G1 Z0, you will indeed position the bed at Z0. Then you reset baby-steps, and the bed tries to move opposite to the baby-steps. If it was positive baby-steps, the bed will crash into the nozzle. If it was negative baby-steps, the bed will move away from the nozzle.

                dc42undefined 1 Reply Last reply Reply Quote 0
                • deckingmanundefined
                  deckingman
                  last edited by

                  Just trying to get my head around this but wondering if you home to Z max, then do M290 S5, the bed would be constrained by the axis limit as defined in M208 which would prevent it from actually moving any further? But the baby-stepping offset might behave as if the bed had moved?

                  So maybe the problem exists only if you home to Z max?

                  Ian
                  https://somei3deas.wordpress.com/
                  https://www.youtube.com/@deckingman

                  1 Reply Last reply Reply Quote 0
                  • dc42undefined
                    dc42 administrators @gnydick
                    last edited by

                    @gnydick said in Suggestion for change to implementation of baby-steps:

                    @dc42

                    conditions here are that this is a moving bed with a switch at Z-max.

                    That's not happening at all. When you home, the firmware automatically sets the Z position to the max. If baby-stepping is still on, your bed will indeed be at the correct max position. If you then G1 Z0, you will indeed position the bed at Z0. Then you reset baby-steps, and the bed tries to move opposite to the baby-steps. If it was positive baby-steps, the bed will crash into the nozzle. If it was negative baby-steps, the bed will move away from the nozzle.

                    Please share your homing files.

                    Duet WiFi hardware designer and firmware engineer
                    Please do not ask me for Duet support via PM or email, use the forum
                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                    gnydickundefined 1 Reply Last reply Reply Quote 0
                    • gnydickundefined
                      gnydick @dc42
                      last edited by

                      @dc42

                      homex

                      ; homex.g
                      ; called to home the X axis
                      ;
                      ; generated by RepRapFirmware Configuration Tool v2 on Fri Feb 08 2019 11:10:07 GMT-0800 (Pacific Standard Time)
                      G91              ; relative positioning
                      G1 Y50 S1 ; avoid pulley in corner
                      ;G1 Z-5 F6000 S2   ; lift Z relative to current position
                      G1 S1 X293 F1800 ; move quickly to X axis endstop and stop there (first pass)
                      G1 X-5 F6000     ; go back a few mm
                      G1 S1 X293 F360  ; move slowly to X axis endstop once more (second pass)
                      ;G1 Z5 F6000 S2  ; lower Z again
                      G90              ; absolute positioning
                      G92 X275
                      

                      homey

                      M913 X40 Y40 ; reduce current
                      ; generated by RepRapFirmware Configuration Tool v2 on Fri Feb 08 2019 11:05:47 GMT-0800 (Pacific Standard Time)
                      G91              ; relative positioning
                      ;G1 Z-5 F6000 S2   ; lift Z relative to current position
                      G1 S1 Y365 F1800 ; move quickly to Y axis endstop and stop there (first pass)
                      G1 Y-5 F6000     ; go back a few mm
                      G1 S1 Y365 F360  ; move slowly to Y axis endstop once more (second pass)
                      ;G1 Z5 F6000 S2  ; lower Z again
                      G90              ; absolute positioning
                      M913 X100 Y100 ; restore current
                      

                      homez

                      G91
                      G1 Z400  S1 F1500
                      G1 Z-5 
                      G1 Z10 S1 F100
                      G90
                      
                      dc42undefined 1 Reply Last reply Reply Quote 0
                      • dc42undefined
                        dc42 administrators @gnydick
                        last edited by dc42

                        @gnydick, thanks. I've just tested homing to max Z with 5mm of baby stepping applied. Specifically, I did this (from bottom to top):

                        20/03/2019, 15:36:50 M114
                        X:0.000 Y:0.000 Z:195.000 E0:0.0 E1:0.0 E2:0.0 E3:0.0 E4:0.0 E5:0.0 E6:0.0 Count 0 0 40000 Machine 0.000 0.000 200.000
                        20/03/2019, 15:35:28 G1 S1 Z400
                        20/03/2019, 15:35:13 G91
                        20/03/2019, 15:35:05 M208 Z200
                        20/03/2019, 15:34:34 M574 Z2 S1
                        20/03/2019, 15:34:14 M290
                        Baby stepping offset is 5.000mm
                        20/03/2019, 15:34:12 M290 Z1
                        20/03/2019, 15:34:12 M290 Z1
                        20/03/2019, 15:34:11 M290 Z1
                        20/03/2019, 15:34:10 M290 Z1
                        20/03/2019, 15:34:07 M290 Z1
                        20/03/2019, 15:33:51 G92 X0 Y0

                        So I applied +5mm of baby stepping, then I homed to max Z, which I had set to 200 in M208. After this the Z coordinate reported by both DWC and M114 was 195, as expected (i.e. user position +195, plus 5mm baby stepping, gives a machine position of +200).

                        All this is exactly as expected. When I originally implemented baby stepping, I reset it to zero when you homed Z. but at the request of several users, I changed it to persist across homing. It is still reset to zero at power up.

                        If you want to reset baby stepping during homing, or at the end of each print, you can do that by adding command M290 R0 Z0 in one or more of homez.g, homeall.g, stop.g and cancel.g.

                        You might with to do a similar test to mine, i.e. apply +5mm bay stepping, then home Z to max. You said that you have Z max set to 300mm, so you should find the that displayed Z coordinate after homing Z is 295. If you then command the nozzle to Z0, it should be 5mm above the bed.

                        Duet WiFi hardware designer and firmware engineer
                        Please do not ask me for Duet support via PM or email, use the forum
                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                        gnydickundefined 1 Reply Last reply Reply Quote 0
                        • gnydickundefined
                          gnydick @dc42
                          last edited by gnydick

                          @dc42 i see what you're saying. I just did that little experiment right now, but in practice it hasn't worked that way. I don't know if having printed changes the internal flow somehow.

                          1 Reply Last reply Reply Quote 0
                          • dc42undefined
                            dc42 administrators
                            last edited by dc42

                            Having printed should not change anything, assuming that the print file didn't have any M290 commands in it.

                            Duet WiFi hardware designer and firmware engineer
                            Please do not ask me for Duet support via PM or email, use the forum
                            http://www.escher3d.com, https://miscsolutions.wordpress.com

                            gnydickundefined 1 Reply Last reply Reply Quote 0
                            • gnydickundefined
                              gnydick @dc42
                              last edited by

                              @dc42 I did some experimenting, and it looks like it depends on whether you baby step + or -. If you baby step - then the homing routine breaks like I explained.

                              1 Reply Last reply Reply Quote 0
                              • gnydickundefined
                                gnydick
                                last edited by

                                I also just reconfigured my machine. It now Z homes at zero. I had positive baby-stepping of .2. Then I homed the machine, which includes a final move to Z75. The display read Z74.80. I reset baby-steps and the bed moved, but the DWC still showed Z74.80.

                                So, this is all getting confusing, which is what leads me back to my original suggestion. NONE of this behavioral heuristics would be necessary if the Z value was always where it physically is and never a virtual coordinate.

                                dc42undefined 1 Reply Last reply Reply Quote 0
                                • dc42undefined
                                  dc42 administrators
                                  last edited by dc42

                                  I've just found a bug in the current baby stepping code. When using relative babystepping (the default), sometimes it will babystep more than the amount you asked for. I wonder whether this might explain your earlier observations?

                                  Duet WiFi hardware designer and firmware engineer
                                  Please do not ask me for Duet support via PM or email, use the forum
                                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                                  1 Reply Last reply Reply Quote 2
                                  • dc42undefined
                                    dc42 administrators @gnydick
                                    last edited by dc42

                                    @gnydick said in Suggestion for change to implementation of baby-steps:

                                    So, this is all getting confusing, which is what leads me back to my original suggestion. NONE of this behavioral heuristics would be necessary if the Z value was always where it physically is and never a virtual coordinate.

                                    I'm not going to change it, because it would be very confusing if you send a G1 command to send the head to one set of coordinates and it goes to different coordinates, and because the physical coordinates also include the effects of workplace coordinate offsets, tool offsets, bed compensation, axis skew compensation, and firmware-controlled retraction Z-hop. But I think there is a case to be made for DWC showing both user coordinates and machine coordinates.

                                    Btw the next 2.03beta will have the option to do instant (live) babystepping on the most common machine architectures.

                                    Duet WiFi hardware designer and firmware engineer
                                    Please do not ask me for Duet support via PM or email, use the forum
                                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                                    gnydickundefined 1 Reply Last reply Reply Quote 0
                                    • gnydickundefined
                                      gnydick @dc42
                                      last edited by gnydick

                                      @dc42 I think that will be confusing as well.

                                      Let's take a step back and look at it again...

                                      Baby-stepping, in it's current implementation

                                      • Causes an inconsistent representation of the coordinates
                                        • Sometimes it effects the displayed coordinate and sometimes it doesn't.
                                      • Regardless of the representation, if the bed is against the nozzle and there was positive baby stepping applied, a baby-step reset will cause a crash and some sort of damage, especially in the case of build surface coatings like PEI and a hot nozzle.
                                        • The M564 setting will not influence whether or not the bed/nozzle will crash.

                                      Goals

                                      • We don't want to confuse the user
                                      • We don't want to cause bed crashing
                                      • We don't want to cause movement beyond the maximum of the Z axis
                                      • This is a machine, not software, it should be dumb and just do what we tell it to do predictably.

                                      Objective of Baby-Stepping

                                      • Be able to adjust the z height so that the bed-nozzle distance is correct for the foreseeable future
                                        • that could be until it needs recalibration some days, weeks, or months away
                                        • it could be the next print
                                          • common scenario when you're trying to work the kinks out of an in development machine, like I've been doing since last June.
                                          • could be because your filament is particularly difficult to print and you need to keep an eye on it
                                          • could be bad slicer settings
                                          • etc.

                                      How do these goals and objectives mesh together?

                                      • The representation should always inform the user correctly. That doesn't mean the Z value is the same as the physical position or the adjusted position. There are two paths for that
                                        1. The representation changes as you baby-step, and if you apply baby-stepping positive, e.g., you're Z will never be zero until baby-stepping is reset. To me, honestly, that wouldn't be confusing; I'd home the machine, bring the nozzle to the bed and see Z: 0.20, especially if the baby-stepping is represented next to it. That would be cake. And if it's negative, the same.
                                          0_1553387530767_dwc-z-offset.png
                                      1. The representation never changes and the firmware obfuscates everything under the covers. Which is a lot of cases to handle. Here are just some of them.
                                        • If you baby-step positive and you home to the low end and you're now at nozzle-meets-bed position, then the screen will read Z: 0.00 and resetting baby-steps will not go past the configured past 0 config as it knows that this should be treated like Z:0 and modifies all movements accordingly.
                                        • If you baby-step negative and you home to the high end, the same thing has to happen, but in reverse. It should know that you're at your axis maximum and not move the bed.
                                        • You've just finished a print, and have baby-stepped, and you're not happy and want to probe the mesh, but, you forget to reset the baby-steps. How should it be implemented in firmware? Do you consider the baby-steps to be part of the probe offset, or not?

                                      There's no way to know how to implement all of the scenarios because each machine is different, and each person's thoughts on how things should work are different. There should be no room for interpretation.

                                      You see how option #2 starts you down a rabbit hole? We are currently in that rabbit hole, which I don't think is tenable. I think there're too many scenarios that conflict with each other that can't be reconciled with heuristics or state machines.

                                      My vote would be for #1. Nothing is obfuscated from the user. When they're calibrating, tuning, building, tweaking, printing, etc., if they know how the printer works, which is a requirement at this point, then with the display in front of them, they'll know if they need to reset baby-steps, or move the bed||nozzle away from the other before resetting to avoid damage, because it's in front of their face.

                                      An ounce of added complexity to the display will save tons of frustration. The absolutely correct value for Z is a vector of sorts. [ position, offset ]. If that's what was represented, there would be no confusion what-so-ever.

                                      This obviously becomes less important if there is a permanently deployed Z height sensor, because then you can avoid problems, but we don't all have that. That's how Prusa can get away with NOT showing the physical position and/or offset amount. All Prusa's have a probe and re-home before every print and the Z-offset value is just applied for all moves.

                                      1 Reply Last reply Reply Quote 0
                                      • gnydickundefined
                                        gnydick
                                        last edited by

                                        @dc42 I still think this is worth talking about.

                                        The current implementation only works well if your printer is very well behaved and calibrated, and you add baby step maintenance commands to your homing scripts.

                                        Also consider the following scenario.

                                        I start a print and notice it's not pressing the filament down and I baby step down. The printer thinks it's at 0.2 but it's obviously not, it's at 0.5 or 0.6 in actuality.

                                        This simple scenario completely breaks your vision of wanting the printer to go to the position you tell it, not a physically different position.

                                        Baby stepping should be a permanent adjustment. Look at it this way. Let's say I have a shitty printer that doesn't always home well. Maybe it's temperature fluctuations and expanding material moving the sensor, who knows.

                                        It would be incredibly useful to be able to baby step to fix the offset, and then just be able to forget it until the barometer moves again.

                                        Don't even display it. It's an adjustment that's no different from moving the sensor.

                                        This is how the Marlin firmware does it and it's SO much simpler. I never, ever have to think about it other than when I need to adjust. For example, switching from PLA to PETG, I like dialing back the squish a little bit.

                                        fmaundefined 1 Reply Last reply Reply Quote 0
                                        • dc42undefined
                                          dc42 administrators
                                          last edited by dc42

                                          I don't think making babystepping permanent would suit all users, but we could make it optional. One way would be to have M500 P290 write config-override.g including the current babystepping value (just like M500 P31 writes config-override.g including the current G31 parameters). Would that help you? You could put the M500 P290 command in stop.g if you wanted.

                                          Duet WiFi hardware designer and firmware engineer
                                          Please do not ask me for Duet support via PM or email, use the forum
                                          http://www.escher3d.com, https://miscsolutions.wordpress.com

                                          gnydickundefined 1 Reply Last reply Reply Quote 0
                                          • fmaundefined
                                            fma @gnydick
                                            last edited by

                                            @gnydick said in Suggestion for change to implementation of baby-steps:

                                            Don't even display it. It's an adjustment that's no different from moving the sensor.

                                            I also see it this way.

                                            Frédéric

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA