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

    how to do escape homing using sensor?

    Scheduled Pinned Locked Moved
    General Discussion
    4
    7
    181
    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.
    • R006undefined
      R006
      last edited by

      Hii,
      how to implementation of an escape homing system for the X and Y axes ?

      any suggestions on it?
      @dc42 @Phaedrux

      Phaedruxundefined 1 Reply Last reply Reply Quote 0
      • Phaedruxundefined
        Phaedrux Moderator @R006
        last edited by

        @R006 said in how to do escape homing using sensor?:

        escape homing system

        what does this mean?

        Z-Bot CoreXY Build | Thingiverse Profile

        R006undefined 1 Reply Last reply Reply Quote 0
        • R006undefined
          R006 @Phaedrux
          last edited by

          @Phaedrux
          In Escape homing method, in 1st pass, axis moves towards the sensor a little more than sensing area & then in 2nd pass move axis in opposite direction until axis is outside of sensing area, where I would like to define 0 for X & Y axis respectively.
          So basically, after sensing in 1st pass, I want axis to move by a fixed distance outside of sensing area to define 0. Just how some people escape sensing to define origin.

          oliofundefined 1 Reply Last reply Reply Quote 0
          • oliofundefined
            oliof @R006
            last edited by oliof

            @R006

            Maybe like this for X, calling M98 P"escape-homex.g from homex.g:

            ; escape-homex.g example macro
            ; UNTESTED PROCEED AT YOUR OWN RISK
            
            ; safeguard
            if {sensors.endstops[0].endstopType = "motorStallAny" || sensors.endstops[0].endstopType = "motorStallIndividual" || sensors.endstops[0].endstopType="unknown"}
              abort "unsupported endstop type"
            
            ; travel speeds
            var fast_travel=3600
            var slow_travel=600
            
            ; determine homing move direction and length.
            ; this accounts for negative axis minima on center-zeroed or endstop offsets.
            
            var homing_move_length=abs(move.axes[0].min)+ move.axes[0].max + 5
            var backoff_direction = 1
            
            ; endstop at axis max
            if{sensors.endstops[0].highEnd}
              set var.backoff_direction=-1
            ; endstop at axis min
            else
              set var.backoff_direction=1
            
            ; standard homing pass
            if{sensors.endstops[0].highEnd
              G1 H1 X{var.homing_move_length} F{var.fast_travel}
            else
              G1 H1 X-{var.homing_move_length} F{var.fast_travel}
            
            ; relative positioning
            G91
            
            ; move one hundredth of a millimeter until endstop stops triggering.
            while {sensors.endstops[0].triggered}
              G0 X{0.01 * var.backoff_direction} F{var.slow_travel}
              M400
            
            ; back to absolute position
            G90
            M400
            
            ; set axis position according to endstop arrangement
            if {sensors.endstops[].highEnd}
              G92 X{move.axes[0].max}
            else
              G92 X{move.axes[0].min}
            

            That said, to achieve a very similar effect, the convention in RRF is to do a fast homing move, backing off from the endstop for a short length, and then to do a slow homing move. Both approaches reduce the effect of overtravel on repeatability of the homing prodecure.

            EDIT: This script is a little bit more complex than it would need to be to show the escape homing mechanism since I had to get this "generalized homing macro" idea out of my head. The part @R006 is interested happens in lines 30 to 37.

            <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

            1 Reply Last reply Reply Quote 0
            • achrnundefined
              achrn
              last edited by achrn

              I'd never heard of it, but how about:

              • do a move until the endstop is triggered
              • redefine the endstop with inverted polarity
              • do a move until the endstop is triggered
              • put the endstop back to correct polarity

              So Y axis might be:

              G91                       ; relative moves
               
              M574 Y1 S1 P"ystop"       ; proper endstop polarity
              G1 H1 Y-720 F1440         ; do homing move @1440
              G1 Y-2 F1440              ; touch more
              
              M574 Y1 S1 P"!ystop"      ; reverse polarity
              G1 H1 Y10 F360            ; home to release at quarter the speed
              
              G90                       ; return to absolute
              G92 Y0                    ; set zero
              M574 Y1 S1 P"ystop"       ; reset endstop polarity
              

              It seems to work on my sand table (which has a continuous rotation Y axis with optical endstop, so there's no mechanical limit to crash into). The endstop triggers over a range of about 6 units in Y, so this moves until it first triggers, moves one third into the triggered region, then backs out.

              It does actually seem a tidier home move (less of a dance).

              oliofundefined 1 Reply Last reply Reply Quote 1
              • oliofundefined
                oliof @achrn
                last edited by

                @achrn endstop inversion is a great idea! Much cleaner than my whole loop.

                I forgot about it even though I used it with a Z probe as X endstop on a machine for a while ...

                <>RatRig V-Minion Fly Super5Pro RRF<> V-Core 3.1 IDEX k*****r <> RatRig V-Minion SKR 2 Marlin<>

                1 Reply Last reply Reply Quote 0
                • achrnundefined
                  achrn
                  last edited by

                  Having thought about this more, I think it suits my sand table more than the 'classic' homing approach, so I'm going to adopt it. Thanks @R006 for highlighting it. (On teh other hand, 99% of the time I don't need the table homed on this axis - the pattern will just face a different direction, and it's truly unlimited continuous rotation mechanically.)

                  My previous code snippet misbehaves if the endstop is already triggered when first called and the 'touch more' movement drives it out of triggered, so I've actually adopted:

                  G91                       ; relative moves
                  M574 Y1 S1 P"ystop"       ; proper endstop polarity
                    
                  if sensors.endstops[1].triggered = false
                    G1 H1 Y-720 F1800       ; do homing move @1800 (5 rpm, 12 secs per rev)
                    G1 H2 Y-2 F1800         ; move slightly further - endstop zone is approx 6 wide
                  
                  M574 Y1 S1 P"!ystop"      ; reverse polarity
                  G1 H1 Y10 F360            ; home to release at 1 rpm
                  
                  G92 Y0                    ; set zero
                  M574 Y1 S1 P"ystop"       ; reset endstop polarity
                  G90                       ; absolute moves
                  
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA