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,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