Import LinuxCNC source tree

This commit is contained in:
Wang Dequan
2026-08-20 06:17:39 +08:00
commit 2c814634c3
9429 changed files with 10556013 additions and 0 deletions

5
tests/motion-logger/basic/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
result.*
sim.var*
out.motion-logger
expected.builtin-startup

View File

@@ -0,0 +1,14 @@
This directory uses the "motion-logger" test program to log the Motion
commands that come out of Task, as a result of running various ngc
G-code files.
Each test consists of a file named "$TEST.ngc" and a matching file named
"expected.$TEST". The $TEST.ngc file is run, and the resulting Motion
commands are logged to a file named "result.$TEST". If there is any
discrepancy, the test fails.
In between running each .ngc file, a special file named "reset.ngc"
is run, intending to restore Task, Interp, and the Canon interface to
their default startup state, to be ready to run the next .ngc file.

View File

@@ -0,0 +1,4 @@
#!/bin/sh
# Success or failure of this test is handled in the test.sh script, if we
# get this far it's a success.
exit 0

View File

@@ -0,0 +1,227 @@
SET_NUM_JOINTS 9
SET_NUM_SPINDLES 1
SET_VEL vel=0, ini_maxvel=1.2
SET_VEL_LIMIT vel=4
SET_ACC acc=1e+99
SET_JERK jerk=1e+09
SET_PLANNER_TYPE planner_type=0
SET_SCURVE_PEAK_SCALE scale=1
SETUP_ARC_BLENDS
SET_MAX_FEED_OVERRIDE 1
SETUP_SET_PROBE_ERR_INHIBIT 0 0
SET_WORLD_HOME x=0, y=0, z=0, a=0, b=0, c=0, u=0, v=0, w=0
SET_JOINT_BACKLASH joint=0, backlash=0
SET_JOINT_POSITION_LIMITS joint=0, min=-40, max=0
SET_JOINT_POSITION_LIMITS joint=0, min=-40, max=40
SET_JOINT_MAX_FERROR joint=0, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=0, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=0, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=0, vel=4
SET_JOINT_ACC_LIMIT joint=0, acc=1000
SET_JOINT_JERK_LIMIT joint=0, jerk=0
JOINT_ACTIVATE joint=0
SET_JOINT_BACKLASH joint=1, backlash=0
SET_JOINT_POSITION_LIMITS joint=1, min=-40, max=0
SET_JOINT_POSITION_LIMITS joint=1, min=-40, max=40
SET_JOINT_MAX_FERROR joint=1, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=1, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=1, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=1, vel=4
SET_JOINT_ACC_LIMIT joint=1, acc=1000
SET_JOINT_JERK_LIMIT joint=1, jerk=0
JOINT_ACTIVATE joint=1
SET_JOINT_BACKLASH joint=2, backlash=0
SET_JOINT_POSITION_LIMITS joint=2, min=-4, max=0
SET_JOINT_POSITION_LIMITS joint=2, min=-4, max=4
SET_JOINT_MAX_FERROR joint=2, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=2, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=2, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=2, vel=4
SET_JOINT_ACC_LIMIT joint=2, acc=1000
SET_JOINT_JERK_LIMIT joint=2, jerk=0
JOINT_ACTIVATE joint=2
SET_JOINT_BACKLASH joint=3, backlash=0
SET_JOINT_POSITION_LIMITS joint=3, min=-40, max=0
SET_JOINT_POSITION_LIMITS joint=3, min=-40, max=40
SET_JOINT_MAX_FERROR joint=3, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=3, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=3, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=3, vel=4
SET_JOINT_ACC_LIMIT joint=3, acc=1000
SET_JOINT_JERK_LIMIT joint=3, jerk=0
JOINT_ACTIVATE joint=3
SET_JOINT_BACKLASH joint=4, backlash=0
SET_JOINT_POSITION_LIMITS joint=4, min=-40, max=0
SET_JOINT_POSITION_LIMITS joint=4, min=-40, max=40
SET_JOINT_MAX_FERROR joint=4, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=4, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=4, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=4, vel=4
SET_JOINT_ACC_LIMIT joint=4, acc=1000
SET_JOINT_JERK_LIMIT joint=4, jerk=0
JOINT_ACTIVATE joint=4
SET_JOINT_BACKLASH joint=5, backlash=0
SET_JOINT_POSITION_LIMITS joint=5, min=-4, max=0
SET_JOINT_POSITION_LIMITS joint=5, min=-4, max=4
SET_JOINT_MAX_FERROR joint=5, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=5, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=5, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=5, vel=4
SET_JOINT_ACC_LIMIT joint=5, acc=1000
SET_JOINT_JERK_LIMIT joint=5, jerk=0
JOINT_ACTIVATE joint=5
SET_JOINT_BACKLASH joint=6, backlash=0
SET_JOINT_POSITION_LIMITS joint=6, min=-40, max=0
SET_JOINT_POSITION_LIMITS joint=6, min=-40, max=40
SET_JOINT_MAX_FERROR joint=6, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=6, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=6, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=6, vel=4
SET_JOINT_ACC_LIMIT joint=6, acc=1000
SET_JOINT_JERK_LIMIT joint=6, jerk=0
JOINT_ACTIVATE joint=6
SET_JOINT_BACKLASH joint=7, backlash=0
SET_JOINT_POSITION_LIMITS joint=7, min=-40, max=0
SET_JOINT_POSITION_LIMITS joint=7, min=-40, max=40
SET_JOINT_MAX_FERROR joint=7, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=7, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=7, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=7, vel=4
SET_JOINT_ACC_LIMIT joint=7, acc=1000
SET_JOINT_JERK_LIMIT joint=7, jerk=0
JOINT_ACTIVATE joint=7
SET_JOINT_BACKLASH joint=8, backlash=0
SET_JOINT_POSITION_LIMITS joint=8, min=-4, max=0
SET_JOINT_POSITION_LIMITS joint=8, min=-4, max=4
SET_JOINT_MAX_FERROR joint=8, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=8, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=8, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=8, vel=4
SET_JOINT_ACC_LIMIT joint=8, acc=1000
SET_JOINT_JERK_LIMIT joint=8, jerk=0
JOINT_ACTIVATE joint=8
SET_AXIS_POSITION_LIMITS axis=0, min=-40, max=0
SET_AXIS_POSITION_LIMITS axis=0, min=-40, max=40
SET_AXIS_VEL_LIMIT axis=0 vel=4
SET_AXIS_ACC_LIMIT axis=0, acc=1000
SET_AXIS_LOCKING_JOINT axis=0, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=0, jerk=0
SET_AXIS_POSITION_LIMITS axis=1, min=-40, max=0
SET_AXIS_POSITION_LIMITS axis=1, min=-40, max=40
SET_AXIS_VEL_LIMIT axis=1 vel=4
SET_AXIS_ACC_LIMIT axis=1, acc=1000
SET_AXIS_LOCKING_JOINT axis=1, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=1, jerk=0
SET_AXIS_POSITION_LIMITS axis=2, min=-4, max=0
SET_AXIS_POSITION_LIMITS axis=2, min=-4, max=4
SET_AXIS_VEL_LIMIT axis=2 vel=4
SET_AXIS_ACC_LIMIT axis=2, acc=1000
SET_AXIS_LOCKING_JOINT axis=2, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=2, jerk=0
SET_AXIS_POSITION_LIMITS axis=3, min=-40, max=0
SET_AXIS_POSITION_LIMITS axis=3, min=-40, max=40
SET_AXIS_VEL_LIMIT axis=3 vel=4
SET_AXIS_ACC_LIMIT axis=3, acc=1000
SET_AXIS_LOCKING_JOINT axis=3, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=3, jerk=0
SET_AXIS_POSITION_LIMITS axis=4, min=-40, max=0
SET_AXIS_POSITION_LIMITS axis=4, min=-40, max=40
SET_AXIS_VEL_LIMIT axis=4 vel=4
SET_AXIS_ACC_LIMIT axis=4, acc=1000
SET_AXIS_LOCKING_JOINT axis=4, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=4, jerk=0
SET_AXIS_POSITION_LIMITS axis=5, min=-4, max=0
SET_AXIS_POSITION_LIMITS axis=5, min=-4, max=4
SET_AXIS_VEL_LIMIT axis=5 vel=4
SET_AXIS_ACC_LIMIT axis=5, acc=1000
SET_AXIS_LOCKING_JOINT axis=5, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=5, jerk=0
SET_AXIS_POSITION_LIMITS axis=6, min=-40, max=0
SET_AXIS_POSITION_LIMITS axis=6, min=-40, max=40
SET_AXIS_VEL_LIMIT axis=6 vel=4
SET_AXIS_ACC_LIMIT axis=6, acc=1000
SET_AXIS_LOCKING_JOINT axis=6, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=6, jerk=0
SET_AXIS_POSITION_LIMITS axis=7, min=-40, max=0
SET_AXIS_POSITION_LIMITS axis=7, min=-40, max=40
SET_AXIS_VEL_LIMIT axis=7 vel=4
SET_AXIS_ACC_LIMIT axis=7, acc=1000
SET_AXIS_LOCKING_JOINT axis=7, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=7, jerk=0
SET_AXIS_POSITION_LIMITS axis=8, min=-4, max=0
SET_AXIS_POSITION_LIMITS axis=8, min=-4, max=4
SET_AXIS_VEL_LIMIT axis=8 vel=4
SET_AXIS_ACC_LIMIT axis=8, acc=1000
SET_AXIS_LOCKING_JOINT axis=8, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=8, jerk=0
SET_SPINDLE_PARAMS, 1.00e+99, 0.00e+00, -1.00e+99, 0.00e+00
JOG_ABORT joint=0
JOG_ABORT joint=1
JOG_ABORT joint=2
JOG_ABORT joint=3
JOG_ABORT joint=4
JOG_ABORT joint=5
JOG_ABORT joint=6
JOG_ABORT joint=7
JOG_ABORT joint=8
JOG_ABORT joint=9
JOG_ABORT joint=10
JOG_ABORT joint=11
JOG_ABORT joint=12
JOG_ABORT joint=13
JOG_ABORT joint=14
JOG_ABORT joint=15
ABORT
SPINDLE_OFF
DISABLE
JOINT_UNHOME joint=-2
FREE
JOG_ABORT joint=0
JOG_ABORT joint=1
JOG_ABORT joint=2
JOG_ABORT joint=3
JOG_ABORT joint=4
JOG_ABORT joint=5
JOG_ABORT joint=6
JOG_ABORT joint=7
JOG_ABORT joint=8
JOG_ABORT joint=9
JOG_ABORT joint=10
JOG_ABORT joint=11
JOG_ABORT joint=12
JOG_ABORT joint=13
JOG_ABORT joint=14
JOG_ABORT joint=15
ABORT
SPINDLE_OFF
#
# The test UI then sends an NML command to move Task to the On state, which
# turns on Motion and all the amps.
#
ENABLE
#
# The test UI finally switches mode to Auto, which switches Motion to Coord
# and aborts.
#
COORD
JOG_ABORT joint=0
JOG_ABORT joint=1
JOG_ABORT joint=2
JOG_ABORT joint=3
JOG_ABORT joint=4
JOG_ABORT joint=5
JOG_ABORT joint=6
JOG_ABORT joint=7
JOG_ABORT joint=8
JOG_ABORT joint=9
JOG_ABORT joint=10
JOG_ABORT joint=11
JOG_ABORT joint=12
JOG_ABORT joint=13
JOG_ABORT joint=14
JOG_ABORT joint=15
ABORT

View File

@@ -0,0 +1,4 @@
SET_LINE x=1, y=2, z=3, a=4, b=5, c=6, u=7, v=8, w=9, id=2, motion_type=1, vel=1.66296, ini_maxvel=1.66296, acc=415.74, turn=-1
SET_LINE x=0.1, y=0.2, z=0.3, a=0.4, b=0.5, c=0.6, u=0.7, v=0.8, w=0.9, id=4, motion_type=1, vel=1.66296, ini_maxvel=1.66296, acc=415.74, turn=-1
SET_SPINDLESYNC sync=0.000000, flags=0x00000000
SPINDLE_OFF

View File

@@ -0,0 +1,5 @@
SET_LINE x=1, y=2, z=3, a=4, b=5, c=6, u=7, v=8, w=9, id=2, motion_type=2, vel=0.0166667, ini_maxvel=1.66296, acc=415.74, turn=-1
SET_LINE x=0.1, y=2, z=0.3, a=0.4, b=5, c=0.6, u=0.7, v=8, w=0.9, id=3, motion_type=2, vel=0.0333333, ini_maxvel=1.40546, acc=351.364, turn=-1
SET_LINE x=10, y=2, z=0.3, a=10, b=5, c=0.6, u=10, v=8, w=0.9, id=5, motion_type=2, vel=0.00166667, ini_maxvel=4, acc=1000, turn=-1
SET_SPINDLESYNC sync=0.000000, flags=0x00000000
SPINDLE_OFF

View File

@@ -0,0 +1,3 @@
SET_OFFSET x=0, y=0, z=0, a=0, b=0, c=0 u=0, v=0, w=0
SET_SPINDLESYNC sync=0.000000, flags=0x00000000
SPINDLE_OFF

View File

@@ -0,0 +1,15 @@
SET_LINE x=1, y=0, z=0, a=0, b=0, c=0, u=0, v=0, w=0, id=2, motion_type=1, vel=4, ini_maxvel=4, acc=1000, turn=-1
SPINDLE_ON speed=0.000000, css_factor=0.000000, xoffset=0.000000
SET_LINE x=1.5, y=0, z=0, a=0, b=0, c=0, u=0, v=0, w=0, id=6, motion_type=1, vel=4, ini_maxvel=4, acc=1000, turn=-1
SPINDLE_ON speed=0.000000, css_factor=0.000000, xoffset=0.000000
SET_LINE x=2, y=0, z=0, a=0, b=0, c=0, u=0, v=0, w=0, id=10, motion_type=1, vel=4, ini_maxvel=4, acc=1000, turn=-1
SPINDLE_ON speed=234.000000, css_factor=0.000000, xoffset=0.000000
SET_LINE x=3, y=0, z=0, a=0, b=0, c=0, u=0, v=0, w=0, id=14, motion_type=1, vel=4, ini_maxvel=4, acc=1000, turn=-1
SPINDLE_ON speed=321.000000, css_factor=0.000000, xoffset=0.000000
SPINDLE_ON speed=432.000000, css_factor=0.000000, xoffset=0.000000
SET_LINE x=4, y=0, z=0, a=0, b=0, c=0, u=0, v=0, w=0, id=19, motion_type=1, vel=4, ini_maxvel=4, acc=1000, turn=-1
SPINDLE_OFF
SPINDLE_ON speed=0.000000, css_factor=0.000000, xoffset=0.000000
SET_LINE x=5, y=0, z=0, a=0, b=0, c=0, u=0, v=0, w=0, id=26, motion_type=1, vel=4, ini_maxvel=4, acc=1000, turn=-1
SET_SPINDLESYNC sync=0.000000, flags=0x00000000
SPINDLE_OFF

View File

@@ -0,0 +1,5 @@
f5
g0 x1 y2 z3 a4 b5 c6 u7 v8 w9
f0.001
g0 x0.1 y0.2 z0.3 a0.4 b0.5 c0.6 u0.7 v0.8 w0.9
m2

View File

@@ -0,0 +1,6 @@
f1
g1 x1 y2 z3 a4 b5 c6 u7 v8 w9
f2 g1 x0.1 z0.3 a0.4 c0.6 u0.7 w0.9
f0.1
g1 x10 a10 u10
m2

View File

@@ -0,0 +1,3 @@
loadusr -W motion-logger out.motion-logger
setp iocontrol.0.emc-enable-in 1

View File

@@ -0,0 +1,17 @@
;
; This gcode program is intended to reset Task (including Canon) to a
; sane, simple default analogous to system startup.
;
G90 ; absolute distance mode
G91.1 ; arc centers are relative
G40 ; cutter radius compensation off
G53 G0 X0 Y0 Z0 A0 B0 C0 U0 V0 W0 ; move to machine home
G92.1 ; clear G92 offsets
G54 ; switch to coordinate system G54
G10 L2 P1 X0 Y0 Z0 A0 B0 C0 U0 V0 W0 R0 ; set G54 to equal G53
G49 ; disable tool offset compensation
G80 ; cancel canned cycle
M2

View File

@@ -0,0 +1,27 @@
; the G0 commands here are just to see the sequencing of commands coming out of task
g0 x1
; this will update the spindle speed via SPINDLE_ON with state False
s123
g0 x1.5
; this will update the spindle speed via another SPINDLE_ON with state False
s234
g0 x2
; this M3 will result in the SPINDLE_ON sent to Motion with state True
m3
g0 x3
; this will update the spindle speed via another SPINDLE_ON with state True
s321
s432
g0 x4
; this will update the spindle via SPINDLE_OFF
m5
; this will update the spindle speed via SPINDLE_ON with state False
s1234
g0 x5
m2

View File

@@ -0,0 +1,82 @@
#!/usr/bin/env python3
import linuxcnc
import hal
import time
import sys
import subprocess
import os
import signal
import glob
import re
comp = hal.component("test-ui")
comp.newpin("reopen-log", hal.HAL_BIT, hal.HAL_IO)
comp.ready()
os.system("halcmd net reopen-log test-ui.reopen-log motion-logger.reopen-log")
# This will be the return value of this program.
# Any failure sets it to 1.
retval = 0
def end_log(logfile_name):
c.wait_complete()
comp['reopen-log'] = True
while comp['reopen-log']: time.sleep(.01)
os.rename("out.motion-logger", 'result.%s' % logfile_name)
status = subprocess.call(['diff', '-u', 'expected.%s' % logfile_name, 'result.%s' % logfile_name], shell=False)
if status == 0:
print("sub-test %s ok" % logfile_name)
else:
print("unexpected output in logfile '%s'" % logfile_name)
global retval
retval = 1
sys.stdout.flush()
#
# connect to LinuxCNC
#
c = linuxcnc.command()
s = linuxcnc.stat()
e = linuxcnc.error_channel()
#
# Come out of E-stop, turn the machine on, and switch to Auto mode.
#
c.state(linuxcnc.STATE_ESTOP_RESET)
c.state(linuxcnc.STATE_ON)
c.mode(linuxcnc.MODE_AUTO)
end_log('builtin-startup')
#
# run each .ngc test file in the test directory
#
for ngc in glob.glob('*.ngc'):
if ngc == 'reset.ngc': continue
m = re.match('(.*)\\.ngc', ngc)
basename = m.group(1)
c.program_open('reset.ngc')
c.auto(linuxcnc.AUTO_RUN, 0)
c.wait_complete()
end_log('reset')
c.program_open(ngc)
c.auto(linuxcnc.AUTO_RUN, 0)
c.wait_complete()
end_log(basename)
sys.stderr.write("trying to exit")
sys.exit(retval)

View File

@@ -0,0 +1,213 @@
[EMC]
VERSION = 1.1
DEBUG = 0x0
[DISPLAY]
DISPLAY = ./test-ui.py
[TASK]
TASK = milltask
CYCLE_TIME = 0.001
[RS274NGC]
PARAMETER_FILE = sim.var
[EMCMOT]
#EMCMOT = motmod
COMM_TIMEOUT = 4.0
BASE_PERIOD = 0
SERVO_PERIOD = 1000000
[EMCIO]
TOOL_TABLE = simpockets.tbl
TOOL_CHANGE_QUILL_UP = 1
RANDOM_TOOLCHANGER = 0
[HAL]
HALFILE = mock-motion.hal
#POSTGUI_HALFILE = postgui.hal
[TRAJ]
NO_FORCE_HOMING = 1
COORDINATES = X Y Z A B C U V W
HOME = 0 0 0 0 0 0 0 0 0
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 1.2
MAX_LINEAR_VELOCITY = 4
[KINS]
KINEMATICS = trivkins
JOINTS = 9
[AXIS_X]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 1000.0
[JOINT_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_Y]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 1000.0
[JOINT_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_Z]
MIN_LIMIT = -4.0
MAX_LIMIT = 4.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 1000.0
[JOINT_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
[AXIS_A]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 1000.0
[JOINT_3]
TYPE = ANGULAR
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_B]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 1000.0
[JOINT_4]
TYPE = ANGULAR
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_C]
MIN_LIMIT = -4.0
MAX_LIMIT = 4.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 1000.0
[JOINT_5]
TYPE = ANGULAR
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
[AXIS_U]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 1000.0
[JOINT_6]
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_V]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 1000.0
[JOINT_7]
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_W]
MIN_LIMIT = -4.0
MAX_LIMIT = 4.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 1000.0
[JOINT_8]
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

View File

@@ -0,0 +1,12 @@
#!/bin/bash
rm -f out.motion-logger*
for SRC in *.in; do
DEST=$(basename "${SRC}" .in)
rm -f "${DEST}"
grep -E -v '(^ *$)|(^ *#)' "${SRC}" > "${DEST}"
done
linuxcnc -r test.ini

View File

@@ -0,0 +1,3 @@
out.motion-logger
rs274ngc.var
rs274ngc.var.bak

View File

@@ -0,0 +1,3 @@
#!/bin/sh
cd "$(dirname "$1")" || { echo "E: Could not change directory to '$(dirname "$1")'"; exit 1; }
diff -u expected.motion-logger out.motion-logger

View File

@@ -0,0 +1,132 @@
SET_NUM_JOINTS 3
SET_NUM_SPINDLES 1
SET_VEL vel=0, ini_maxvel=120
SET_VEL_LIMIT vel=400
SET_ACC acc=1e+99
SET_JERK jerk=1e+09
SET_PLANNER_TYPE planner_type=0
SET_SCURVE_PEAK_SCALE scale=1
SETUP_ARC_BLENDS
SET_MAX_FEED_OVERRIDE 1
SETUP_SET_PROBE_ERR_INHIBIT 0 0
SET_WORLD_HOME x=0, y=0, z=0, a=0, b=0, c=0, u=0, v=0, w=0
SET_JOINT_BACKLASH joint=0, backlash=0
SET_JOINT_POSITION_LIMITS joint=0, min=-40, max=0
SET_JOINT_POSITION_LIMITS joint=0, min=-40, max=40
SET_JOINT_MAX_FERROR joint=0, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=0, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=0, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=0, vel=400
SET_JOINT_ACC_LIMIT joint=0, acc=1000
SET_JOINT_JERK_LIMIT joint=0, jerk=0
JOINT_ACTIVATE joint=0
SET_JOINT_BACKLASH joint=1, backlash=0
SET_JOINT_POSITION_LIMITS joint=1, min=-40, max=0
SET_JOINT_POSITION_LIMITS joint=1, min=-40, max=40
SET_JOINT_MAX_FERROR joint=1, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=1, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=1, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=1, vel=400
SET_JOINT_ACC_LIMIT joint=1, acc=1000
SET_JOINT_JERK_LIMIT joint=1, jerk=0
JOINT_ACTIVATE joint=1
SET_JOINT_BACKLASH joint=2, backlash=0
SET_JOINT_POSITION_LIMITS joint=2, min=-40, max=0
SET_JOINT_POSITION_LIMITS joint=2, min=-40, max=40
SET_JOINT_MAX_FERROR joint=2, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=2, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=2, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=2, vel=400
SET_JOINT_ACC_LIMIT joint=2, acc=1000
SET_JOINT_JERK_LIMIT joint=2, jerk=0
JOINT_ACTIVATE joint=2
SET_AXIS_POSITION_LIMITS axis=0, min=-40, max=0
SET_AXIS_POSITION_LIMITS axis=0, min=-40, max=40
SET_AXIS_VEL_LIMIT axis=0 vel=400
SET_AXIS_ACC_LIMIT axis=0, acc=1000
SET_AXIS_LOCKING_JOINT axis=0, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=0, jerk=0
SET_AXIS_POSITION_LIMITS axis=1, min=-40, max=0
SET_AXIS_POSITION_LIMITS axis=1, min=-40, max=40
SET_AXIS_VEL_LIMIT axis=1 vel=400
SET_AXIS_ACC_LIMIT axis=1, acc=1000
SET_AXIS_LOCKING_JOINT axis=1, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=1, jerk=0
SET_AXIS_POSITION_LIMITS axis=2, min=-40, max=0
SET_AXIS_POSITION_LIMITS axis=2, min=-40, max=40
SET_AXIS_VEL_LIMIT axis=2 vel=400
SET_AXIS_ACC_LIMIT axis=2, acc=1000
SET_AXIS_LOCKING_JOINT axis=2, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=2, jerk=0
SET_SPINDLE_PARAMS, 1.00e+99, 0.00e+00, -1.00e+99, 0.00e+00
JOG_ABORT joint=0
JOG_ABORT joint=1
JOG_ABORT joint=2
JOG_ABORT joint=3
JOG_ABORT joint=4
JOG_ABORT joint=5
JOG_ABORT joint=6
JOG_ABORT joint=7
JOG_ABORT joint=8
JOG_ABORT joint=9
JOG_ABORT joint=10
JOG_ABORT joint=11
JOG_ABORT joint=12
JOG_ABORT joint=13
JOG_ABORT joint=14
JOG_ABORT joint=15
ABORT
SPINDLE_OFF
DISABLE
JOINT_UNHOME joint=-2
FREE
JOG_ABORT joint=0
JOG_ABORT joint=1
JOG_ABORT joint=2
JOG_ABORT joint=3
JOG_ABORT joint=4
JOG_ABORT joint=5
JOG_ABORT joint=6
JOG_ABORT joint=7
JOG_ABORT joint=8
JOG_ABORT joint=9
JOG_ABORT joint=10
JOG_ABORT joint=11
JOG_ABORT joint=12
JOG_ABORT joint=13
JOG_ABORT joint=14
JOG_ABORT joint=15
ABORT
SPINDLE_OFF
ENABLE
COORD
JOG_ABORT joint=0
JOG_ABORT joint=1
JOG_ABORT joint=2
JOG_ABORT joint=3
JOG_ABORT joint=4
JOG_ABORT joint=5
JOG_ABORT joint=6
JOG_ABORT joint=7
JOG_ABORT joint=8
JOG_ABORT joint=9
JOG_ABORT joint=10
JOG_ABORT joint=11
JOG_ABORT joint=12
JOG_ABORT joint=13
JOG_ABORT joint=14
JOG_ABORT joint=15
ABORT
SET_LINE x=2, y=0, z=0, a=0, b=0, c=0, u=0, v=0, w=0, id=4, motion_type=2, vel=0.666667, ini_maxvel=400, acc=1000, turn=-1
SET_LINE x=3, y=0, z=0, a=0, b=0, c=0, u=0, v=0, w=0, id=5, motion_type=2, vel=0.666667, ini_maxvel=400, acc=1000, turn=-1
SET_LINE x=3, y=4, z=0, a=0, b=0, c=0, u=0, v=0, w=0, id=6, motion_type=2, vel=0.666667, ini_maxvel=400, acc=1000, turn=-1
SET_LINE x=5, y=4, z=0, a=0, b=0, c=0, u=0, v=0, w=0, id=7, motion_type=2, vel=0.666667, ini_maxvel=400, acc=1000, turn=-1
SET_LINE x=5, y=6, z=0, a=0, b=0, c=0, u=0, v=0, w=0, id=8, motion_type=2, vel=0.666667, ini_maxvel=400, acc=1000, turn=-1
SET_LINE x=0, y=0, z=0.5, a=0, b=0, c=0, u=0, v=0, w=0, id=2, motion_type=1, vel=521.749, ini_maxvel=521.749, acc=1304.37, turn=-1
SET_LINE x=1, y=0, z=0.5, a=0, b=0, c=0, u=0, v=0, w=0, id=3, motion_type=1, vel=400, ini_maxvel=400, acc=1000, turn=-1
SET_LINE x=1, y=1, z=0.5, a=0, b=0, c=0, u=0, v=0, w=0, id=4, motion_type=1, vel=400, ini_maxvel=400, acc=1000, turn=-1
SET_LINE x=0, y=1, z=0.5, a=0, b=0, c=0, u=0, v=0, w=0, id=5, motion_type=1, vel=400, ini_maxvel=400, acc=1000, turn=-1
SET_LINE x=0, y=0, z=0.5, a=0, b=0, c=0, u=0, v=0, w=0, id=6, motion_type=1, vel=400, ini_maxvel=400, acc=1000, turn=-1
SET_SPINDLESYNC sync=0.000000, flags=0x00000000
SPINDLE_OFF
DISABLE

View File

@@ -0,0 +1,3 @@
loadusr -W motion-logger out.motion-logger
setp iocontrol.0.emc-enable-in 1

View File

@@ -0,0 +1,102 @@
[EMC]
VERSION = 1.1
DEBUG = 0xffffffff
[DISPLAY]
DISPLAY = ./test-ui.py
[TASK]
TASK = milltask
CYCLE_TIME = 0.001
[RS274NGC]
SUBROUTINE_PATH = ./subs
LOG_LEVEL = 999
REMAP=M442 modalgroup=5 ngc=m442
[EMCMOT]
#EMCMOT = motmod
COMM_TIMEOUT = 4.0
BASE_PERIOD = 0
SERVO_PERIOD = 1000000
[EMCIO]
TOOL_TABLE = simpockets.tbl
TOOL_CHANGE_QUILL_UP = 1
RANDOM_TOOLCHANGER = 0
[HAL]
HALFILE = mock-motion.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
DEFAULT_LINEAR_VELOCITY = 120
MAX_LINEAR_VELOCITY = 400
[KINS]
KINEMATICS = trivkins
JOINTS = 3
[AXIS_X]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 400
MAX_ACCELERATION = 1000.0
[JOINT_0]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 400
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_Y]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 400
MAX_ACCELERATION = 1000.0
[JOINT_1]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 400
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_Z]
MIN_LIMIT = -40
MAX_LIMIT = 40
MAX_VELOCITY = 400
MAX_ACCELERATION = 1000.0
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 400
MAX_ACCELERATION = 1000.0
BACKLASH = 0.000
INPUT_SCALE = 4000
OUTPUT_SCALE = 1.000
MIN_LIMIT = -40
MAX_LIMIT = 40
FERROR = 0.050
MIN_FERROR = 0.010

View File

@@ -0,0 +1,11 @@
G0 X5 (This line should be skipped)
M442 (First remapped command sets up problem)
G1 X2Y0Z0 F40 (SET START LINE HERE, line after remapped command)
X3 (Moves that will be truncated)
Y4
X5
Y6
M442 (Second remapped command should truncate previous moves)
m2

View File

@@ -0,0 +1,10 @@
o<m442>sub
G0 Z0.5 X0 Y0
X1
Y1
X0
Y0
o<m442> endsub
m2
%

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env python3
import linuxcnc
import hal
import time
import sys
#
# connect to LinuxCNC
#
c = linuxcnc.command()
s = linuxcnc.stat()
e = linuxcnc.error_channel()
#
# Come out of E-stop, turn the machine on, home, and switch to Auto mode.
#
c.state(linuxcnc.STATE_ESTOP_RESET)
c.state(linuxcnc.STATE_ON)
c.mode(linuxcnc.MODE_AUTO)
#
# run the .ngc test file, starting from the special line
#
c.program_open('mountaindew.ngc')
c.auto(linuxcnc.AUTO_RUN, 4)
c.wait_complete()
sys.exit(0)

View File

@@ -0,0 +1,5 @@
#!/bin/bash -e
rm -f out.motion-logger
linuxcnc -r mountaindew.ini

View File

@@ -0,0 +1,4 @@
result.*
sim.var*
expected.motion-logger
out.motion-logger

View File

@@ -0,0 +1,3 @@
#!/bin/sh
cd "$(dirname "$1")" || { echo "E: Could not change directory to '$(dirname "$1")'"; exit 1; }
diff -u expected.motion-logger out.motion-logger

View File

@@ -0,0 +1,160 @@
#
# First come "immediate" Motion commands sent from emctask_startup().
#
SET_NUM_JOINTS 3
SET_NUM_SPINDLES 1
SET_VEL vel=0, ini_maxvel=1.2
SET_VEL_LIMIT vel=4
SET_ACC acc=1e+99
SET_JERK jerk=1e+09
SET_PLANNER_TYPE planner_type=0
SET_SCURVE_PEAK_SCALE scale=1
SETUP_ARC_BLENDS
SET_MAX_FEED_OVERRIDE 1
SETUP_SET_PROBE_ERR_INHIBIT 0 0
SET_WORLD_HOME x=0, y=0, z=0, a=0, b=0, c=0, u=0, v=0, w=0
SET_JOINT_BACKLASH joint=0, backlash=0
SET_JOINT_POSITION_LIMITS joint=0, min=-40, max=0
SET_JOINT_POSITION_LIMITS joint=0, min=-40, max=40
SET_JOINT_MAX_FERROR joint=0, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=0, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=0, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=0, vel=4
SET_JOINT_ACC_LIMIT joint=0, acc=1000
SET_JOINT_JERK_LIMIT joint=0, jerk=0
JOINT_ACTIVATE joint=0
SET_JOINT_BACKLASH joint=1, backlash=0
SET_JOINT_POSITION_LIMITS joint=1, min=-40, max=0
SET_JOINT_POSITION_LIMITS joint=1, min=-40, max=40
SET_JOINT_MAX_FERROR joint=1, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=1, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=1, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=1, vel=4
SET_JOINT_ACC_LIMIT joint=1, acc=1000
SET_JOINT_JERK_LIMIT joint=1, jerk=0
JOINT_ACTIVATE joint=1
SET_JOINT_BACKLASH joint=2, backlash=0
SET_JOINT_POSITION_LIMITS joint=2, min=-4, max=0
SET_JOINT_POSITION_LIMITS joint=2, min=-4, max=4
SET_JOINT_MAX_FERROR joint=2, maxFerror=0.05
SET_JOINT_MIN_FERROR joint=2, minFerror=0.01
SET_JOINT_HOMING_PARAMS joint=2, offset=0 home=0, final_vel=-1, search_vel=0, latch_vel=0, flags=0x00000000, sequence=999, volatile=0
SET_JOINT_VEL_LIMIT joint=2, vel=4
SET_JOINT_ACC_LIMIT joint=2, acc=1000
SET_JOINT_JERK_LIMIT joint=2, jerk=0
JOINT_ACTIVATE joint=2
SET_AXIS_POSITION_LIMITS axis=0, min=-40, max=0
#
# Everything above this line was sent from emctask_startup().
# That function also enqueued some Canon commands on interp_list, that will
# generate Motion commands later.
#
#
# Next Task enters Estop, by calling emcTaskSetState(EMC_TASK_STATE_ESTOP).
# This does the following:
# * Abort Motion, which aborts each Axis, then Aborts Motion
# * Stop the spindle
# * Send Estop to IO (which we don't detect in motion-logger)
# * Disable all the amps
# * Disable Motion
# * Abort Motion again, which aborts each Axis, and Motion, again
# * Abort IO, which we miss
# * Unhome VOLATILE_HOME joints
#
SET_AXIS_POSITION_LIMITS axis=0, min=-40, max=40
SET_AXIS_VEL_LIMIT axis=0 vel=4
SET_AXIS_ACC_LIMIT axis=0, acc=1000
SET_AXIS_LOCKING_JOINT axis=0, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=0, jerk=0
SET_AXIS_POSITION_LIMITS axis=1, min=-40, max=0
SET_AXIS_POSITION_LIMITS axis=1, min=-40, max=40
SET_AXIS_VEL_LIMIT axis=1 vel=4
SET_AXIS_ACC_LIMIT axis=1, acc=1000
SET_AXIS_LOCKING_JOINT axis=1, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=1, jerk=0
SET_AXIS_POSITION_LIMITS axis=2, min=-4, max=0
SET_AXIS_POSITION_LIMITS axis=2, min=-4, max=4
SET_AXIS_VEL_LIMIT axis=2 vel=4
SET_AXIS_ACC_LIMIT axis=2, acc=1000
SET_AXIS_LOCKING_JOINT axis=2, locking_joint=-1
SET_AXIS_JERK_LIMIT axis=2, jerk=0
SET_SPINDLE_PARAMS, 1.00e+99, 0.00e+00, -1.00e+99, 0.00e+00
JOG_ABORT joint=0
JOG_ABORT joint=1
JOG_ABORT joint=2
JOG_ABORT joint=3
JOG_ABORT joint=4
JOG_ABORT joint=5
JOG_ABORT joint=6
JOG_ABORT joint=7
JOG_ABORT joint=8
JOG_ABORT joint=9
JOG_ABORT joint=10
JOG_ABORT joint=11
JOG_ABORT joint=12
JOG_ABORT joint=13
JOG_ABORT joint=14
JOG_ABORT joint=15
ABORT
SPINDLE_OFF
DISABLE
JOINT_UNHOME joint=-2
#
# Here's emcTaskSetMode(EMC_TASK_MODE_MANUAL)
#
FREE
#
# Task is now got the 'motion.in-position' pin visible, and is
# accepting abort calls from the UI.
#
#
# The test UI immediately sent an Abort.
#
JOG_ABORT joint=0
JOG_ABORT joint=1
JOG_ABORT joint=2
JOG_ABORT joint=3
JOG_ABORT joint=4
JOG_ABORT joint=5
JOG_ABORT joint=6
JOG_ABORT joint=7
JOG_ABORT joint=8
JOG_ABORT joint=9
JOG_ABORT joint=10
JOG_ABORT joint=11
JOG_ABORT joint=12
JOG_ABORT joint=13
JOG_ABORT joint=14
JOG_ABORT joint=15
ABORT
JOG_ABORT joint=0
JOG_ABORT joint=1
JOG_ABORT joint=2
JOG_ABORT joint=3
JOG_ABORT joint=4
JOG_ABORT joint=5
JOG_ABORT joint=6
JOG_ABORT joint=7
JOG_ABORT joint=8
JOG_ABORT joint=9
JOG_ABORT joint=10
JOG_ABORT joint=11
JOG_ABORT joint=12
JOG_ABORT joint=13
JOG_ABORT joint=14
JOG_ABORT joint=15
ABORT
SPINDLE_OFF
DISABLE

View File

@@ -0,0 +1,3 @@
loadusr -W motion-logger out.motion-logger
setp iocontrol.0.emc-enable-in 1

View File

@@ -0,0 +1,6 @@
o<init> sub
G53 G0 X-1 Y-2 Z-3 ; some random gcode that will involve poking Motion
G4 P99 ; dwell (sleep) for 99 seconds, the Abort will come here
G53 G0 X1 Y2 Z3 ; some random gcode that will involve poking Motion
o<init> endsub
m2

View File

@@ -0,0 +1,42 @@
#!/usr/bin/env python3
import linuxcnc
import sys
import time
import hal
#
# connect to LinuxCNC
#
comp = hal.component('hal-watcher')
c = linuxcnc.command()
s = linuxcnc.stat()
e = linuxcnc.error_channel()
#
# Immediately abort once linuxcnc is ready! Github Issue #49
#
# Wait for (any) HAL pin to show up when LinuxCNC is initialized
waitlimit = 300
while 0 < waitlimit:
try:
waiting = 'TRUE' != hal.get_value('motion.in-position')
except RuntimeError:
break
time.sleep(0.1)
waitlimit -= 1
print("UI abort")
sys.stdout.flush()
c.abort()
c.wait_complete()
print("UI done with abort")
sys.stdout.flush()

View File

@@ -0,0 +1,117 @@
# This config file was created 2016-06-17 10:33:02.417666 by the update_ini script
# The original config files may be found in the /data/s/linuxcnc-dev/tests/motion-logger/startup-gcode-abort/test.old directory
[EMC]
# The version string for this INI file.
VERSION = 1.1
DEBUG = 0x0
#DEBUG = 0xffffffff
[DISPLAY]
DISPLAY = ./test-ui.py
[FILTER]
#No Content
[RS274NGC]
PARAMETER_FILE = sim.var
SUBROUTINE_PATH = nc_files
RS274NGC_STARTUP_CODE = o<init> call
[EMCMOT]
#EMCMOT = motmod
COMM_TIMEOUT = 4.0
BASE_PERIOD = 0
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.001
[HAL]
HALFILE = mock-motion.hal
[HALUI]
#No Content
[TRAJ]
NO_FORCE_HOMING = 1
AXES = 3
COORDINATES = X Y Z
HOME = 0 0 0
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 1.2
MAX_LINEAR_VELOCITY = 4
[EMCIO]
TOOL_TABLE = simpockets.tbl
TOOL_CHANGE_QUILL_UP = 1
RANDOM_TOOLCHANGER = 0
[KINS]
KINEMATICS = trivkins
#This is a best-guess at the number of joints, it should be checked
JOINTS = 3
[AXIS_X]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 1000.0
[JOINT_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_Y]
MIN_LIMIT = -40.0
MAX_LIMIT = 40.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 1000.0
[JOINT_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_Z]
MIN_LIMIT = -4.0
MAX_LIMIT = 4.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 1000.0
[JOINT_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

View File

@@ -0,0 +1,14 @@
#!/bin/bash
set -e
rm -f out.motion-logger*
for SRC in *.in; do
DEST=$(basename "${SRC}" .in)
rm -f "${DEST}"
grep -E -v '(^ *$)|(^ *#)' "${SRC}" > "${DEST}"
done
linuxcnc -r test.ini