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,200 @@
[EMC]
VERSION = 1.1
MACHINE = Sim-5Axis Bridge Mill (xyzbcw)
DEBUG = 0
[DISPLAY]
GEOMETRY = XYZCBW
OPEN_FILE = ./5axisgui.ngc
INCREMENTS = 10 mm, 1 mm, .1 mm
JOG_AXES = XYZC
DISPLAY = axis
CYCLE_TIME = 0.200
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.0
PROGRAM_PREFIX = ../../nc_files/
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
TOOL_EDITOR = tooledit z diam
#EDITOR = geany
PYVCP = 5axis.xml
[RS274NGC]
SUBROUTINE_PATH = ./remap_subs
HAL_PIN_VARS = 1
REMAP = M428 modalgroup=10 ngc=428remap
REMAP = M429 modalgroup=10 ngc=429remap
REMAP = M430 modalgroup=10 ngc=430remap
PARAMETER_FILE = 5axis.var
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[HAL]
HALUI = halui
HALFILE = LIB:basic_sim.tcl
HALFILE = 5axisgui.hal
HALCMD = net :kinstype-select <= motion.analog-out-03 => motion.switchkins-type
POSTGUI_HALFILE = 5axis_postgui.hal
[HALUI]
# M428:bridgemill (kinstype==0 startupDEFAULT)
# M429:identity kins (kinstype==1)
# M430:userk kins (kinstype==2)
MDI_COMMAND = M428
MDI_COMMAND = M429
MDI_COMMAND = M430
[TRAJ]
COORDINATES = XYZBCWY
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
MAX_ANGULAR_VELOCITY = 360.0
DEFAULT_LINEAR_VELOCITY = 200.0
MAX_LINEAR_VELOCITY = 346.0
MAX_LINEAR_ACCELERATION = 800.0
DEFAULT_LINEAR_ACCELERATION = 800.0
[EMCIO]
TOOL_TABLE = 5axis.tbl
[KINS]
# Note: Supported coordinates are XYZBCW but the W coordinate
# motion is incorporated into the X,Y,Z axes.
# Use of the W coordinate requires a joint (5)
# in order to allow display of W values.
# Use immediate homing for this joint (JOINT_5)
# Note: 5axiskins is misnomer
# (xyzbcw uses 6 joints)
# (xyzbcwy uses 7 joints)
# xyzbcw
# type0:5axiskins, type1:identity, type2:userk
# x:joint0,y:joint1,z:joint2,b:joint3,c:joint4,w:joint5
# JOINTS = 6
# KINEMATICS = 5axiskins
# illustraed below is complex example with duplicate
# coord letters for y, 7 joints total):
# type0:5axiskins, type1:identity, type2:userk
# x:joint0
# y:joint1 AND joint6
# z:joint2
# b:joint3
# c:joint4
# w:joint5
JOINTS = 7
KINEMATICS = 5axiskins coordinates=xyzbcwy
[AXIS_X]
MIN_LIMIT = -500
MAX_LIMIT = 500
MAX_VELOCITY = 200
MAX_ACCELERATION = 800
[AXIS_Y]
MIN_LIMIT = -500
MAX_LIMIT = 500
MAX_VELOCITY = 200
MAX_ACCELERATION = 800
[AXIS_Z]
MIN_LIMIT = -500
MAX_LIMIT = 100
MAX_VELOCITY = 200
MAX_ACCELERATION = 800
# B is one-to-one to JOINT_3
[AXIS_B]
MIN_LIMIT = -120
MAX_LIMIT = 120
MAX_VELOCITY = 60
MAX_ACCELERATION = 200
# C is one-to-one to JOINT_4
[AXIS_C]
MIN_LIMIT = -36000
MAX_LIMIT = 36000
MAX_VELOCITY = 60
MAX_ACCELERATION = 200
# W motion is incorporated in Z motion
# but a joint (JOINT_5) must be configured
# to support display of W values
[AXIS_W]
MIN_LIMIT = -100
MAX_LIMIT = 500
MAX_VELOCITY = 200
MAX_ACCELERATION = 800
[JOINT_0]
TYPE = LINEAR
MAX_VELOCITY = 200
MAX_ACCELERATION = 800
MIN_LIMIT = -500
MAX_LIMIT = 500
HOME_SEARCH_VEL = 0
HOME_SEQUENCE = 0
[JOINT_1]
TYPE = LINEAR
MAX_VELOCITY = 200
MAX_ACCELERATION = 800
MIN_LIMIT = -500
MAX_LIMIT = 500
HOME_SEARCH_VEL = 0
HOME_SEQUENCE = -1
# joints 1 and 6 used for y
[JOINT_6]
TYPE = LINEAR
MAX_VELOCITY = 200
MAX_ACCELERATION = 800
MIN_LIMIT = -500
MAX_LIMIT = 500
HOME_SEARCH_VEL = 0
HOME_SEQUENCE = -1
[JOINT_2]
TYPE = LINEAR
MAX_VELOCITY = 200
MAX_ACCELERATION = 800
MIN_LIMIT = -500
MAX_LIMIT = 100
HOME_SEARCH_VEL = 0
HOME_SEQUENCE = 0
[JOINT_3]
TYPE = ANGULAR
MAX_VELOCITY = 60
MAX_ACCELERATION = 200
MIN_LIMIT = -120
MAX_LIMIT = 120
HOME_SEARCH_VEL = 0
HOME_SEQUENCE = 0
[JOINT_4]
TYPE = ANGULAR
MAX_VELOCITY = 60
MAX_ACCELERATION = 200
MIN_LIMIT = -36000
MAX_LIMIT = 36000
HOME_SEARCH_VEL = 0
HOME_SEQUENCE = 0
# immediate homing for JOINT_5 (w coordinate)
[JOINT_5]
TYPE = LINEAR
MIN_LIMIT = -100
MAX_LIMIT = 500
MAX_VELOCITY = 200
MAX_ACCELERATION = 800
HOME_SEARCH_VEL = 0
HOME_SEQUENCE = 0

View File

@@ -0,0 +1,4 @@
T10 P10 Z10 D10
T11 P11 Z11 D10
T100 P100 Z100 D10
T150 P150 Z150 D10

View File

@@ -0,0 +1,128 @@
<?xml version='1.0' encoding='UTF-8'?>
<pyvcp>
<vbox>
<relief>"ridge"</relief>
<bd>5</bd>
<label>
<text>"SWITCHKINS"</text>
<relief>RIDGE</relief>
<bd>3</bd>
</label>
<multilabel>
<legends>[" 0:BRIDGE ", "1:IDENTITY", " 2:USERK "]</legends>
<font>("DejaVu Sans Mono",16)</font>
<bg>"black"</bg>
<fg>"yellow"</fg>
</multilabel>
<button>
<halpin>"type0-button"</halpin>
<text>"Brigemill"</text>
<bd>3</bd>
</button>
<button>
<halpin>"type1-button"</halpin>
<text>"Identity "</text>
<bd>3</bd>
</button>
<button>
<halpin>"type2-button"</halpin>
<text>"userk "</text>
<bd>3</bd>
</button>
</vbox>
<vbox>
<labelframe text="Joints values">
<font>("Helvetica",14)</font>
<hbox>
<label>
<text>"0: "</text>
<font>("Helvetica",14)</font>
</label>
<number>
<halpin>"joint0"</halpin>
<font>("Helvetica",14)</font>
<format>"4.4f"</format>
</number>
</hbox>
<hbox>
<label>
<text>"1: "</text>
<font>("Helvetica",14)</font>
</label>
<number>
<halpin>"joint1"</halpin>
<font>("Helvetica",14)</font>
<format>"4.4f"</format>
</number>
</hbox>
<hbox>
<label>
<text>"2: "</text>
<font>("Helvetica",14)</font>
</label>
<number>
<halpin>"joint2"</halpin>
<font>("Helvetica",14)</font>
<format>"4.4f"</format>
</number>
</hbox>
<hbox>
<label>
<text>"3: "</text>
<font>("Helvetica",14)</font>
</label>
<number>
<halpin>"joint3"</halpin>
<font>("Helvetica",14)</font>
<format>"4.4f"</format>
</number>
</hbox>
<hbox>
<label>
<text>"4: "</text>
<font>("Helvetica",14)</font>
</label>
<number>
<halpin>"joint4"</halpin>
<font>("Helvetica",14)</font>
<format>"4.4f"</format>
</number>
</hbox>
<hbox>
<label>
<text>"5: "</text>
<font>("Helvetica",14)</font>
</label>
<number>
<halpin>"joint5"</halpin>
<font>("Helvetica",14)</font>
<format>"4.4f"</format>
</number>
</hbox>
<hbox>
<label>
<text>"6: "</text>
<font>("Helvetica",14)</font>
</label>
<number>
<halpin>"joint6"</halpin>
<font>("Helvetica",14)</font>
<format>"4.4f"</format>
</number>
</hbox>
</labelframe>
</vbox>
<vbox>
<relief>"ridge"</relief>
<bd>5</bd>
<button>
<halpin>"vismach-clear"</halpin>
<text>"vismach-clear"</text>
<bd>3</bd>
</button>
</vbox>
</pyvcp>

View File

@@ -0,0 +1,17 @@
net :kinstype.is-0 <= kinstype.is-0 => pyvcp.multilabel.0.legend0
net :kinstype.is-1 <= kinstype.is-1 => pyvcp.multilabel.0.legend1
net :kinstype.is-2 <= kinstype.is-2 => pyvcp.multilabel.0.legend2
net :type0-button <= pyvcp.type0-button => halui.mdi-command-00
net :type1-button <= pyvcp.type1-button => halui.mdi-command-01
net :type2-button <= pyvcp.type2-button => halui.mdi-command-02
net :jx => pyvcp.joint0
net :jy => pyvcp.joint1
net :jz => pyvcp.joint2
net :jb => pyvcp.joint3
net :jc => pyvcp.joint4
net :jw => pyvcp.joint5
net :jy2 => pyvcp.joint6
net :vismach-clear <= pyvcp.vismach-clear => vismach.plotclear

View File

@@ -0,0 +1,32 @@
loadusr -W 5axisgui
# to set different pivot_len, use:
# 'loadusr -W 5axisgui pivot_len=value'
net :jx joint.0.pos-fb 5axisgui.jx
net :jy joint.1.pos-fb 5axisgui.jy
net :jz joint.2.pos-fb 5axisgui.jz
net :jb joint.3.pos-fb 5axisgui.jb
net :jc joint.4.pos-fb 5axisgui.jc
net :jw joint.5.pos-fb
net :jy2 joint.6.pos-fb
# Note: no joint or motor connections are used
# for the w coordinate
# compute pivot-length needed for 5axiskins
# according to gui pivot_len and tool z offset
loadrt sum2 names=pivotsum
addf pivotsum servo-thread
net :gui-pivot-len <= 5axisgui.pivot_len
net :gui-pivot-len => pivotsum.in0
net :tool-len <= motion.tooloffset.z
net :tool-len => pivotsum.in1
net :tool-len => 5axisgui.tool_length
net :pivot-len <= pivotsum.out
net :pivot-len => 5axiskins.pivot-length
net :tool-diam <= halui.tool.diameter
net :tool-diam => 5axisgui.tool_diam

View File

@@ -0,0 +1,53 @@
#<r> = 60 ; sphere radius
#<rdelta> = 5 ; safe distance
#<drilldepth> = -5
#<zstart> = 0
#<bctmax> = 8
#<cctmax> = 16
#<toolno> = 100
#<frate> = 1000
#<bct> = 0
#<cct> = 0
#<cdelta> = [360/#<cctmax>]
#<bdelta> = [90/#<bctmax>]
g49
t#<toolno>m6g43
g53 g0 x0y0z#<zstart>b0c0 w0
g10l20 p0 x0 y0 z[#<r>+#<rdelta>] b0 c0 w0
g0 z0
f#<frate>
o100 while [#<bct> lt #<bctmax>]
#<b> = [#<bct>*#<bdelta>]
#<rnow> = [[#<r>+#<rdelta>]*[cos[#<b>]]]
#<x> = [#<rnow>]
#<y> = 0
#<z> = [-#<rnow>]
g0 x#<x> y#<y>
m66e0l0 ; force sync
g0 z#<z>
g0b[-90+#<b>]
#<cct> = 0
o200 while [#<cct> lt #<cctmax>]
o210 if [[#<bct> mod 2] eq 0]
#<c> = [#<cct> * #<cdelta>]
o210 else
#<c> = [360 - [1+ #<cct>] * #<cdelta>]
o210 endif
#<x> = [#<rnow>*[cos[#<c>]]]
#<y> = [#<rnow>*[sin[#<c>]]]
g0 x#<x> y#<y> z#<z> c#<c>
f#<frate>
g1 w[ #<drilldepth> - #<rdelta>]
g0 w0
m66e0l0 ;force sync
#<cct> = [#<cct>+1]
o200 endwhile
#<bct> = [#<bct>+1]
o100 endwhile
g0x0y0z0b0c0w0
g53 g0 x0y0z0
m2

View File

@@ -0,0 +1,38 @@
This is a simulation of an XYZBCWY 5 axis bridge mill.
Example demo:
1) $ linuxcnc 5axis.ini
2) F1 ---------- Estop off
F2 ---------- Machine on
CTRL-HOME --- home all
F5 ---------- MDI tab
3) orient vismach gui as required
4) g0w10 ; retract w
5) g43h100 ; tool offset (100)
6) g0b45 ; tilt 45 deg wrt z
7) g0c30 ; rotate 30 deg in xy
8) g0w-10 ; simulate drill
9) g0w10 ; retract drill
10) etc
Note: Motion for the W coordinate is incorporated
into the motions of the joints used for X,Y,Z
motion but a corresponding joint.5 is needed to
correctly display W values.
The joint.5.motor-pos-cmd should be looped to the
joint.5.motor-pos-fb and joint.5 should use immediate
homimg (HOME_SEARCH_VEL = 0).
The 5axis.ini illustrates how to use multiple (2)
joints for the axis y coordinate.
Configuration for XYZBCWY (7 joints total)
J0: X
J1: Y
J2: Z
J3: B
J4: C
J5: W
J6: Y

View File

@@ -0,0 +1,24 @@
;M428 by remap: select kinstype=0 genhexkins
o<428remap>sub
#<kinstype> = 0
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N
o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M428:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif
M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M428: Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
(debug,STOP)
M2
o2 else
o2 endif
o<428remap>endsub

View File

@@ -0,0 +1,24 @@
;M429 by remap: select kinstype==1 Identity kinematics
o<429remap>sub
#<kinstype> = 1
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N
o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M429:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif
M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M429:Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
(debug,STOP)
M2
o2 else
o2 endif
o<429remap>endsub

View File

@@ -0,0 +1,24 @@
;M430 by remap: select kinstype==2 userk kins
o<430remap>sub
#<kinstype> = 2
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N
o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M30:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif
M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M430:Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
(debug,STOP)
M2
o2 else
o2 endif
o<430remap>endsub