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

    G38 + idex + multiple probes = insanity ?

    Scheduled Pinned Locked Moved
    General Discussion
    4
    12
    209
    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.
    • crpalmerundefined
      crpalmer
      last edited by crpalmer

      I have an IDEX printer and each of the two tools has a its own probe (pz probes). These probes can trigger on contact in all 3 dimensions. I'm trying to take advantage of that fact to probe a pin with each tool to automatically configure the tool offsets.

      As you'd expect, I have the standard X/Y/Z axes with a U axis which is mapping to X for tool 1.

      I can probe Z successfully using either tool by activating the appropriate tool and specifying the corresponding probe # when running the G30 command. I can probe the pin successfully with T0 by running G38.2 commands. However, when I try to run G38.2 commands with T1 active, I get unexpected and inexplicable (to me) behaviour. Here is a series of commands I ran with a corresponding comment documenting what actually happened when I executed the command:

      T0 G38.2 X150 K0   ; Moves X until probe 0 is triggered
      T1 G38.2 X150 K1   ; Moves X & U until probe 1 is triggered
      T0 G38.2 U150 K0   ; Moves U until probe 0 is triggered
      T1 G38.2 U150 K1   ; Moves X until probe 1 is triggered
      T1 G53 G38.2 U150 K1
      

      The first line is what I'd expect (probe X by moving X when tool 0 is selected). The second command, however, is a mystery. To make sure G38.2 wasn't expectding unmapped axes to be specified, I also tried the G38.2 commands using the U axis which certainly didn't help me understand what was happening. Finally, I also tried machine coordinates for the U moves in case it was some discrepancy between machine positions vs. mapped axes (I can't say for sure what happened as I didn't record it in my notes but I expecdt it was the same as not using machine coordinates).

      Any explanations or suggestions for accomplishing my goal of automatically aligning the tools?

      My config.g is:

      M98 P"/sys/global-declarations.g"
      
      ; General preferences
      G90                                                    ; send absolute coordinates...
      M83                                                    ; ...but relative extruder moves
      
      ; Drives
      M569 P0 S0 ; D3                                        ; physical drive 0 goes backwards, stealthchop
      M569 P1 S0 ; D3                                        ; physical drive 1 goes backwards
      M569 P2 S0 ; D3                                        ; physical drive 2 goes backwards
      M569 P3 S0 ; D3                                        ; physical drive 3 goes backwards
      M569 P4 S0 ; D3                                        ; physical drive 4 goes backwards
      M569 P1.0 S1 ; D3                                      ; physical drive 1.0 goes forwards
      M569 P1.1 S1 ; D3                                      ; physical drive 1.1 goes forwards
      M569 P1.2 S1 ; D3                                      ; physical drive 1.2 goes forwards
      M584 X0.2 Y0.1:1.2 u1.1 E0.0:1.0 Z0.3:0.4              ; set drive mapping
      M92 X160.00 Y160.00 U160.00 Z800.00 E680:680           ; set steps per mm (recommended; 690 orbiter)
      M350 X16 Y16 U16 Z16 E16 I1                            ; set microstepping to 256 interpolation
      M566 X600.00 Y600.00 U600.00 Z240.00 E300:300 P1       ; set maximum instantaneous speed changes (mm/min)
      M203 X12000.00 Y12000.00 U12000.00 Z600.00 E7200:7200  ; set maximum speeds (mm/min)
      M201 X1000.00 Y1000.00 U1000.00 Z500.00 E5000:5000     ; set accelerations (mm/s^2)
      ;M906 X1350 Y1350 U1350 Z1200 E850:850 I30              ; set motor currents (mA) and motor idle factor in per cent (orbiter supposed to be 1200)
      M906 X1200 Y1000 U1200 Z840 I30                        ; Set motor currents (mA) and motor idle factor in per cent
      M906 E850:850 I10                                      ; (orbiter supposed to be 1200)
      M84 S30                                                ; Set idle timeout
      
      ; Z drive
      ;M671 X{global.xCenter, global.xCenter} Y-35:385 S2  			                   ; motor order: front, back
      M671 X150:150 Y-35:385 S2  			                   ; motor order: front, back
      
      ; Axis Limits
      M208 X0 Y-10 Z0 U-50 S1                       ; set axis minima
      M208 X350 Y356 Z425 U305 S0                            ; set axis maxima
      
      ; Endstops
      M574 X2 S1 P"^0.io5.in"                                ; configure active-high endstop for high end on X
      M574 Y2 S1 P"^0.io6.in+^1.io0.in"                      ; configure active-high endstop for high end on Y
      M574 U1 S1 P"^1.io2.in"                                ; configure active-high endstop for high end on U
      
      ; Z-Probe
      M558 K0 P8 C"^!io1.in" R1.0 H5 F400 A5 T24000
      G31  K0 X0 Y0 Z0 P25
      M558 K1 P8 C"^!1.io5.in" R1.0 H5 F400 A5 T24000
      G31  K1 X0 Y0 Z0 P25
      
      M557 X0:325 Y5:355 P9                                  ; define mesh grid
      M376 H2
      
      ; Filament sensor (BTT SFS 2.0)
      M591 D0 P7 C"0.io3.in" L3 R50:150 E22 S1
      M591 D1 P7 C"1.io1.in" L3 R50:150 E22 S1
      
      ; Pressure advance
      M572 D0 S0.05
      M572 D1 S0.05
      
      ; Fans (tool 0)
      M950 F0 C"out5" Q250                                   ; create fan and set its frequency
      M106 P0 S0 H-1                                         ; set fan value (off). Thermostatic control is turned off
      M950 F1 C"out6" Q500                                   ; create fan and set its frequency
      M106 P1 S1 T45 H1                                      ; set fan value (on). Thermostatic control is turned on
      
      ; Fans (tool 1)
      M950 F2 C"1.out7" Q250                                 ; create fan and set its frequency
      M106 P2 S0 H-1                                         ; set fan value (off). Thermostatic control is turned off
      M950 F3 C"1.out6" Q500                                 ; create fan and set its frequency
      M106 P3 S1 T45 H2                                      ; set fan value (on). Thermostatic control is turned on
      
      ; Fans (board cooling)
      M950 F4 C"!1.out3" Q25000                              ; create fan and set its frequency
      M106 P4 S1 H-1                                         ; set fan value (on).  Thermostatic control is turned off
      
      ; Bed Heater
      M308 S0 P"temp0" Y"thermistor" T100000 B4092           ; configure sensor
      M950 H0 C"out0" T0                                     ; create bed heater output and map it to sensor 0
      M307 H0 R0.272 C349.6 D8.37 S1.00 V23.7
      M140 H0                                                ; map heated bed to heater 0
      M143 H0 S120                                           ; set temperature limit for heater 0 to 120C
      
      ; tool 0 thermistor
      M308 S1 P"temp1" Y"thermistor" T100000 B4725 C7.06e-8  ; configure sensor
      M950 H1 C"out1" T1                                     ; create nozzle heater output and map it to sensor 1
      
      ; tool 0
      M307 H1 R3.927 K0.564:0.293 D1.73 E1.35 S1.00 B0 V24.1
      M563 P0 S"E3Dv6" D0 H1 F0                              ; define tool 0
      G10 P0 X0 Y0 Z0                                        ; set tool 0 axis offsets
      
      ; tool 1 thermistor
      M308 S2 P"1.temp2" Y"thermistor" T100000 B4725 C7.06e-8; configure sensor
      M950 H2 C"1.out2" T2                                   ; create nozzle heater output and map it to sensor 2
      
      ; tool 1
      M307 H2 R3.401 K0.474:0.307 D1.67 E1.35 S1.00 B0 V24.2
      M563 P1 S"E3Dv6" D1 H2 X3 F2                           ; define tool 1
      G10 P1 U-1.61 Y-0.19 Z0.135                            ; set tool 1 axis offsets
      
      ; Set both tools to standby mode
      M568 A1 P0 R0 S0
      M568 A1 P1 R0 S0
      
      ; Tool (common)
      G10 P0 R0 S0                                           ; set initial tool 0 active and standby temperatures to 0C
      G10 P1 R0 S0                                           ; set initial tool 1 active and standby temperatures to 0C
      
      ; MCU DOES NOT WORK ON THE DUET 3 MINI 5+?
      M912 P0 S-12.5                                         ; Calibrate MCU temperature
      
      ; Miscellaneous
      M912 P0 S-1
      
      M98 P"/sys/global-defaults.g"
      

      and the full machine specific config can be found on github using common config found here.

      Edit to add: running 3.5.4 on a SBC setup.

      dwuk3dundefined droftartsundefined 2 Replies Last reply Reply Quote 0
      • dwuk3dundefined
        dwuk3d @crpalmer
        last edited by

        @crpalmer

        Doesn't make any sense to me looking at your configuration why moving X on T1 should move X1 and X2. and also why moving U on T1 is moving the wrong head X1 vs X2.

        I can't see an M669 - so not sure what your kinematics are. Is there anything relevant in the two extra global files referenced at the start and end.

        When you move the X and U with a G1, or when you move individual motors with a G1 H2 on either tool do they move as expected - is it only probing where they move incorrectly?

        I presume that lower case 'u' in the M584 isn't causing any issues.

        crpalmerundefined 1 Reply Last reply Reply Quote 0
        • crpalmerundefined
          crpalmer @dwuk3d
          last edited by

          @dwuk3d To be clear, the printer itself is working well. I can print dual material/colour prints with it. I'm just running into difficulties when I am trying to add the pin probing functionality to it. All the axes move correctly, I can move X/U individually using G1 H2 (which I do as part of the tool cleaning process before probing Z or the pin).

          The kinematics are plain old boring cartesian:

          m669
          Kinematics is Cartesian, no segmentation, matrix:
          1.00 0 0 0
          0 1.00 0 0
          0 0 1.00 0
          0 0 0 1.00
          

          The reason for the global-* is that I have 5 printers which share 95% of their configuration in a common git repository to make maintaining them much simpler. The global configuration parameterizes the common functionality (e.g. the location of the wiping pad to use to clean the nozzle, where to move the tool when a print completes, etc). The links in the last line of the first post are to the machine repo (config.g and global-defaults.g) and the common config repo (all the rest of /sys/).

          1 Reply Last reply Reply Quote 0
          • dwuk3dundefined
            dwuk3d
            last edited by

            Ok - beats me them why G38.2 isn't working - for my IDEX like printer I am using G1 H4's instead of G38's, and swapping probes and end stops around rather than using T commands.

            Example attached is for a ball probe alignment on a Gantry with U (X) and V(Y) and it also uses Z to initially check it is on the probe - so not quite the same as your requirement - but might be of some use.

            ;AlignUVZ.g
            ;
            ;if exists(global.ballProbeX) == false
            ;    abort "XY alignment not found"
            
            M98.1 A"Probe Out"
            
            G90
            T0
            G1 Z50 F10000
            
            G1 X30 Y30 F20000
            
            M400
            M98 P"0:/macros/FindProbeUV.g"
            M574 Z1 S2 K3; Set Z to Ball Probe
            G1 H4 Z{global.zHit-1} F300
            
            if sensors.probes[3].value[0] = 0
                echo "Probe not found"
                break
            ;G1 U204 V149 F10000
            
            
            
            ; Find basic Z position
            
            var Zpos = {50,49,48,48,48}
            var Zrate = {300,200,100,100,100}
            var Upos = {10,8,8,8,8}
            var Vpos = {10,8,8,8,8}
            var UVrate = {1000,800,300,300,300}
            
            var prev = false
            var pVM = 0
            var pUM = 0
            
            var VM=0
            var UM=0
            
            
            while iterations < 2
                M574 Z1 S2 K3; Set Z to Ball Probe
            
                G90
                G1 Z{var.Zpos[iterations]} F300
                G91 
                G1 H4 Z-12 F{var.Zrate[iterations]}
                ;echo "Z", {move.axes[2].userPosition}
            
            
                var ZP = move.axes[2].userPosition
            
                G1 Z5 F5000
            
                M574 Z1 S2 K0; configure Z axis endstop
            
                ; Now find U middle
            
                G91
                G1 U{0-var.Upos[iterations]} F2500
                G90
                G1 Z{var.ZP-0.2} F300
            
            
                G91
                M574 U1 S2 K3 ; Configure U axis with Z ball probe
                G1 H4 U+10 F{var.UVrate[iterations]}
            
                ;echo "X1", {move.axes[0].userPosition}
                M400
                var U1 = move.axes[3].userPosition
            
                G1 Z5 F300
                G1 U{var.Upos[iterations]}  F2500
                G1 Z-5 
                M400
                
                G1 H4 U-10 F{var.UVrate[iterations]}
                ;echo "X2", {move.axes[0].userPosition}
                M400
                var U2 = move.axes[3].userPosition
            
                G1 Z5
            
                G90
                set var.UM = (var.U1+var.U2)/2
               
            
                ;echo "XM", {var.XM}
                G1 U{var.UM}
            
                M574 U2 P"!122.io0.in" S1 ; configure U axis endstop
            
                ; Now V
                G91
            
                G1 V{0-var.Vpos[iterations]} F5000
                G1 Z-5 F300
                M574 V1 S2 K3
            
                G1 H4 V+10 F{var.UVrate[iterations]}
                ;echo "Y1", {move.axes[1].userPosition}
                M400
                var V1 = move.axes[4].userPosition
            
                G1 Z5 F300
                G1 V{var.Vpos[iterations]} F5000
                G1 Z-5 F300
            
                G1 H4 V-10 F{var.UVrate[iterations]}
                ;echo "Y2", {move.axes[1].userPosition}
                M400
                var V2 = move.axes[4].userPosition
            
                set var.VM = (var.V1 + var.V2) / 2
            
                echo "UM", {var.UM},"VM", {var.VM},"ZP", {var.ZP},"---U1,2",{var.U1},{var.U2},"--V1,2",{var.V1},{var.V2}
                if (var.prev == true)
                    echo "variation U:",{var.pUM-var.UM}, "V:", {var.pVM-var.VM}
                    
                set var.pVM = var.VM
                set var.pUM = var.UM
                set var.prev = true
            
                G1 Z5 F300
            
                G90 
                G1 U{var.UM} V{var.VM} F2000
            
            
                M574 V2 P"io4.in" S1 ; U Axis optical
            
            
            M574 Z1 S2 K3; Set Z to Ball Probe
            G91
            G1 H4 Z-5 F300
            var Z1 = move.axes[2].machinePosition
            echo "z1",{var.Z1}
            
            G1 Z5 F1000
            G1 U4 F2500
            G1 H4 Z-10 F300
            var Z2 = move.axes[2].machinePosition
            echo "z2",{var.Z2}
            
            G1 U-4 F2500
            
            G1 Z5 F1000
            
            M574 Z1 S2 K0; configure Z axis endstop
            
            if var.Z1-var.Z2 < 1
                echo "z1,z2",{var.Z1},{var.Z2}
                abort "possible issue with UV alignment"
            
            
            if exists(global.ballProbeU) == false
                global ballProbeU = -1
                global ballProbeV = -1
            
            set global.ballProbeU = var.UM
            set global.ballProbeV = var.VM
            
            
            
            
            G90
            ;var adjust = var.UM - global.ballProbeX
            ;echo "adjusting U",{global.ballProbeX - var.UM},"V",{global.ballProbeY - var.VM}
            ;G92 U{global.ballProbeX} V{global.ballProbeY}
            
            ;if exists(global.UVAdjusted) == false
            ;    global UVAdjusted = true
            
            
            
            
            
            
            crpalmerundefined 1 Reply Last reply Reply Quote 0
            • crpalmerundefined
              crpalmer @dwuk3d
              last edited by

              @dwuk3d Thanks for looking. I'm afraid it's a bug but I wanted to reach out here to see if anyone had experience doing something similar.

              Unfortunately, I don't think I can use G1 H4 as I need to move X/Y until a probe is triggered, not the moving axis' endstop.

              dwuk3dundefined 1 Reply Last reply Reply Quote 0
              • dwuk3dundefined
                dwuk3d @crpalmer
                last edited by dwuk3d

                @crpalmer OK - I am pretty new to RRF - and I am not really sure what the difference is between a probe and an endstop unless your probe is something analog.

                I'm switching around the configuration between Inductive Probes, Ball probes and endstops in quite a few places in my homing and alignment macros - in fact I had to set one of my 5 probes as an end stop because I reached the limit on the maximum number of probes allowed.

                1 Reply Last reply Reply Quote 0
                • droftartsundefined
                  droftarts administrators @crpalmer
                  last edited by

                  @crpalmer said in G38 + idex + multiple probes = insanity ?:

                  T0 G38.2 X150 K0 ; Moves X until probe 0 is triggered
                  T1 G38.2 X150 K1 ; Moves X & U until probe 1 is triggered
                  T0 G38.2 U150 K0 ; Moves U until probe 0 is triggered
                  T1 G38.2 U150 K1 ; Moves X until probe 1 is triggered

                  T1 G53 G38.2 U150 K1

                  The first line is what I'd expect (probe X by moving X when tool 0 is selected).
                  The second command, however, is a mystery.
                  To make sure G38.2 wasn't expectding unmapped axes to be specified, I also tried the G38.2 commands using the U axis which certainly didn't help me understand what was happening.
                  Finally, I also tried machine coordinates for the U moves in case it was some discrepancy between machine positions vs. mapped axes (I can't say for sure what happened as I didn't record it in my notes but I expecdt it was the same as not using machine coordinates).

                  Are you saying that, for the second command T1 G38.2 X150 K1, both tools are being moved? Because when any tool is mapped from it's usual axis (ie U) to X, it will update the position of both axes (even though only the U axis should physically move, the position on X is updated). If both X/T0 and U/T1 are physically moving, then yes, I'd think this was a bug.

                  Your third command doesn't make any sense to me, ie you're trying to use a tool and move the axis that is not associated with it. RRF will probably let you do this, just because someone will probably want that functionality at some point. Caveat operator!

                  I would imagine that your fourth command should work, but I'm not sure how the recorded position will relate to the X axis. I don't have an IDEX to test, to see what happens to the T1 X position when you command a U axis movement directly. I think what is supposed to happen with G1 moves is the the U axis will move independently, and the X axis position is not updated. However, when an X axis move is requested, the U axis will return to the previous position (where it left position with the X axis), then perform the expected X axis move, updating the U axis position as well. So it won't be useful for determining the X offset for T1.

                  If you can confirm this is what you see, I can raise it with @dc42.

                  Ian

                  Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                  crpalmerundefined 1 Reply Last reply Reply Quote 0
                  • crpalmerundefined
                    crpalmer @droftarts
                    last edited by

                    @droftarts I tried all 4 combinations of U vs. X and specifying T0 vs. T1's probe to see if I could make any sense of it. I couldn't. I really don't want to run any strange combination of moving a tool and triggering a different endstop!

                    What I really want to run is "G38.2 X150 Kx " and have it move whichever tool is active toward 150 until probe #x is triggered. To confirm the behaviour I reported, I just ran the following sequence of commands:

                    G28
                    T0
                    G1 X150 F24000
                    T1
                    G1 X150 F24000
                    G1 X0
                    G38.2 X150 K1
                    G38.2 U150 K1
                    

                    The G1 commands are to be 100% sure that the axes move as expected (T0 moves to 150 for the first G1 and then T1 moves to 150 for the second G1). The first G38.2 command moves both T0 and T1 until probe 1 is triggered. The second G38.2 command moves only T0 (T1 doesn't move even though it is both active and the tool driven by the U axis).

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

                      @crpalmer I confirm this is a bug. I have implemented a fix in the 3.6 source code, which will be in the next 3.6.0 RC or internal build I make available.

                      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

                      crpalmerundefined 1 Reply Last reply Reply Quote 0
                      • crpalmerundefined
                        crpalmer @dc42
                        last edited by

                        @dc42 Wow, that was a fast fix! Thanks!

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

                          @crpalmer I have provided main board firmware 3.6.0-rc.2+2 binaries at https://www.dropbox.com/scl/fo/nlkfneaas1osgtdw37s17/AIS_H0KSAKCmfYSjSRTSOAE?rlkey=ad4omnq36zkdz3wl8i7kthqqt&dl=0 which incude this fix.

                          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

                          crpalmerundefined 1 Reply Last reply Reply Quote 0
                          • crpalmerundefined
                            crpalmer @dc42
                            last edited by

                            @dc42 Again, thanks! I can confirm that this fixes my probing issue.

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