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

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