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,104 @@
# 3joint_xyz.hal
# This halfile loads modules and makes connections
# for use of any kinematics using xyz coordinates
# implemented with 3 joints. Such configs include:
# [KINS]KINEMATICS = trivkins coordinates=xyz
# [KINS]KINEMATICS = corexykins
# Notes:
# 1) stepgens are implemented but no connections are
# included for hardware
# 2) home switches are simulated
#----------------------------------------------------------
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD \
servo_period_nsec=[EMCMOT]SERVO_PERIOD \
num_joints=[KINS]JOINTS
loadrt stepgen step_type=0,0,0
# simulated home switches:
loadrt sim_home_switch names=j0home,j1home,j2home
#----------------------------------------------------------
setp stepgen.0.position-scale [JOINT_0]SCALE
setp stepgen.0.maxaccel [JOINT_0]STEPGEN_MAXACCEL
setp stepgen.0.steplen 5000
setp stepgen.0.stepspace 5000
setp stepgen.0.dirhold 35000
setp stepgen.0.dirsetup 35000
setp stepgen.1.position-scale [JOINT_1]SCALE
setp stepgen.1.maxaccel [JOINT_1]STEPGEN_MAXACCEL
setp stepgen.1.steplen 5000
setp stepgen.1.stepspace 5000
setp stepgen.1.dirhold 35000
setp stepgen.1.dirsetup 35000
setp stepgen.2.position-scale [JOINT_2]SCALE
setp stepgen.2.maxaccel [JOINT_2]STEPGEN_MAXACCEL
setp stepgen.2.steplen 5000
setp stepgen.2.stepspace 5000
setp stepgen.2.dirhold 35000
setp stepgen.2.dirsetup 35000
#----------------------------------------------------------
# simulated home motor positions:
setp j0home.home-pos 0.2
setp j1home.home-pos 0.2
setp j2home.home-pos 0.1
#----------------------------------------------------------
addf stepgen.make-pulses base-thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
addf j0home servo-thread
addf j1home servo-thread
addf j2home servo-thread
#----------------------------------------------------------
net j0enable <= joint.0.amp-enable-out
net j0enable => stepgen.0.enable
net j0pos-cmd <= joint.0.motor-pos-cmd
net j0pos-cmd => stepgen.0.position-cmd
net j0pos-cmd => j0home.cur-pos
net j0pos-fb <= stepgen.0.position-fb
net j0pos-fb => joint.0.motor-pos-fb
net j0step <= stepgen.0.step
net j0dir <= stepgen.0.dir
net j0homesw <= j0home.home-sw
net j0homesw => joint.0.home-sw-in
net j1enable <= joint.1.amp-enable-out
net j1enable => stepgen.1.enable
net j1pos-cmd <= joint.1.motor-pos-cmd
net j1pos-cmd => stepgen.1.position-cmd
net j1pos-cmd => j1home.cur-pos
net j1pos-fb <= stepgen.1.position-fb
net j1pos-fb => joint.1.motor-pos-fb
net j1step <= stepgen.1.step
net j1dir <= stepgen.1.dir
net j1homesw <= j1home.home-sw
net j1homesw => joint.1.home-sw-in
net j2enable <= joint.2.amp-enable-out
net j2enable => stepgen.2.enable
net j2pos-cmd <= joint.2.motor-pos-cmd
net j2pos-cmd => stepgen.2.position-cmd
net j2pos-cmd => j2home.cur-pos
net j2pos-fb <= stepgen.2.position-fb
net j2pos-fb => joint.2.motor-pos-fb
net j2step <= stepgen.2.step
net j2dir <= stepgen.2.dir
net j2homesw <= j2home.home-sw
net j2homesw => joint.2.home-sw-in
#----------------------------------------------------------
net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in
net tool-change-loopback <= iocontrol.0.tool-change
net tool-change-loopback => iocontrol.0.tool-changed
net tool-prepare-loopback <= iocontrol.0.tool-prepare
net tool-prepare-loopback => iocontrol.0.tool-prepared

View File

@@ -0,0 +1,24 @@
corexy examples:
corexy_by_kins.ini
Demonstrates corexykins kinematics
(Note: using corexykins kinematics
on real hardware requires home
switches triggered by motor
positions)
corexy_by_hal.ini
Demonstrates use of trivkins with
corexy kinematics implemented by a
hal component
(Notes: this method supports
home switches aligned with x,y
coordinates)
Notes:
1) The configurations share common ini
file settings from corey_base.inc
2) Home switches are simulated
3) stepgens are configured but no
connections to hardware are
included.

View File

@@ -0,0 +1,22 @@
pin+corexy_by_hal.j0-motor-pos-cmd
pin+corexy_by_hal.j1-motor-pos-cmd
pin+corexy_by_hal.j0-motor-pos-fb
pin+corexy_by_hal.j1-motor-pos-fb
pin+corexy_by_hal.alpha-cmd
pin+corexy_by_hal.beta-cmd
pin+corexy_by_hal.alpha-fb
pin+corexy_by_hal.beta-fb
pin+joint.0.motor-pos-cmd
pin+joint.1.motor-pos-cmd
pin+joint.0.motor-pos-fb
pin+joint.1.motor-pos-fb
pin+joint.0.motor-offset
pin+joint.1.motor-offset
pin+stepgen.0.position-cmd
pin+stepgen.1.position-cmd
pin+stepgen.0.position-fb
pin+stepgen.1.position-fb

View File

@@ -0,0 +1,91 @@
# Notes:
# 1) this is an INCLUDE file for common settings
# for demonstration configs
# 2) INCLUDING file must supply the sections for:
# [EMC],[KINS],[HAL]
[APPLICATIONS]
APP = halshow --fformat "%.3f" corexy.halshow
[DISPLAY]
DISPLAY = axis
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 1.2
DEFAULT_LINEAR_VELOCITY = 1.0
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 1.0
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = ../../nc_files/
INCREMENTS = .1in .01in .001in
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[RS274NGC]
PARAMETER_FILE = linuxcnc.var
[EMCMOT]
EMCMOT = motmod
BASE_PERIOD = 250000
SERVO_PERIOD = 1000000
[TRAJ]
COORDINATES = XYZ
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 1.0
MAX_LINEAR_VELOCITY = 1.0
[EMCIO]
TOOL_TABLE = tool.tbl
[AXIS_X]
MAX_VELOCITY = 2.0
MAX_ACCELERATION = 20.0
MIN_LIMIT = -0.1
MAX_LIMIT = 10.0
[AXIS_Y]
MAX_VELOCITY = 2.0
MAX_ACCELERATION = 20.0
MIN_LIMIT = -0.1
MAX_LIMIT = 10.0
[AXIS_Z]
MAX_VELOCITY = 2.0
MAX_ACCELERATION = 20.0
MIN_LIMIT = -5.0
MAX_LIMIT = 0.5
[JOINT_0]
TYPE = LINEAR
MAX_VELOCITY = 2.0
MAX_ACCELERATION = 20.0
STEPGEN_MAXACCEL = 25.0
SCALE = 8000.0
HOME_SEARCH_VEL = 1
HOME_LATCH_VEL = 1
HOME_SEQUENCE = 0
[JOINT_1]
TYPE = LINEAR
MAX_VELOCITY = 2.0
MAX_ACCELERATION = 20.0
STEPGEN_MAXACCEL = 25.0
SCALE = 8000.0
HOME_SEARCH_VEL = 1
HOME_LATCH_VEL = 1
HOME_SEQUENCE = 1
[JOINT_2]
TYPE = LINEAR
MAX_VELOCITY = 2.0
MAX_ACCELERATION = 20.0
STEPGEN_MAXACCEL = 25.0
SCALE = 8000.0
HOME_SEARCH_VEL = 1
HOME_LATCH_VEL = 1
HOME_SEQUENCE = 2

View File

@@ -0,0 +1,57 @@
# corexy_by_hal.hal
# This halfile adapts a configuration using trvikins
# to implement corexy kinematics using the hal
# component: corexy_by_hal.
# This corexy method allows home switches to operate
# along the Cartesian X and Y coordinate motion.
# By contrast, when using corexykins kinematics, home
# switches operate according to motor positions for
# joints 0 and 1.
# show original signals for joints 0,1
show sig j0pos-cmd j1pos-cmd
show sig j0pos-fb j1pos-fb
# remove original signals that connect
# pins for stepgens 0,1:
delsig j0pos-cmd
delsig j1pos-cmd
delsig j0pos-fb
delsig j1pos-fb
# implement corexy kinematics with hal component:
loadrt corexy_by_hal names=corexy_by_hal
addf corexy_by_hal servo-thread
net :j0motor-cmd <= joint.0.motor-pos-cmd
net :j0motor-cmd => corexy_by_hal.j0-motor-pos-cmd
net :j0motor-cmd => j0home.cur-pos
net :j1motor-cmd <= joint.1.motor-pos-cmd
net :j1motor-cmd => corexy_by_hal.j1-motor-pos-cmd
net :j1motor-cmd => j1home.cur-pos
net :j0motor-fb <= corexy_by_hal.j0-motor-pos-fb
net :j0motor-fb => joint.0.motor-pos-fb
net :j1motor-fb <= corexy_by_hal.j1-motor-pos-fb
net :j1motor-fb => joint.1.motor-pos-fb
# new signals connecting pins for stepgens 0,1:
net :alpha-cmd <= corexy_by_hal.alpha-cmd
net :alpha-cmd => stepgen.0.position-cmd
net :beta-cmd => corexy_by_hal.beta-cmd
net :beta-cmd <= stepgen.1.position-cmd
net :alpha-fb <= stepgen.0.position-fb
net :alpha-fb => corexy_by_hal.alpha-fb
net :beta-fb <= stepgen.1.position-fb
net :beta-fb => corexy_by_hal.beta-fb
# show new signals:
show sig :*alpha*
show sig :*beta*

View File

@@ -0,0 +1,18 @@
# basic configuration items:
#INCLUDE corexy_base.inc
[EMC]
MACHINE = corexy_by_hal
VERSION = 1.1
[KINS]
JOINTS = 3
KINEMATICS = trivkins coordinates=XYZ kinstype=b
[HAL]
# default connections for a 3joint xyz config:
HALFILE = 3joint_xyz.hal
# update connections for trivkins to implement
# corexy kinematics in hal
HALFILE = corexy_by_hal.hal

View File

@@ -0,0 +1,11 @@
corexy_by_hal.ini
CoreXY simulation using the
trivkins kinematics module
with the corexy_by_hal
hal component
This hal method supports home switches
that are aligned with the X and Y
coordinates instead of the joint 0,1
motor positions.

View File

@@ -0,0 +1,14 @@
# basic configuration items:
#INCLUDE corexy_base.inc
[EMC]
MACHINE = corexy_by_kins
VERSION = 1.1
[KINS]
JOINTS = 3
KINEMATICS = corexykins
[HAL]
# default connections for a 3joint xyz config:
HALFILE = 3joint_xyz.hal

View File

@@ -0,0 +1,22 @@
corexy_by_kins.ini
CoreXY simulation using the
corexykins kinematics module
$ man kins for more info
Notes:
1) Using corexykins requires home
switches operating on motor
positions for joints 0 and 1
2) An alternative method for coreXY
kinematics uses trivkins kinematics
with a hal component:
(corexy_by_hal.comp)
This method allows use of home
switches aligned to x,y coordinate
motion.
See the demo: corexy_by_hal.ini