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,5 @@
This config is for a XYZ setup where the Y axis is a gantry style system driven by two motors.
The config uses stepper motors with metric units and includes a charge pump. The pinout is consistent with the breakout/combo boards from Bob Campbell.
The plasma-thc config is based on this config but has torch height control and external estop in addition to this config

View File

@@ -0,0 +1,12 @@
################################ Other ##########################################
#Connect Estop and ChargePump
loadrt estop_latch
addf estop-latch.0 base-thread
# External Estop Signal handled by THC
net ExtEStop parport.0.pin-10-in => estop-latch.0.fault-in
net EstopLatchWatchDog estop-latch.0.watchdog => parport.0.pin-17-out parport.1.pin-17-out
net EstopRequestEnable iocontrol.0.user-request-enable => estop-latch.0.reset
net EstopEnableOut iocontrol.0.user-enable-out => estop-latch.0.ok-in
net EstopOKOut estop-latch.0.ok-out => iocontrol.0.emc-enable-in

View File

@@ -0,0 +1,12 @@
############################## Kinematics & Motion Controller ####################################
# Kinematics
loadrt [KINS]KINEMATICS
# Settings for gantrykins
setp gantrykins.joint-0 0
setp gantrykins.joint-1 1
setp gantrykins.joint-2 2
setp gantrykins.joint-3 1
# motion controller, get name and thread periods from ini file
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD

View File

@@ -0,0 +1,50 @@
############################ Step Generators #########################################
# Stepper module, four step generators, all using step/dir
loadrt stepgen step_type=0,0,0,0
# Hook functions to base thread (high speed thread for step generation)
addf stepgen.make-pulses base-thread
# Hook functions to servo thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
# Configure signals for Z axis to be twice the size of the signals for other axis because
# Z axis has a slo-syn driver which can't handle smaller step sizes
setp stepgen.2.steplen 35200
setp stepgen.2.stepspace 35200
setp stepgen.2.dirsetup 35200
setp stepgen.2.dirhold 35200
# Set stepgen module scaling - get values from ini file
setp stepgen.0.position-scale [JOINT_0]SCALE
setp stepgen.1.position-scale [JOINT_1]SCALE
setp stepgen.2.position-scale [JOINT_2]SCALE
setp stepgen.3.position-scale [JOINT_3]SCALE
# Set stepgen module velocity limits - get values from ini file
# Set stepgen module accel limits - get values from ini file
setp stepgen.0.maxaccel [JOINT_0]STEPGEN_MAXACCEL
setp stepgen.1.maxaccel [JOINT_1]STEPGEN_MAXACCEL
setp stepgen.2.maxaccel [JOINT_2]STEPGEN_MAXACCEL
setp stepgen.3.maxaccel [JOINT_3]STEPGEN_MAXACCEL
# Hook up stepgen to motion modules
net PosX-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd
net PosX-fb stepgen.0.position-fb => joint.0.motor-pos-fb
net PosY-cmd joint.1.motor-pos-cmd => stepgen.1.position-cmd
net PosY-fb stepgen.1.position-fb => joint.1.motor-pos-fb
net PosZ-cmd joint.2.motor-pos-cmd => stepgen.2.position-cmd
net PosZ-fb stepgen.2.position-fb => joint.2.motor-pos-fb
net PosA-cmd joint.3.motor-pos-cmd => stepgen.3.position-cmd
net PosA-fb stepgen.3.position-fb => joint.3.motor-pos-fb
# Hook up enable signals for step generators
net EnableX joint.0.amp-enable-out => stepgen.0.enable
net EnableY joint.1.amp-enable-out => stepgen.1.enable
net EnableZ joint.2.amp-enable-out => stepgen.2.enable
net EnableA joint.3.amp-enable-out => stepgen.3.enable

View File

@@ -0,0 +1,4 @@
T1 P1 D0.125000 Z+0.511000 ;1/8 end mill
T2 P2 D0.062500 Z+0.100000 ;1/16 end mill
T3 P3 D0.201000 Z+1.273000 ;#7 tap drill
T99999 P99999 Z+0.100000 ;big tool number

View File

@@ -0,0 +1,248 @@
# EMC controller parameters for a plasma controller. Make these what you need
# for your system.
# General note: Comments can either be preceded with a # or ; - either is
# acceptable, although # is in keeping with most linux config files.
# Settings with a + at the front of the comment are likely needed to get
# changed by the user.
# Settings with a - at the front are highly unneeded to be changed
###############################################################################
# General section
###############################################################################
[EMC]
#- Version of this INI file
VERSION = 1.1
#+ Name of machine, for use with display, etc.
MACHINE = LinuxCNC-STEPPER-GANTRY
#+ Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
DEBUG = 0
#DEBUG = 0x00000007
#DEBUG = 0x7FFFFFFF
# Enable Adaptive Feedrate for THC
# Used to pause execution of gcode for setup,
# pierce delay and manual verification of pierce height
# Set spindle speed to 1
# Set up to use metric mm
RS274NGC_STARTUP_CODE = M52 P1 G21 S1
###############################################################################
# Sections for display options
###############################################################################
[DISPLAY]
#+ Name of display program, e.g., axis
DISPLAY = axis
#DISPLAY = tklinuxcnc
# Cycle time, in seconds, that display will sleep between polls
CYCLE_TIME = 0.200
#- Path to help file
HELP_FILE = doc/help.txt
#HELP_FILE = tklinuxcnc.txt
#- Initial display setting for position, RELATIVE or MACHINE
POSITION_OFFSET = RELATIVE
#- Initial display setting for position, COMMANDED or ACTUAL
POSITION_FEEDBACK = ACTUAL
#+ Highest value that will be allowed for feed override, 1.0 = 100%
MAX_FEED_OVERRIDE = 1.5
#- Prefix to be used
PROGRAM_PREFIX = ../../nc_files/
#- Introductory graphic
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 3
#Increments for the JOB Section
INCREMENTS = 1000 10 1 0.1 0.01
# Editor to be used with Axis
#EDITOR = geany
###############################################################################
# Task controller section
###############################################################################
[FILTER]
#No Content
[RS274NGC]
#- File containing interpreter variables
PARAMETER_FILE = stepper.var
###############################################################################
# Motion control section
###############################################################################
[EMCMOT]
#- Name of the motion controller to use (only one exists for nontrivkins)
EMCMOT = motmod
#- Timeout for comm to emcmot, in seconds
COMM_TIMEOUT = 1.0
#+ Base task period, in nanosecs - this is the fastest thread in the machine
#BASE_PERIOD = 15000
#BASE_PERIOD = 18000
#BASE_PERIOD = 20000
BASE_PERIOD = 35000
#BASE_PERIOD = 50000
#- Servo task period, in nanosecs - will be rounded to an int multiple of BASE_PERIOD
SERVO_PERIOD = 100000
###############################################################################
# Hardware Abstraction Layer section
###############################################################################
[TASK]
# Name of task controller program, e.g., milltask
TASK = milltask
#- Cycle time, in seconds, that task controller will sleep between polls
CYCLE_TIME = 0.100
###############################################################################
# Part program interpreter section
###############################################################################
[HAL]
# The run script first uses halcmd to execute any HALFILE
# files, and then to execute any individual HALCMD commands.
#
# HALUI to interact with NML
# Run before any other HALFILE
HALUI = halui
# list of hal config files to run through halcmd
#+ files are executed in the order in which they appear
HALFILE = kinematics.hal
HALFILE = stepper.hal
HALFILE = stepper_parport.hal
HALFILE = estop.hal
#- list of halcmd commands to execute
# commands are executed in the order in which they appear
#HALCMD = save neta
###############################################################################
# Trajectory planner section
###############################################################################
[HALUI]
#No Content
[TRAJ]
#+ machine specific settings
COORDINATES = X Y Z A
LINEAR_UNITS = mm
ANGULAR_UNITS = deg
DEFAULT_LINEAR_VELOCITY = 100
MAX_LINEAR_VELOCITY = 180
DEFAULT_LINEAR_ACCELERATION = 600
MAX_LINEAR_ACCELERATION = 2400
###############################################################################
# Axes sections
###############################################################################
#+ First axis (X)
[EMCIO]
# A Tooltable file
TOOL_TABLE = stepper.tbl
[KINS]
KINEMATICS = trivkins coordinates=XYZA kinstype=BOTH
JOINTS = 4
[AXIS_X]
MIN_LIMIT = -1
MAX_LIMIT = 2055
MAX_VELOCITY = 170
MAX_ACCELERATION = 2400
[JOINT_0]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 170
MAX_ACCELERATION = 2400
STEPGEN_MAXACCEL = 2960
BACKLASH = 0.000
SCALE = 150.333
MIN_LIMIT = -1
MAX_LIMIT = 2055
FERROR = 1.270
MIN_FERROR = 0.254
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = -50.0
HOME_LATCH_VEL = 1.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 1
#+ Second axis (Y)
[AXIS_Y]
MIN_LIMIT = -1
MAX_LIMIT = 6050.0
MAX_VELOCITY = 170
MAX_ACCELERATION = 2400
[JOINT_1]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 170
MAX_ACCELERATION = 2400
STEPGEN_MAXACCEL = 2960
BACKLASH = 0.000
SCALE = 150.333
MIN_LIMIT = -1
MAX_LIMIT = 6050.0
FERROR = 1.270
MIN_FERROR = 0.254
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = -50.0
HOME_LATCH_VEL = 1.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 1
#+ Third axis (Z)
[AXIS_Z]
MIN_LIMIT = -1
MAX_LIMIT = 56.0
MAX_VELOCITY = 8
MAX_ACCELERATION = 600
[JOINT_2]
TYPE = LINEAR
HOME = 55.000
MAX_VELOCITY = 8
MAX_ACCELERATION = 600
STEPGEN_MAXACCEL = 650
#STEPGEN_MAXACCEL = 2960
BACKLASH = 0.000
SCALE = 200
MIN_LIMIT = -1
MAX_LIMIT = 56.0
FERROR = 1.270
#MIN_FERROR = 0.254
# This is done so Z axis can be operated with a HAL closed loop (plasma THC)
MIN_FERROR = 500
HOME_OFFSET = 55.0
HOME_SEARCH_VEL = 10.0
HOME_LATCH_VEL = -2.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
#+ Second axis (A)
[AXIS_A]
MIN_LIMIT = -1
MAX_LIMIT = 6050.0
MAX_VELOCITY = 170
MAX_ACCELERATION = 2400
[JOINT_3]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 170
MAX_ACCELERATION = 2400
STEPGEN_MAXACCEL = 2960
BACKLASH = 0.000
SCALE = 150.333
OUTPUT_SCALE = 1.000
MIN_LIMIT = -1
MAX_LIMIT = 6050.0
FERROR = 1.270
MIN_FERROR = 0.254
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = -50.0
HOME_LATCH_VEL = 1.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 1
###############################################################################
# section for main IO controller parameters
###############################################################################

View File

@@ -0,0 +1,34 @@
############################# Parallel Ports ##############################################
# Load Driver for Two Parallel Ports, one for Breakout Board, other for Plasma Torch Height Control
loadrt hal_parport cfg="0xa400 0xac00"
# Connect both Parallel Ports to Threads for Read / Write
addf parport.0.read base-thread 1
addf parport.0.write base-thread -1
addf parport.1.read base-thread 1
addf parport.1.write base-thread -1
# Invert pins to make motors move in right direction
setp parport.0.pin-06-out-invert 1
setp parport.0.pin-07-out-invert 1
# Hook up the step and dir signals to the parport pins
# Axis A and Y are the same axis but different motors
net StepX stepgen.0.step => parport.0.pin-02-out
net StepY stepgen.1.step => parport.0.pin-03-out
net StepZ stepgen.2.step => parport.0.pin-04-out
net StepA stepgen.3.step => parport.0.pin-05-out
net DirX stepgen.0.dir => parport.0.pin-06-out
net DirY stepgen.1.dir => parport.0.pin-07-out
net DirZ stepgen.2.dir => parport.0.pin-08-out
net DirA stepgen.3.dir => parport.0.pin-09-out
# Hook up limit and home switches, each axis shares a common pin for homing, limit min and limit max
net LimitX parport.0.pin-11-in-not => joint.0.neg-lim-sw-in joint.0.pos-lim-sw-in joint.0.home-sw-in
net LimitY parport.0.pin-12-in-not => joint.1.neg-lim-sw-in joint.1.pos-lim-sw-in joint.1.home-sw-in
#net LimitZ parport.0.pin-13-in => joint.2.neg-lim-sw-in joint.2.pos-lim-sw-in joint.2.home-sw-in
net LimitA parport.0.pin-15-in-not => joint.3.neg-lim-sw-in joint.3.pos-lim-sw-in joint.3.home-sw-in
# Hook up the spindle signal
net SpindleOn spindle.0.forward => parport.1.pin-01-out

View File

@@ -0,0 +1,34 @@
############################# Parallel Ports ##############################################
# Load Driver for Two Parallel Ports, one for Breakout Board, other for Plasma Torch Height Control
loadrt hal_parport cfg="0xa400 0xac00"
# Connect both Parallel Ports to Threads for Read / Write
addf parport.0.read base-thread 1
addf parport.0.write base-thread -1
addf parport.1.read base-thread 1
addf parport.1.write base-thread -1
# Invert pins to make motors move in right direction
setp parport.0.pin-06-out-invert 1
setp parport.0.pin-07-out-invert 1
# Hook up the step and dir signals to the parport pins
# Axis A and Y are the same axis but different motors
net StepX stepgen.0.step => parport.0.pin-02-out
net StepY stepgen.1.step => parport.0.pin-03-out
net StepZ stepgen.2.step => parport.0.pin-04-out
net StepA stepgen.3.step => parport.0.pin-05-out
net DirX stepgen.0.dir => parport.0.pin-06-out
net DirY stepgen.1.dir => parport.0.pin-07-out
net DirZ stepgen.2.dir => parport.0.pin-08-out
net DirA stepgen.3.dir => parport.0.pin-09-out
# Hook up limit and home switches, each axis shares a common pin for homing, limit min and limit max
net LimitX parport.0.pin-11-in-not => joint.0.neg-lim-sw-in joint.0.pos-lim-sw-in joint.0.home-sw-in
net LimitY parport.0.pin-12-in-not => joint.1.neg-lim-sw-in joint.1.pos-lim-sw-in joint.1.home-sw-in
net LimitZ parport.0.pin-13-in => joint.2.neg-lim-sw-in joint.2.pos-lim-sw-in joint.2.home-sw-in
net LimitA parport.0.pin-15-in-not => joint.3.neg-lim-sw-in joint.3.pos-lim-sw-in joint.3.home-sw-in
# Hook up the spindle signal
net SpindleOn motion.spindle-forward => parport.1.pin-01-out