Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/emc/motion/homing.c
Original file line number Diff line number Diff line change
Expand Up @@ -1603,9 +1603,13 @@ static int base_1joint_state_machine(int joint_num)
break;

case HOME_ABORT:
/* stop every joint; joints that finished homing stay homed,
the others were unhomed when the command started */
for(int i = 0; i < all_joints; i++) {
if (H[i].homing) {
H[i].homed = 0;
}
H[i].homing = 0;
H[i].homed = 0;
H[i].joint_in_sequence = 0;
joints[i].free_tp.enable = 0;
H[i].home_state = HOME_IDLE;
Expand Down
30 changes: 26 additions & 4 deletions tests/home-dist/test-ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ def pos(j):
return hal.get_value("joint.%d.motor-pos-cmd" % j)


def home(joint, label, expect):
def home(joint, label, expect, keep=()):
# Home 'joint', wait for the homing to end, check that the expected
# message came and that the machine is still on and unhomed.
# message came, that the machine is still on, and that only the
# joints in 'keep' are homed.
start = [pos(j) for j in range(3)]
errors()
c.teleop_enable(0)
Expand Down Expand Up @@ -95,8 +96,9 @@ def home(joint, label, expect):
sys.stdout.flush()
if not any(expect in m for m in msgs):
fail("%s: no error containing '%s'" % (label, expect))
if any(s.homed[:3]):
fail("%s: a joint reports homed" % label)
for j in range(3):
if s.homed[j] != (j in keep):
fail("%s: joint %d homed=%d" % (label, j, s.homed[j]))
if s.task_state != linuxcnc.STATE_ON:
fail("%s: machine is no longer on" % label)
return start, farthest, end
Expand Down Expand Up @@ -172,6 +174,26 @@ def check_moved(label, j, start, farthest, dist):
else:
print("%-28s homed" % "working switch")

# A failed home of the pair stops it but leaves joint 0 homed: an abort
# unhomes only the joints that had not finished homing.
start, farthest, end = home(1, "pair fails, joint 0 homed", "did not clear", keep=(0,))

# Same in a Home All: joint 0 homes first and stays homed when the pair
# fails after it.
c.teleop_enable(0)
c.wait_complete()
c.home(-1)
c.wait_complete()
if not wait_for(lambda: any(j["homing"] for j in s.joint[1:3]), 20.0):
fail("home all: the pair did not start homing")
if not wait_for(lambda: not any(j["homing"] for j in s.joint[:3]), 20.0):
fail("home all: homing did not end")
elif not s.homed[0] or s.homed[1] or s.homed[2]:
fail("home all, pair fails: homed=%d,%d,%d, expected 1,0,0" % tuple(s.homed[:3]))
else:
print("%-28s joint 0 still homed" % "home all, pair fails")
errors()

c.state(linuxcnc.STATE_ESTOP)
c.wait_complete()

Expand Down