Import LinuxCNC source tree
This commit is contained in:
4
tests/abort/stop-button-crazy-move/.gitignore
vendored
Normal file
4
tests/abort/stop-button-crazy-move/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
out.motion-logger
|
||||
rs274ngc.var
|
||||
rs274ngc.var.bak
|
||||
test.ngc
|
||||
9398
tests/abort/stop-button-crazy-move/3D_Chips.ngc
Normal file
9398
tests/abort/stop-button-crazy-move/3D_Chips.ngc
Normal file
File diff suppressed because it is too large
Load Diff
8
tests/abort/stop-button-crazy-move/README.md
Normal file
8
tests/abort/stop-button-crazy-move/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Test for movement after abort
|
||||
|
||||
Test for [issue #865][1], where an abort while interp is loading a
|
||||
long `.ngc` file, and a block restoring a state tag triggers a
|
||||
readahead bug where unflushed segments are appended to the interp
|
||||
list.
|
||||
|
||||
[1]: https://github.com/LinuxCNC/linuxcnc/issues/865
|
||||
3
tests/abort/stop-button-crazy-move/checkresult
Executable file
3
tests/abort/stop-button-crazy-move/checkresult
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# Python script exit indicates test success/fail
|
||||
exit 0
|
||||
3
tests/abort/stop-button-crazy-move/mock-motion.hal
Normal file
3
tests/abort/stop-button-crazy-move/mock-motion.hal
Normal file
@@ -0,0 +1,3 @@
|
||||
loadusr -W motion-logger out.motion-logger
|
||||
setp iocontrol.0.emc-enable-in 1
|
||||
|
||||
2
tests/abort/stop-button-crazy-move/postgui.hal
Normal file
2
tests/abort/stop-button-crazy-move/postgui.hal
Normal file
@@ -0,0 +1,2 @@
|
||||
net Xpos => test-ui.Xpos
|
||||
net Ypos => test-ui.Ypos
|
||||
3
tests/abort/stop-button-crazy-move/simpockets.tbl
Normal file
3
tests/abort/stop-button-crazy-move/simpockets.tbl
Normal file
@@ -0,0 +1,3 @@
|
||||
T1 P0 D0.125000 Z+1.000000 ;
|
||||
T10 P3 D0.500000 Z+3.000000 ;
|
||||
T99999 P50 Z+2.000000 ;
|
||||
126
tests/abort/stop-button-crazy-move/test-ui.py
Executable file
126
tests/abort/stop-button-crazy-move/test-ui.py
Executable file
@@ -0,0 +1,126 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import linuxcnc
|
||||
import linuxcnc_util
|
||||
import hal
|
||||
|
||||
import time
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Time increment and timeout, seconds
|
||||
TIME_INCR = 0.1
|
||||
TIMEOUT = 10.0
|
||||
|
||||
#
|
||||
# connect to LinuxCNC
|
||||
#
|
||||
|
||||
c = linuxcnc.command()
|
||||
s = linuxcnc.stat()
|
||||
e = linuxcnc.error_channel()
|
||||
l = linuxcnc_util.LinuxCNC(command=c, status=s, error=e)
|
||||
|
||||
|
||||
#
|
||||
# Create and connect test feedback comp
|
||||
#
|
||||
h = hal.component("test-ui")
|
||||
h.newpin("Xpos", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("Ypos", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.ready()
|
||||
os.system("halcmd source ./postgui.hal")
|
||||
|
||||
#
|
||||
# Come out of E-stop, turn the machine on, home
|
||||
#
|
||||
|
||||
c.state(linuxcnc.STATE_ESTOP_RESET)
|
||||
c.state(linuxcnc.STATE_ON)
|
||||
c.home(0)
|
||||
c.home(1)
|
||||
c.home(2)
|
||||
l.wait_for_home([1, 1, 1, 0, 0, 0, 0, 0, 0])
|
||||
|
||||
#
|
||||
# Print status function
|
||||
#
|
||||
|
||||
def print_stats(x = None, y = None):
|
||||
s.poll()
|
||||
if x is None:
|
||||
sys.stderr.write(
|
||||
"queue=%d; active_queue=%d; queue_full=%s;"
|
||||
" x=%.3f; y=%.3f\n" %
|
||||
(s.queue, s.active_queue, s.queue_full, h['Xpos'], h['Ypos']))
|
||||
else:
|
||||
sys.stderr.write(
|
||||
"queue=%d; active_queue=%d; queue_full=%s;"
|
||||
" x=%.3f(%.3f); y=%.3f(%.3f)\n" %
|
||||
(s.queue, s.active_queue, s.queue_full,
|
||||
h['Xpos'], x-h['Xpos'], h['Ypos'], y-h['Ypos']))
|
||||
|
||||
#
|
||||
# Set up tool and start position
|
||||
#
|
||||
c.mode(linuxcnc.MODE_MDI)
|
||||
c.mdi('T1M6') # Load tool 1
|
||||
c.mdi('G0 X2 Y2') # Move near to start
|
||||
c.wait_complete()
|
||||
start_time = time.time()
|
||||
while (abs(h['Xpos'] - 2) > .001) or (abs(h['Ypos'] - 2) > .001):
|
||||
if (time.time() - start_time) > TIMEOUT:
|
||||
sys.stderr.write("Failed to reach start position in time\n")
|
||||
os.system("halcmd show")
|
||||
sys.exit(1)
|
||||
time.sleep(TIME_INCR)
|
||||
sys.stderr.write("Starting at X=%.3f Y=%.3f\n" % (h["Xpos"], h["Ypos"]))
|
||||
|
||||
|
||||
#
|
||||
# Run the generated program, wait for motion to start and the queue to
|
||||
# fill up
|
||||
#
|
||||
c.mode(linuxcnc.MODE_AUTO)
|
||||
# c.program_open('test.ngc')
|
||||
c.program_open('3D_Chips.ngc')
|
||||
c.auto(linuxcnc.AUTO_RUN, 0)
|
||||
start_time = time.time()
|
||||
s.poll()
|
||||
while not (s.queue > 1000):
|
||||
if (time.time() - start_time) > TIMEOUT:
|
||||
sys.stderr.write("Failed to load segments from program\n")
|
||||
sys.exit(1)
|
||||
|
||||
print_stats()
|
||||
time.sleep(TIME_INCR)
|
||||
sys.stderr.write("Program partially loaded\n")
|
||||
|
||||
#
|
||||
# Now stop the program and wait for any additional motion
|
||||
#
|
||||
# Program X stepover is 2.5mm, or 0.1in; error out if the X stepover
|
||||
# exceeds 0.15 (fudge added to eliminate a legitimate stepover during
|
||||
# lag between cycles)
|
||||
|
||||
pre_stop_x, pre_stop_y = h['Xpos'], h['Ypos']
|
||||
c.abort()
|
||||
|
||||
start_time = time.time()
|
||||
last_x = pre_stop_x
|
||||
fail = False
|
||||
while (time.time() - start_time) < TIMEOUT and h['Xpos'] != last_x:
|
||||
print_stats(pre_stop_x, pre_stop_y)
|
||||
err = abs(pre_stop_x - h['Xpos'])
|
||||
if err > 0.15:
|
||||
sys.stderr.write(
|
||||
'ERROR: X axis motion stopped %.3f" past stop position\n' % err)
|
||||
fail = True
|
||||
last_x = h['Xpos']
|
||||
time.sleep(TIME_INCR)
|
||||
|
||||
if fail:
|
||||
sys.exit(1)
|
||||
|
||||
sys.stderr.write('Success\n')
|
||||
sys.exit(0)
|
||||
104
tests/abort/stop-button-crazy-move/test.ini
Normal file
104
tests/abort/stop-button-crazy-move/test.ini
Normal file
@@ -0,0 +1,104 @@
|
||||
[EMC]
|
||||
DEBUG = 0
|
||||
# DEBUG = 2147483647
|
||||
VERSION = 1.1
|
||||
|
||||
[DISPLAY]
|
||||
DISPLAY = ./test-ui.py
|
||||
|
||||
[TASK]
|
||||
TASK = milltask
|
||||
CYCLE_TIME = 0.001
|
||||
|
||||
[RS274NGC]
|
||||
PARAMETER_FILE = sim.var
|
||||
# LOG_LEVEL = 5
|
||||
|
||||
[EMCMOT]
|
||||
EMCMOT = motmod
|
||||
COMM_TIMEOUT = 4.0
|
||||
BASE_PERIOD = 0
|
||||
SERVO_PERIOD = 1000000
|
||||
|
||||
[HAL]
|
||||
HALFILE = LIB:core_sim.hal
|
||||
|
||||
[TRAJ]
|
||||
AXES = 3
|
||||
COORDINATES = X Y Z
|
||||
HOME = 0 0 0
|
||||
LINEAR_UNITS = inch
|
||||
ANGULAR_UNITS = degree
|
||||
DEFAULT_LINEAR_VELOCITY = 120
|
||||
MAX_LINEAR_VELOCITY = 400
|
||||
NO_FORCE_HOMING = 1
|
||||
|
||||
[EMCIO]
|
||||
TOOL_TABLE = simpockets.tbl
|
||||
TOOL_CHANGE_QUILL_UP = 1
|
||||
RANDOM_TOOLCHANGER = 1
|
||||
|
||||
[AXIS_X]
|
||||
HOME = 0.000
|
||||
MIN_LIMIT = -40.0
|
||||
MAX_LIMIT = 40.0
|
||||
MAX_VELOCITY = 400
|
||||
MAX_ACCELERATION = 100.0
|
||||
|
||||
[AXIS_Y]
|
||||
HOME = 0.000
|
||||
MIN_LIMIT = -40.0
|
||||
MAX_LIMIT = 40.0
|
||||
MAX_VELOCITY = 400
|
||||
MAX_ACCELERATION = 100.0
|
||||
|
||||
[AXIS_Z]
|
||||
HOME = 0.0
|
||||
MIN_LIMIT = -4.0
|
||||
MAX_LIMIT = 4.0
|
||||
MAX_VELOCITY = 400
|
||||
MAX_ACCELERATION = 100.0
|
||||
|
||||
[KINS]
|
||||
KINEMATICS = trivkins
|
||||
JOINTS = 3
|
||||
|
||||
[JOINT_0]
|
||||
TYPE = LINEAR
|
||||
HOME = 0.000
|
||||
MAX_VELOCITY = 400
|
||||
MAX_ACCELERATION = 100.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
|
||||
|
||||
[JOINT_1]
|
||||
TYPE = LINEAR
|
||||
HOME = 0.000
|
||||
MAX_VELOCITY = 400
|
||||
MAX_ACCELERATION = 100.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
|
||||
|
||||
[JOINT_2]
|
||||
TYPE = LINEAR
|
||||
HOME = 0.0
|
||||
MAX_VELOCITY = 400
|
||||
MAX_ACCELERATION = 100.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
|
||||
|
||||
7
tests/abort/stop-button-crazy-move/test.sh
Executable file
7
tests/abort/stop-button-crazy-move/test.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# Run test file in task
|
||||
linuxcnc -r test.ini
|
||||
RES=$?
|
||||
|
||||
exit $RES
|
||||
Reference in New Issue
Block a user