The homing / limits configuration is very confusing at present, which I think is largely due to the manual.
(I'm using Master on Debian Stretch)
My setup:
Lathe
Z axis: 245mm travel, limit switch at full positive travel
X axis: 95mm travel, limit switch at full positive travel
(That is limit switches at position furthest away from chuck).
Using limit switch as homing switch
To make things easy to understand, I want machine 0,0 to be at full positive travel, and all travel towards the chuck to be negative (similar to how a Z axis on a mill is usually 0 at the top, with all moves down being negative).
I was trying to follow the manual:
linuxcnc.org/docs/html/config/ini-homing.html
3.6. HOME_OFFSET
Contains the location of the home switch or index pulse, in joint coordinates. It can also be treated as the distance between the point where the switch or index pulse is latched and the zero point of the joint. After detecting the index pulse, LinuxCNC sets the joint coordinate of the current point to HOME_OFFSET. The default value is zero.
Note - The home switch location, as indicated by the HOME_OFFSET variable, must be strictly within the soft limits. That is, MIN_LIMIT < HOME_OFFSET < MAX_LIMIT.
This does not work
Following this resulted in the limit switch being
within the soft limits, and the machine would happily jog into the limit switch.
What works is (Z axis):
MIN_LIMIT = -245
MAX_LIMIT = 0
HOME = -0.01
HOME_OFFSET = 1
HOME_SEARCH_VEL = 10
HOME_LATCH_VEL = -0.25
HOME_FINAL_VEL = 0.000000
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 1
Note that HOME_OFFSET is
greater than my MAX_LIMIT.
The above works as predicted - the machine homes, and sets the home switch (limit switch) position to 1 in machine coordinates. The soft limits are set to -245 to 0mm. The machine will not jog into the limit switch.
In case others would like an explanation of what happens:
When homing is commanded:
1. Moves towards the home (limit) switch at 10units/sec (HOME_SEARCH_VEL) until switch triggers
2. Moves
away from home switch at 0.25units/sec (HOME_LATCH_VEL, note the minus to command a negative move) until the switch releases.
3. This position is set to HOME_OFFSET. That is, when the switch releases, that position on the axis is now called 1mm (in my case), defining where the axis travel / scale is in relation to the home switch.
4. The machine moves to HOME - which is just within the soft travel limits.
The manual needs clarification and more information about the relationship between MIN_LIMIT, MAX_LIMIT, HOME, HOME_OFFSET
The diagrams are good, but should included a reference to MAX_LIMIT to clarify things.
I suspect the note is really meant to be about HOME, not HOME_OFFSET. If you try to have a HOME position that is not between MIN_LIMIT and MAX_LIMIT, you get errors.
On another note, I think there is a bug (potentially in gmoccapy), which was not letting me use the override limits to jog off a limit switch.
The machine is on a limit switch (giving "joint 1 on limit switch error")
The override limits check box is available. When I try to check the override box, the error "No limit switch is active, ignore limits will not be set". Therefore I can't enable the machine to jog it off the limit switch!