test: add a test of M61
This test uses a full LinuxCNC setup and a custom python test-ui. It commands M61 and verifies both that the IO tool-change pins don't act, and that the tool-related interp parameters reflect the requested tool when it's done. This test fails on v2.5.3-9-g5f7693a but passes after the m61-fix commits are applied. Thanks to Norbert (nieson) for reporting this bug.
This commit is contained in:
parent
5b6fe02ff7
commit
00b6ff4bec
7 changed files with 651 additions and 0 deletions
1
tests/toolchanger/m61/.gitignore
vendored
Normal file
1
tests/toolchanger/m61/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
sim.var.bak
|
||||||
2
tests/toolchanger/m61/checkresult
Executable file
2
tests/toolchanger/m61/checkresult
Executable file
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/sh
|
||||||
|
exit 0 # test failure is indicated by test.sh exit value
|
||||||
60
tests/toolchanger/m61/core_sim.hal
Normal file
60
tests/toolchanger/m61/core_sim.hal
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
# core HAL config file for simulation
|
||||||
|
|
||||||
|
# first load all the RT modules that will be needed
|
||||||
|
# kinematics
|
||||||
|
loadrt trivkins
|
||||||
|
# motion controller, get name and thread periods from ini file
|
||||||
|
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
|
||||||
|
# load 6 differentiators (for velocity and accel signals
|
||||||
|
loadrt ddt count=6
|
||||||
|
# load additional blocks
|
||||||
|
loadrt hypot count=2
|
||||||
|
loadrt comp count=3
|
||||||
|
loadrt or2 count=1
|
||||||
|
|
||||||
|
# add motion controller functions to servo thread
|
||||||
|
addf motion-command-handler servo-thread
|
||||||
|
addf motion-controller servo-thread
|
||||||
|
# link the differentiator functions into the code
|
||||||
|
addf ddt.0 servo-thread
|
||||||
|
addf ddt.1 servo-thread
|
||||||
|
addf ddt.2 servo-thread
|
||||||
|
addf ddt.3 servo-thread
|
||||||
|
addf ddt.4 servo-thread
|
||||||
|
addf ddt.5 servo-thread
|
||||||
|
addf hypot.0 servo-thread
|
||||||
|
addf hypot.1 servo-thread
|
||||||
|
|
||||||
|
# create HAL signals for position commands from motion module
|
||||||
|
# loop position commands back to motion module feedback
|
||||||
|
net Xpos axis.0.motor-pos-cmd => axis.0.motor-pos-fb ddt.0.in
|
||||||
|
net Ypos axis.1.motor-pos-cmd => axis.1.motor-pos-fb ddt.2.in
|
||||||
|
net Zpos axis.2.motor-pos-cmd => axis.2.motor-pos-fb ddt.4.in
|
||||||
|
|
||||||
|
# send the position commands thru differentiators to
|
||||||
|
# generate velocity and accel signals
|
||||||
|
net Xvel ddt.0.out => ddt.1.in hypot.0.in0
|
||||||
|
net Xacc <= ddt.1.out
|
||||||
|
net Yvel ddt.2.out => ddt.3.in hypot.0.in1
|
||||||
|
net Yacc <= ddt.3.out
|
||||||
|
net Zvel ddt.4.out => ddt.5.in hypot.1.in0
|
||||||
|
net Zacc <= ddt.5.out
|
||||||
|
|
||||||
|
# Cartesian 2- and 3-axis velocities
|
||||||
|
net XYvel hypot.0.out => hypot.1.in1
|
||||||
|
net XYZvel <= hypot.1.out
|
||||||
|
|
||||||
|
# estop loopback
|
||||||
|
net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in
|
||||||
|
|
||||||
|
# create signals for tool loading loopback
|
||||||
|
net tool-prepare <= iocontrol.0.tool-prepare
|
||||||
|
net tool-prepared => iocontrol.0.tool-prepared
|
||||||
|
|
||||||
|
net tool-change <= iocontrol.0.tool-change
|
||||||
|
net tool-changed => iocontrol.0.tool-changed
|
||||||
|
|
||||||
|
net tool-number <= iocontrol.0.tool-number
|
||||||
|
net tool-prep-number <= iocontrol.0.tool-prep-number
|
||||||
|
net tool-prep-pocket <= iocontrol.0.tool-prep-pocket
|
||||||
|
|
||||||
84
tests/toolchanger/m61/m61-test.ini
Normal file
84
tests/toolchanger/m61/m61-test.ini
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
[EMC]
|
||||||
|
DEBUG = 0x0
|
||||||
|
|
||||||
|
[DISPLAY]
|
||||||
|
DISPLAY = ./test-ui.py
|
||||||
|
|
||||||
|
[TASK]
|
||||||
|
TASK = milltask
|
||||||
|
CYCLE_TIME = 0.001
|
||||||
|
MDI_QUEUED_COMMANDS=10000
|
||||||
|
|
||||||
|
[RS274NGC]
|
||||||
|
PARAMETER_FILE = sim.var
|
||||||
|
USER_M_PATH = ./subs
|
||||||
|
|
||||||
|
[EMCMOT]
|
||||||
|
EMCMOT = motmod
|
||||||
|
COMM_TIMEOUT = 4.0
|
||||||
|
COMM_WAIT = 0.010
|
||||||
|
BASE_PERIOD = 0
|
||||||
|
SERVO_PERIOD = 1000000
|
||||||
|
|
||||||
|
[HAL]
|
||||||
|
HALUI = halui
|
||||||
|
HALFILE = core_sim.hal
|
||||||
|
POSTGUI_HALFILE = postgui.hal
|
||||||
|
|
||||||
|
[TRAJ]
|
||||||
|
NO_FORCE_HOMING=1
|
||||||
|
AXES = 3
|
||||||
|
COORDINATES = X Y Z
|
||||||
|
HOME = 0 0 0
|
||||||
|
LINEAR_UNITS = inch
|
||||||
|
ANGULAR_UNITS = degree
|
||||||
|
CYCLE_TIME = 0.010
|
||||||
|
DEFAULT_VELOCITY = 1.2
|
||||||
|
MAX_LINEAR_VELOCITY = 4
|
||||||
|
|
||||||
|
[AXIS_0]
|
||||||
|
TYPE = LINEAR
|
||||||
|
HOME = 0.000
|
||||||
|
MAX_VELOCITY = 4
|
||||||
|
MAX_ACCELERATION = 1000.0
|
||||||
|
BACKLASH = 0.000
|
||||||
|
INPUT_SCALE = 4000
|
||||||
|
OUTPUT_SCALE = 1.000
|
||||||
|
MIN_LIMIT = -40.0
|
||||||
|
MAX_LIMIT = 40.0
|
||||||
|
FERROR = 0.050
|
||||||
|
MIN_FERROR = 0.010
|
||||||
|
|
||||||
|
[AXIS_1]
|
||||||
|
TYPE = LINEAR
|
||||||
|
HOME = 0.000
|
||||||
|
MAX_VELOCITY = 4
|
||||||
|
MAX_ACCELERATION = 1000.0
|
||||||
|
BACKLASH = 0.000
|
||||||
|
INPUT_SCALE = 4000
|
||||||
|
OUTPUT_SCALE = 1.000
|
||||||
|
MIN_LIMIT = -40.0
|
||||||
|
MAX_LIMIT = 40.0
|
||||||
|
FERROR = 0.050
|
||||||
|
MIN_FERROR = 0.010
|
||||||
|
|
||||||
|
[AXIS_2]
|
||||||
|
TYPE = LINEAR
|
||||||
|
HOME = 0.0
|
||||||
|
MAX_VELOCITY = 4
|
||||||
|
MAX_ACCELERATION = 1000.0
|
||||||
|
BACKLASH = 0.000
|
||||||
|
INPUT_SCALE = 4000
|
||||||
|
OUTPUT_SCALE = 1.000
|
||||||
|
MIN_LIMIT = -4.0
|
||||||
|
MAX_LIMIT = 4.0
|
||||||
|
FERROR = 0.050
|
||||||
|
MIN_FERROR = 0.010
|
||||||
|
|
||||||
|
[EMCIO]
|
||||||
|
EMCIO = io
|
||||||
|
CYCLE_TIME = 0.100
|
||||||
|
TOOL_TABLE = simpockets.tbl
|
||||||
|
TOOL_CHANGE_QUILL_UP = 1
|
||||||
|
RANDOM_TOOLCHANGER = 0
|
||||||
|
|
||||||
11
tests/toolchanger/m61/postgui.hal
Normal file
11
tests/toolchanger/m61/postgui.hal
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
net tool-prepare => python-ui.tool-prepare
|
||||||
|
net tool-prepared <= python-ui.tool-prepared
|
||||||
|
|
||||||
|
net tool-change => python-ui.tool-change
|
||||||
|
net tool-changed <= python-ui.tool-changed
|
||||||
|
|
||||||
|
net tool-number => python-ui.tool-number
|
||||||
|
net tool-prep-number => python-ui.tool-prep-number
|
||||||
|
net tool-prep-pocket => python-ui.tool-prep-pocket
|
||||||
|
|
||||||
486
tests/toolchanger/m61/test-ui.py
Executable file
486
tests/toolchanger/m61/test-ui.py
Executable file
|
|
@ -0,0 +1,486 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import linuxcnc
|
||||||
|
import hal
|
||||||
|
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
# this is how long we wait for linuxcnc to do our bidding
|
||||||
|
timeout = 1.0
|
||||||
|
|
||||||
|
|
||||||
|
class LinuxcncError(Exception):
|
||||||
|
pass
|
||||||
|
# def __init__(self, value):
|
||||||
|
# self.value = value
|
||||||
|
# def __str__(self):
|
||||||
|
# return repr(self.value)
|
||||||
|
|
||||||
|
class LinuxcncControl:
|
||||||
|
'''
|
||||||
|
issue G-Code commands
|
||||||
|
make sure important modes are saved and restored
|
||||||
|
mode is saved only once, and can be restored only once
|
||||||
|
|
||||||
|
usage example:
|
||||||
|
e = emc_control()
|
||||||
|
e.prepare_for_mdi()
|
||||||
|
any internal sub using e.g("G0.....")
|
||||||
|
e.finish_mdi()
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.c = linuxcnc.command()
|
||||||
|
self.e = linuxcnc.error_channel()
|
||||||
|
self.s = linuxcnc.stat()
|
||||||
|
|
||||||
|
def running(self, do_poll=True):
|
||||||
|
'''
|
||||||
|
check wether interpreter is running.
|
||||||
|
If so, cant switch to MDI mode.
|
||||||
|
'''
|
||||||
|
if do_poll:
|
||||||
|
self.s.poll()
|
||||||
|
return (self.s.task_mode == linuxcnc.MODE_AUTO and
|
||||||
|
self.s.interp_state != linuxcnc.INTERP_IDLE)
|
||||||
|
|
||||||
|
def set_mode(self,m):
|
||||||
|
'''
|
||||||
|
set EMC mode if possible, else throw LinuxcncError
|
||||||
|
return current mode
|
||||||
|
'''
|
||||||
|
self.s.poll()
|
||||||
|
if self.s.task_mode == m :
|
||||||
|
return m
|
||||||
|
if self.running(do_poll=False):
|
||||||
|
raise LinuxcncError("interpreter running - cant change mode")
|
||||||
|
self.c.mode(m)
|
||||||
|
self.c.wait_complete()
|
||||||
|
return m
|
||||||
|
|
||||||
|
def set_state(self,m):
|
||||||
|
'''
|
||||||
|
set EMC mode if possible, else throw LinuxcncError
|
||||||
|
return current mode
|
||||||
|
'''
|
||||||
|
self.s.poll()
|
||||||
|
if self.s.task_mode == m :
|
||||||
|
return m
|
||||||
|
self.c.state(m)
|
||||||
|
self.c.wait_complete()
|
||||||
|
return m
|
||||||
|
|
||||||
|
def do_home(self,axismask):
|
||||||
|
self.s.poll()
|
||||||
|
self.c.home(axismask)
|
||||||
|
self.c.wait_complete()
|
||||||
|
|
||||||
|
|
||||||
|
def ok_for_mdi(self):
|
||||||
|
'''
|
||||||
|
check wether ok to run MDI commands.
|
||||||
|
'''
|
||||||
|
self.s.poll()
|
||||||
|
return not self.s.estop and self.s.enabled and self.s.homed
|
||||||
|
|
||||||
|
def prepare_for_mdi(self):
|
||||||
|
'''
|
||||||
|
check wether ok to run MDI commands.
|
||||||
|
throw LinuxcncError if told so.
|
||||||
|
return current mode
|
||||||
|
'''
|
||||||
|
|
||||||
|
self.s.poll()
|
||||||
|
if self.s.estop:
|
||||||
|
raise LinuxcncError("machine in ESTOP")
|
||||||
|
|
||||||
|
if not self.s.enabled:
|
||||||
|
raise LinuxcncError("machine not enabled")
|
||||||
|
|
||||||
|
if not self.s.homed:
|
||||||
|
raise LinuxcncError("machine not homed")
|
||||||
|
|
||||||
|
if self.running():
|
||||||
|
raise LinuxcncError("interpreter not idle")
|
||||||
|
|
||||||
|
return self.set_mode(linuxcnc.MODE_MDI)
|
||||||
|
|
||||||
|
g_raise_except = True
|
||||||
|
|
||||||
|
def g(self,code,wait=False):
|
||||||
|
'''
|
||||||
|
issue G-Code as MDI command.
|
||||||
|
wait for completion if reqested
|
||||||
|
'''
|
||||||
|
|
||||||
|
self.c.mdi(code)
|
||||||
|
if wait:
|
||||||
|
try:
|
||||||
|
while self.c.wait_complete() == -1:
|
||||||
|
pass
|
||||||
|
return True
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print "interrupted by keyboard in c.wait_complete()"
|
||||||
|
return False
|
||||||
|
|
||||||
|
self.error = self.e.poll()
|
||||||
|
if self.error:
|
||||||
|
kind, text = self.error
|
||||||
|
if kind in (linuxcnc.NML_ERROR, linuxcnc.OPERATOR_ERROR):
|
||||||
|
if LinuxcncControl.g_raise_except:
|
||||||
|
raise LinuxcncError(text)
|
||||||
|
else:
|
||||||
|
print ("error " + text)
|
||||||
|
else:
|
||||||
|
print ("info " + text)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def get_current_tool(self):
|
||||||
|
self.s.poll()
|
||||||
|
return self.s.tool_in_spindle
|
||||||
|
|
||||||
|
def active_codes(self):
|
||||||
|
self.e.poll()
|
||||||
|
return self.s.gcodes
|
||||||
|
|
||||||
|
def get_current_system(self):
|
||||||
|
g = self.active_codes()
|
||||||
|
for i in g:
|
||||||
|
if i >= 540 and i <= 590:
|
||||||
|
return i/10 - 53
|
||||||
|
elif i >= 590 and i <= 593:
|
||||||
|
return i - 584
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
def introspect():
|
||||||
|
#print "joint.0.select =", h['joint-0-select']
|
||||||
|
#print "joint.0.selected =", h['joint-0-selected']
|
||||||
|
#print "joint.0.position =", h['joint-0-position']
|
||||||
|
|
||||||
|
#os.system("halcmd show pin iocontrol")
|
||||||
|
os.system("halcmd show pin python-ui")
|
||||||
|
#os.system("halcmd show sig")
|
||||||
|
|
||||||
|
|
||||||
|
def wait_for_pin_value(pin_name, value, timeout=1):
|
||||||
|
print "waiting for %s to go to %f (timeout=%f)" % (pin_name, value, timeout)
|
||||||
|
|
||||||
|
start = time.time()
|
||||||
|
while (h[pin_name] != value) and ((time.time() - start) < timeout):
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if h[pin_name] != value:
|
||||||
|
print "timeout! pin %s didn't get to %f" % (pin_name, value)
|
||||||
|
introspect()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
print "pin %s went to %f!" % (pin_name, value)
|
||||||
|
|
||||||
|
|
||||||
|
def verify_pin_value(pin_name, value):
|
||||||
|
if (h[pin_name] != value):
|
||||||
|
print "pin %s is not %f" % (pin_name, value)
|
||||||
|
sys.exit(1);
|
||||||
|
|
||||||
|
print "pin %s is %f" % (pin_name, value)
|
||||||
|
|
||||||
|
|
||||||
|
def get_interp_param(param_number):
|
||||||
|
e.c.mdi("(debug, #%d)" % param_number)
|
||||||
|
while e.c.wait_complete() == -1:
|
||||||
|
pass
|
||||||
|
|
||||||
|
error = e.e.poll()
|
||||||
|
if error:
|
||||||
|
kind, text = error
|
||||||
|
if kind == linuxcnc.OPERATOR_DISPLAY:
|
||||||
|
return float(text)
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def verify_interp_param(param_number, expected_value):
|
||||||
|
param_value = get_interp_param(param_number)
|
||||||
|
print "interp param #%d = %f (expecting %f)" % (param_number, param_value, expected_value)
|
||||||
|
if param_value != expected_value:
|
||||||
|
print "ERROR: interp param #%d = %f, expected %f" % (param_number, param_value, expected_value)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def verify_stable_pin_values(pins, duration=1):
|
||||||
|
start = time.time()
|
||||||
|
while (time.time() - start) < duration:
|
||||||
|
for pin_name in pins.keys():
|
||||||
|
val = h[pin_name]
|
||||||
|
if val != pins[pin_name]:
|
||||||
|
print "ERROR: pin %s = %f (expected %f)" % (pin_name, val, pin[pin_name])
|
||||||
|
sys.exit(1)
|
||||||
|
time.sleep(0.010)
|
||||||
|
|
||||||
|
|
||||||
|
def select_joint(name):
|
||||||
|
print " selecting", name
|
||||||
|
|
||||||
|
h[name + '-select'] = 1
|
||||||
|
start = time.time()
|
||||||
|
while (h[name + '-selected'] == 0) and ((time.time() - start) < timeout):
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if h[name + '-selected'] == 0:
|
||||||
|
print "failed to select", name, "in halui"
|
||||||
|
introspect(h)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
h[name + '-select'] = 0
|
||||||
|
|
||||||
|
|
||||||
|
def jog_minus(name, target):
|
||||||
|
start_position = h[name + '-position']
|
||||||
|
print " jogging", name, "negative: to %.3f" % (target)
|
||||||
|
|
||||||
|
h['jog-selected-minus'] = 1
|
||||||
|
|
||||||
|
start = time.time()
|
||||||
|
while (h[name + '-position'] > target) and ((time.time() - start) < timeout):
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if h[name + '-position'] > target:
|
||||||
|
print name, "failed to jog", name, "to", target
|
||||||
|
introspect(h)
|
||||||
|
return False
|
||||||
|
|
||||||
|
h['jog-selected-minus'] = 0
|
||||||
|
|
||||||
|
print " jogged %s negative past target %.3f" % (name, target)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def jog_plus(name, target):
|
||||||
|
start_position = h[name + '-position']
|
||||||
|
print " jogging %s positive: to %.3f" % (name, target)
|
||||||
|
|
||||||
|
h['jog-selected-plus'] = 1
|
||||||
|
|
||||||
|
start = time.time()
|
||||||
|
while (h[name + '-position'] < target) and ((time.time() - start) < timeout):
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if h[name + '-position'] < target:
|
||||||
|
print name, "failed to jog", name, "to", target
|
||||||
|
introspect(h)
|
||||||
|
return False
|
||||||
|
|
||||||
|
h['jog-selected-plus'] = 0
|
||||||
|
|
||||||
|
print " jogged %s positive past target %.3f)" % (name, target)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def jog_joint(joint_number, target):
|
||||||
|
success = True
|
||||||
|
|
||||||
|
joint = []
|
||||||
|
for j in range(0,3):
|
||||||
|
joint.append(h['joint-%d-position' % j])
|
||||||
|
|
||||||
|
name = 'joint-%d' % joint_number
|
||||||
|
|
||||||
|
print "jogging", name, "to", target
|
||||||
|
select_joint(name)
|
||||||
|
|
||||||
|
if h[name + '-position'] > target:
|
||||||
|
jog_minus(name, target)
|
||||||
|
else:
|
||||||
|
jog_plus(name, target)
|
||||||
|
|
||||||
|
for j in range(0,3):
|
||||||
|
pin_name = 'joint-%d-position' % j
|
||||||
|
if j == joint_number:
|
||||||
|
if joint[j] == h[pin_name]:
|
||||||
|
print "joint", str(j), "didn't move but should have!"
|
||||||
|
success = False
|
||||||
|
else:
|
||||||
|
if joint[j] != h[pin_name]:
|
||||||
|
print "joint", str(j), "moved from %.3f to %.3f but shouldnt have!" % (joint[j], h[pin_name])
|
||||||
|
success = False
|
||||||
|
|
||||||
|
|
||||||
|
# give the joint time to stop
|
||||||
|
# FIXME: close the loop here
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
if not success:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# set up pins
|
||||||
|
# shell out to halcmd to make nets to halui and motion
|
||||||
|
#
|
||||||
|
|
||||||
|
h = hal.component("python-ui")
|
||||||
|
|
||||||
|
h.newpin("tool-number", hal.HAL_S32, hal.HAL_IN)
|
||||||
|
h.newpin("tool-prep-number", hal.HAL_S32, hal.HAL_IN)
|
||||||
|
h.newpin("tool-prep-pocket", hal.HAL_S32, hal.HAL_IN)
|
||||||
|
|
||||||
|
h.newpin("tool-prepare", hal.HAL_BIT, hal.HAL_IN)
|
||||||
|
h.newpin("tool-prepared", hal.HAL_BIT, hal.HAL_OUT)
|
||||||
|
|
||||||
|
h.newpin("tool-change", hal.HAL_BIT, hal.HAL_IN)
|
||||||
|
h.newpin("tool-changed", hal.HAL_BIT, hal.HAL_OUT)
|
||||||
|
|
||||||
|
h.ready() # mark the component as 'ready'
|
||||||
|
|
||||||
|
os.system("halcmd source ./postgui.hal")
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# connect to LinuxCNC
|
||||||
|
#
|
||||||
|
|
||||||
|
e = LinuxcncControl()
|
||||||
|
e.set_state(linuxcnc.STATE_ESTOP_RESET)
|
||||||
|
e.set_state(linuxcnc.STATE_ON)
|
||||||
|
e.set_mode(linuxcnc.MODE_MDI)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# test m6 to get a baseline
|
||||||
|
#
|
||||||
|
|
||||||
|
e.g('t1 m6')
|
||||||
|
|
||||||
|
# prepare for tool change
|
||||||
|
wait_for_pin_value('tool-prepare', 1)
|
||||||
|
verify_pin_value('tool-prep-number', 1)
|
||||||
|
verify_pin_value('tool-prep-pocket', 1)
|
||||||
|
h['tool-prepared'] = 1
|
||||||
|
wait_for_pin_value('tool-prepare', 0)
|
||||||
|
h['tool-prepared'] = 0
|
||||||
|
|
||||||
|
time.sleep(0.1)
|
||||||
|
e.s.poll()
|
||||||
|
print "tool prepare done, e.s.pocket_prepped = ", e.s.pocket_prepped
|
||||||
|
|
||||||
|
# change tool
|
||||||
|
wait_for_pin_value('tool-change', 1)
|
||||||
|
h['tool-changed'] = 1
|
||||||
|
wait_for_pin_value('tool-change', 0)
|
||||||
|
h['tool-changed'] = 0
|
||||||
|
|
||||||
|
time.sleep(0.1)
|
||||||
|
e.s.poll()
|
||||||
|
print "tool change done, e.s.tool_in_spindle = ", e.s.tool_in_spindle
|
||||||
|
print "current tool: ", e.get_current_tool()
|
||||||
|
|
||||||
|
verify_interp_param(5400, 1) # tool in spindle
|
||||||
|
verify_interp_param(5401, 0) # tlo x
|
||||||
|
verify_interp_param(5402, 0) # tlo y
|
||||||
|
verify_interp_param(5403, 1) # tlo z
|
||||||
|
verify_interp_param(5404, 0) # tlo a
|
||||||
|
verify_interp_param(5405, 0) # tlo b
|
||||||
|
verify_interp_param(5406, 0) # tlo c
|
||||||
|
verify_interp_param(5407, 0) # tlo u
|
||||||
|
verify_interp_param(5408, 0) # tlo v
|
||||||
|
verify_interp_param(5409, 0) # tlo w
|
||||||
|
verify_interp_param(5410, 0.125) # tool diameter
|
||||||
|
verify_interp_param(5411, 0) # front angle
|
||||||
|
verify_interp_param(5412, 0) # back angle
|
||||||
|
verify_interp_param(5413, 0) # tool orientation
|
||||||
|
|
||||||
|
verify_interp_param(5420, 0) # current x
|
||||||
|
verify_interp_param(5421, 0) # current y
|
||||||
|
verify_interp_param(5422, 0) # current z
|
||||||
|
verify_interp_param(5423, 0) # current a
|
||||||
|
verify_interp_param(5424, 0) # current b
|
||||||
|
verify_interp_param(5425, 0) # current c
|
||||||
|
verify_interp_param(5426, 0) # current u
|
||||||
|
verify_interp_param(5427, 0) # current v
|
||||||
|
verify_interp_param(5428, 0) # current w
|
||||||
|
|
||||||
|
e.g('g43')
|
||||||
|
|
||||||
|
verify_interp_param(5420, 0) # current x
|
||||||
|
verify_interp_param(5421, 0) # current y
|
||||||
|
verify_interp_param(5422, -1) # current z
|
||||||
|
verify_interp_param(5423, 0) # current a
|
||||||
|
verify_interp_param(5424, 0) # current b
|
||||||
|
verify_interp_param(5425, 0) # current c
|
||||||
|
verify_interp_param(5426, 0) # current u
|
||||||
|
verify_interp_param(5427, 0) # current v
|
||||||
|
verify_interp_param(5428, 0) # current w
|
||||||
|
|
||||||
|
introspect()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# now finally test m61
|
||||||
|
#
|
||||||
|
|
||||||
|
e.g('m61 q10')
|
||||||
|
|
||||||
|
verify_stable_pin_values(
|
||||||
|
{
|
||||||
|
'tool-change': 0,
|
||||||
|
'tool-prep-number': 0,
|
||||||
|
'tool-prep-pocket': 0,
|
||||||
|
'tool-prepare': 0
|
||||||
|
},
|
||||||
|
duration=1
|
||||||
|
)
|
||||||
|
|
||||||
|
print "m61 done, e.s.tool_in_spindle = ", e.s.tool_in_spindle
|
||||||
|
print "current tool: ", e.get_current_tool()
|
||||||
|
|
||||||
|
verify_interp_param(5400, 10) # tool in spindle
|
||||||
|
verify_interp_param(5401, 0) # tlo x
|
||||||
|
verify_interp_param(5402, 0) # tlo y
|
||||||
|
verify_interp_param(5403, 3) # tlo z
|
||||||
|
verify_interp_param(5404, 0) # tlo a
|
||||||
|
verify_interp_param(5405, 0) # tlo b
|
||||||
|
verify_interp_param(5406, 0) # tlo c
|
||||||
|
verify_interp_param(5407, 0) # tlo u
|
||||||
|
verify_interp_param(5408, 0) # tlo v
|
||||||
|
verify_interp_param(5409, 0) # tlo w
|
||||||
|
verify_interp_param(5410, 0.500) # tool diameter
|
||||||
|
verify_interp_param(5411, 0) # front angle
|
||||||
|
verify_interp_param(5412, 0) # back angle
|
||||||
|
verify_interp_param(5413, 0) # tool orientation
|
||||||
|
|
||||||
|
verify_interp_param(5420, 0) # current x
|
||||||
|
verify_interp_param(5421, 0) # current y
|
||||||
|
verify_interp_param(5422, -1) # current z
|
||||||
|
verify_interp_param(5423, 0) # current a
|
||||||
|
verify_interp_param(5424, 0) # current b
|
||||||
|
verify_interp_param(5425, 0) # current c
|
||||||
|
verify_interp_param(5426, 0) # current u
|
||||||
|
verify_interp_param(5427, 0) # current v
|
||||||
|
verify_interp_param(5428, 0) # current w
|
||||||
|
|
||||||
|
e.g('g43')
|
||||||
|
|
||||||
|
verify_interp_param(5420, 0) # current x
|
||||||
|
verify_interp_param(5421, 0) # current y
|
||||||
|
verify_interp_param(5422, -3) # current z
|
||||||
|
verify_interp_param(5423, 0) # current a
|
||||||
|
verify_interp_param(5424, 0) # current b
|
||||||
|
verify_interp_param(5425, 0) # current c
|
||||||
|
verify_interp_param(5426, 0) # current u
|
||||||
|
verify_interp_param(5427, 0) # current v
|
||||||
|
verify_interp_param(5428, 0) # current w
|
||||||
|
|
||||||
|
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
7
tests/toolchanger/m61/test.sh
Executable file
7
tests/toolchanger/m61/test.sh
Executable file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cp -f ../simpockets.tbl.orig simpockets.tbl
|
||||||
|
|
||||||
|
linuxcnc -r m61-test.ini
|
||||||
|
exit $?
|
||||||
|
|
||||||
Loading…
Reference in a new issue