Import LinuxCNC source tree
This commit is contained in:
79
configs/sim/axis/laser/laser.hal
Normal file
79
configs/sim/axis/laser/laser.hal
Normal file
@@ -0,0 +1,79 @@
|
||||
loadrt conv_s32_u32 names=laser.motion.type-conv
|
||||
loadrt bitslice names=laser.motion.type-slice personality=2
|
||||
loadrt limit1 names=laser.power.min.limit,laser.power.max.limit,laser.power.cmd.limit
|
||||
loadrt laserpower names=laser.control
|
||||
loadrt raster names=laser.raster
|
||||
loadrt not names=motion.enabled-not
|
||||
|
||||
addf laser.power.min.limit servo-thread
|
||||
addf laser.power.max.limit servo-thread
|
||||
addf laser.power.cmd.limit servo-thread
|
||||
addf laser.motion.type-conv servo-thread
|
||||
addf laser.motion.type-slice servo-thread
|
||||
addf laser.control servo-thread
|
||||
addf laser.raster servo-thread
|
||||
addf motion.enabled-not servo-thread
|
||||
|
||||
|
||||
#the laser will fire when the the machine is in motion
|
||||
#and motion.motion-type is 2 or 3, which is linear feed or arc feed
|
||||
#we use a bit-slice to determine if we can fire out laser
|
||||
net laser.motion.type <= motion.motion-type
|
||||
net laser.motion.type => laser.motion.type-conv.in
|
||||
net laser.motion.type-u32 <= laser.motion.type-conv.out
|
||||
net laser.motion.type-u32 => laser.motion.type-slice.in
|
||||
net laser.motion.feed-move <= laser.motion.type-slice.out-01
|
||||
|
||||
|
||||
#enables laser to fire
|
||||
net laser.motion.feed-move => laser.control.enabled
|
||||
|
||||
setp laser.power.min.limit.min 0
|
||||
setp laser.power.min.limit.max 100
|
||||
|
||||
net laser.power.min.cmd <= motion.analog-out-00
|
||||
net laser.power.min.cmd => laser.power.min.limit.in
|
||||
net laser.power.min.value <= laser.power.min.limit.out
|
||||
net laser.power.min.value => laser.control.min-power
|
||||
|
||||
setp laser.power.max.limit.min 0
|
||||
setp laser.power.max.limit.max 100
|
||||
|
||||
net laser.power.max.cmd <= motion.analog-out-01
|
||||
net laser.power.max.cmd => laser.power.max.limit.in
|
||||
net laser.power.max.value <= laser.power.max.limit.out
|
||||
net laser.power.max.value => laser.control.max-power
|
||||
|
||||
setp laser.power.cmd.limit.min 0
|
||||
setp laser.power.cmd.limit.max 100
|
||||
|
||||
net laser.power.cmd <= motion.analog-out-02
|
||||
net laser.power.cmd => laser.power.cmd.limit.in
|
||||
net laser.power.cmd.value <= laser.power.cmd.limit.out
|
||||
net laser.power.cmd.value => laser.control.vector-power
|
||||
|
||||
net laser.motion.distance-to-go <= motion.distance-to-go
|
||||
net laser.motion.distance-to-go => laser.control.distance-to-go
|
||||
|
||||
net laser.motion.cur-vel <= motion.current-vel
|
||||
net laser.motion.cur-vel => laser.control.cur-velocity
|
||||
|
||||
net laser.motion.req-vel <= motion.requested-vel
|
||||
net laser.motion.req-vel => laser.control.req-velocity
|
||||
|
||||
#rastering controller
|
||||
net J0:pos-fb => laser.raster.position
|
||||
|
||||
net laser.raster.program-sig <= laser.raster.program
|
||||
sets laser.raster.program-sig 20000
|
||||
|
||||
net laser.power.raster-power <= laser.raster.output
|
||||
net laser.power.raster-power => laser.control.raster-power
|
||||
|
||||
net laser.power.raster-enabled <= laser.raster.enabled
|
||||
net laser.power.raster-enabled => laser.control.raster-mode
|
||||
|
||||
net motion.enable-not <= laser.raster.fault
|
||||
net motion.enable-not => motion.enabled-not.in
|
||||
net motion:enable <= motion.enabled-not.out
|
||||
net motion:enable => motion.enable
|
||||
64
configs/sim/axis/laser/laser.ini
Normal file
64
configs/sim/axis/laser/laser.ini
Normal file
@@ -0,0 +1,64 @@
|
||||
# minimal sim config for laser controller and raster
|
||||
[EMC]
|
||||
VERSION = 1.1
|
||||
MACINE = laser
|
||||
|
||||
[KINS]
|
||||
JOINTS = 3
|
||||
KINEMATICS = corexykins
|
||||
|
||||
[TRAJ]
|
||||
COORDINATES = XYZ
|
||||
LINEAR_UNITS = mm
|
||||
ANGULAR_UNITS = degree
|
||||
|
||||
[HAL]
|
||||
HALUI = halui
|
||||
HALFILE = LIB:basic_sim.tcl
|
||||
HALFILE = laser.hal
|
||||
POSTGUI_HALFILE = postgui.hal
|
||||
|
||||
|
||||
[DISPLAY]
|
||||
DISPLAY = axis
|
||||
MAX_LINEAR_VELOCITY = 1
|
||||
PYVCP = pyvcp.xml
|
||||
|
||||
|
||||
[TASK]
|
||||
TASK = milltask
|
||||
CYCLE_TIME = 0.001
|
||||
|
||||
[RS274NGC]
|
||||
FEATURES=12
|
||||
PARAMETER_FILE = laser.var
|
||||
REMAP= M10 modalgroup=10 python=rasterStop
|
||||
REMAP= M11 modalgroup=10 python=rasterBegin argspec=PQRS
|
||||
REMAP= M12 modalgroup=10 python=rasterData
|
||||
REMAP= M13 modalgroup=10 python=rasterStart
|
||||
|
||||
[EMCMOT]
|
||||
EMCMOT = motmod
|
||||
SERVO_PERIOD = 1000000
|
||||
TRAJ_PERIOD = 100000
|
||||
|
||||
[PYTHON]
|
||||
TOPLEVEL=python/toplevel.py
|
||||
PATH_APPEND=python
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[JOINT_0]
|
||||
TYPE = LINEAR
|
||||
HOME_SEQUENCE = 0
|
||||
|
||||
|
||||
[JOINT_1]
|
||||
TYPE = LINEAR
|
||||
HOME_SEQUENCE = 0
|
||||
|
||||
[JOINT_2]
|
||||
TYPE = LINEAR
|
||||
HOME_SEQUENCE = 0
|
||||
25
configs/sim/axis/laser/postgui.hal
Normal file
25
configs/sim/axis/laser/postgui.hal
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
net laser.raster.program-sig => raster-programmer.program
|
||||
net raster.fault-code <= laser.raster.fault-code
|
||||
net raster.fault-code => raster-programmer.fault-code
|
||||
net laser.power.raster-enabled => raster-programmer.enabled
|
||||
|
||||
net raster-programmer-run <= raster-programmer.run
|
||||
net raster-programmer-run => laser.raster.run
|
||||
|
||||
net laser-power <= laser.control.power
|
||||
net laser-power => pyvcp.power
|
||||
|
||||
net laser.power.min.value => pyvcp.min-power
|
||||
net laser.power.max.value => pyvcp.max-power
|
||||
net laser.power.cmd.value => pyvcp.vector-power
|
||||
|
||||
net laser.power.raster-enabled => pyvcp.raster-enabled
|
||||
|
||||
net motion.enable-not => pyvcp.raster-fault
|
||||
|
||||
net raster-prog-size <= laser.raster.count
|
||||
net raster-prog-size => pyvcp.raster-program-size
|
||||
|
||||
net raster-reset <= laser.raster.reset
|
||||
net raster-reset => pyvcp.raster-reset
|
||||
48
configs/sim/axis/laser/python/remap.py
Normal file
48
configs/sim/axis/laser/python/remap.py
Normal file
@@ -0,0 +1,48 @@
|
||||
from pyhal import *
|
||||
from raster import *
|
||||
from interpreter import INTERP_EXECUTE_FINISH, INTERP_OK
|
||||
|
||||
rasterProgrammer = None
|
||||
|
||||
def init(self):
|
||||
global rasterProgrammer
|
||||
rasterProgrammer = RasterProgrammer("raster-programmer")
|
||||
print("raster initialized")
|
||||
|
||||
|
||||
def rasterBegin(self, **words):
|
||||
global rasterProgrammer
|
||||
#machine must be in position before begin issued
|
||||
#make motion complete queue prior to begin program
|
||||
yield INTERP_EXECUTE_FINISH
|
||||
if rasterProgrammer:
|
||||
offset = float(words['p'])
|
||||
bpp = int(words['q'])
|
||||
ppu = float(words['r'])
|
||||
count = int(words['s'])
|
||||
rasterProgrammer.begin(offset, bpp, ppu, count)
|
||||
|
||||
|
||||
def rasterData(self, **words):
|
||||
global rasterProgrammer
|
||||
if rasterProgrammer:
|
||||
comment = self.blocks[self.remap_level].comment.strip()
|
||||
rasterProgrammer.data(comment)
|
||||
return INTERP_OK
|
||||
|
||||
|
||||
def rasterStart(self, **words):
|
||||
global rasterProgrammer
|
||||
#machine must be in position before run issued
|
||||
#make motion complete queue prior to run program command
|
||||
yield INTERP_EXECUTE_FINISH
|
||||
if rasterProgrammer:
|
||||
rasterProgrammer.start()
|
||||
|
||||
def rasterStop(self, **words):
|
||||
global rasterProgrammer
|
||||
yield INTERP_EXECUTE_FINISH
|
||||
if rasterProgrammer:
|
||||
rasterProgrammer.stop()
|
||||
|
||||
|
||||
6
configs/sim/axis/laser/python/toplevel.py
Normal file
6
configs/sim/axis/laser/python/toplevel.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import remap
|
||||
|
||||
|
||||
def __init__(self):
|
||||
if self.task:
|
||||
remap.init(self)
|
||||
56
configs/sim/axis/laser/pyvcp.xml
Normal file
56
configs/sim/axis/laser/pyvcp.xml
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<pyvcp>
|
||||
<label>
|
||||
<text>"Laser"</text>
|
||||
</label>
|
||||
<vbox>
|
||||
<labelframe text="Output Power">
|
||||
<bar>
|
||||
<halpin>"power"</halpin>
|
||||
<min_>0</min_>
|
||||
<max_>100</max_>
|
||||
<bgcolor>"grey"</bgcolor>
|
||||
<fillcolor>"red"</fillcolor>
|
||||
</bar>
|
||||
</labelframe>
|
||||
<labelframe text="Min Power">
|
||||
<number>
|
||||
<halpin>"min-power"</halpin>
|
||||
<format>"2.2f"</format>
|
||||
</number>
|
||||
</labelframe>
|
||||
<labelframe text="Max Power">
|
||||
<number>
|
||||
<halpin>"max-power"</halpin>
|
||||
<format>"2.2f"</format>
|
||||
</number>
|
||||
</labelframe>
|
||||
<labelframe text="Vector Power">
|
||||
<number>
|
||||
<halpin>"vector-power"</halpin>
|
||||
<format>"2.2f"</format>
|
||||
</number>
|
||||
</labelframe>
|
||||
<labelframe text="Raster On">
|
||||
<led>
|
||||
<halpin>"raster-enabled"</halpin>
|
||||
</led>
|
||||
</labelframe>
|
||||
<labelframe text="Raster Program Size">
|
||||
<s32>
|
||||
<halpin>"raster-program-size"</halpin>
|
||||
</s32>
|
||||
</labelframe>
|
||||
<labelframe text="Raster Fault">
|
||||
<led>
|
||||
<halpin>"raster-fault"</halpin>
|
||||
</led>
|
||||
</labelframe>
|
||||
<button>
|
||||
<halpin>"raster-reset"</halpin>
|
||||
<text>"Reset Raster"</text>
|
||||
</button>
|
||||
</vbox>
|
||||
</pyvcp>
|
||||
|
||||
|
||||
27
configs/sim/axis/laser/raster_test.ngc
Normal file
27
configs/sim/axis/laser/raster_test.ngc
Normal file
@@ -0,0 +1,27 @@
|
||||
G61
|
||||
G90
|
||||
F5000
|
||||
G0 X-1 Y0
|
||||
M68 E1 Q100 (set max laser power to 100)
|
||||
M11 P1 Q4 R.5 S9
|
||||
;raster program can be programmed with more than 1 M12 line
|
||||
M12 (1E282)
|
||||
M12 (C494)
|
||||
M13 (run raster)
|
||||
G0 X0
|
||||
G1 X15 F5000
|
||||
G0 X16
|
||||
M10 (stop raster)
|
||||
M68 E1 Q100 (set max laser power to 100)
|
||||
|
||||
G0 Y1 X17
|
||||
M11 P-1 Q4 R.5 S9
|
||||
M12 (1E28FC494)
|
||||
M13 (enable raster)
|
||||
G0 X15
|
||||
G1 X0 F5000
|
||||
G0 X-1
|
||||
M10 (stop raster)
|
||||
M2
|
||||
|
||||
|
||||
24
configs/sim/axis/laser/vector_test.ngc
Normal file
24
configs/sim/axis/laser/vector_test.ngc
Normal file
@@ -0,0 +1,24 @@
|
||||
M68 E0 Q0 (set minimum laser power to 0)
|
||||
M68 E1 Q100 (set maximum laser power to 100)
|
||||
|
||||
G64 P0.1 Q0.1
|
||||
|
||||
G0 X0 Y0
|
||||
F1000
|
||||
M68 E2 Q100 (set commanded power to 100)
|
||||
G1 X2
|
||||
G1 Y2
|
||||
G1 X0
|
||||
G1 Y0
|
||||
|
||||
G0 X0 Y0
|
||||
M68 E2 Q0 (set commanded power to 0)
|
||||
G1 X5 M67 E2 Q25 (move from 0 to 5 scaling power from 0 to 25 along the way)
|
||||
G1 X10 M67 E2 Q75 (move from 5 to 10 scaling power from 25 to 75 along the way)
|
||||
G1 Y10 (move with output power at 75)
|
||||
G1 X0 M67 E2 Q50 (move scaling from power 75 down to 50)
|
||||
G1 Y0 M67 E2 Q0 (move scaling from power 50 down to 0)
|
||||
|
||||
M2
|
||||
|
||||
|
||||
23
configs/sim/axis/laser/vector_test2.ngc
Normal file
23
configs/sim/axis/laser/vector_test2.ngc
Normal file
@@ -0,0 +1,23 @@
|
||||
M68 E0 Q0 (set minimum laser power to 0)
|
||||
M68 E1 Q100 (set maximum laser power to 100)
|
||||
|
||||
G64
|
||||
|
||||
G0 X0
|
||||
F1000
|
||||
M68 E2 Q100 (set commanded power to 100)
|
||||
G1 X5
|
||||
G1 X6
|
||||
G1 X7
|
||||
M68 E2 Q50
|
||||
G1 X8
|
||||
M68 E2 Q0
|
||||
G1 X9
|
||||
G1 X10 M67 E2 Q50
|
||||
G1 X15 M67 E2 Q25
|
||||
G1 X20 M67 E2 Q10
|
||||
G1 X22
|
||||
G1 X25 M67 E2 Q100
|
||||
M2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user