Skip to content

Commit

Permalink
working vector laser config
Browse files Browse the repository at this point in the history
  • Loading branch information
jv4779 committed May 11, 2012
1 parent 569f8ff commit 3601ed5
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 103 deletions.
117 changes: 64 additions & 53 deletions 2x_Laser.hal
Expand Up @@ -2,28 +2,34 @@
# If you make changes to this file, they will be
# overwritten when you run stepconf again

loadrt threads name1=laser-thread period1=[EMCMOT]BASE_PERIOD
loadrt threads name1=base-thread period1=[EMCMOT]BASE_PERIOD name2=charge-pump-thread period2=100000

loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt probe_parport
loadrt hal_parport cfg="0x378 out"
setp parport.0.reset-time 1000
# setp parport.0.reset-time 1200
loadrt stepgen step_type=0,0,0
loadrt pwmgen output_type=0
loadrt charge_pump
loadrt abs count=1

addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
# need capture-position in laser-thread for raster engraving:
addf stepgen.capture-position laser-thread
# addf stepgen.capture-position base-thread
addf pwmgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread
# addf parport.0.reset 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 pwmgen.update servo-thread
addf abs.0 servo-thread

addf charge-pump charge-pump-thread

net laser-power-cmd <= motion.analog-out-00 => pwmgen.0.value
net laser-pwm <= pwmgen.0.pwm
Expand All @@ -35,76 +41,81 @@ setp pwmgen.0.scale 1
setp pwmgen.0.offset 0
setp pwmgen.0.dither-pwm true

net dout-02 <= motion.digital-out-02
net din-02 => motion.digital-in-02
net coolant-mist <= iocontrol.0.coolant-mist
net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in

net laser-chiller => parport.0.pin-01-out
net estop-out => parport.0.pin-01-out
net xstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
# setp parport.0.pin-02-out-reset 1
net xdir => parport.0.pin-03-out
setp parport.0.pin-03-out-invert 1
setp parport.0.pin-03-out-invert 0
net ystep => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
# setp parport.0.pin-04-out-reset 1
net ydir => parport.0.pin-05-out
setp parport.0.pin-05-out-invert 1
net ustep => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
net udir => parport.0.pin-07-out
net wstep => parport.0.pin-06-out
# setp parport.0.pin-06-out-reset 1
net wdir => parport.0.pin-07-out
setp parport.0.pin-07-out-invert 1
net dout-02 => parport.0.pin-08-out
net xenable => parport.0.pin-08-out
setp parport.0.pin-08-out-invert 1
net laser-pwm => parport.0.pin-14-out
net xenable => parport.0.pin-16-out
net coolant-mist => parport.0.pin-16-out
net laser-final => parport.0.pin-17-out

net home-x <= parport.0.pin-10-in-not
net home-y <= parport.0.pin-11-in-not
net both-w <= parport.0.pin-12-in-not
net max-home-y <= parport.0.pin-13-in-not
net min-home-x <= parport.0.pin-15-in-not

net din-02 <= parport.0.pin-13-in
# charge pump output on pin 9
net charge-pump-out-09 charge-pump.out => parport.0.pin-09-out

# based on Pololu drivers with Allegro drivers (1us ea hi/lo step, 200ns dir setup/hold)
# Keling 4030 driver 1.2us step, 5us dir setup
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1000
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 200
setp stepgen.0.dirsetup 200
setp stepgen.0.steplen 1200
setp stepgen.0.stepspace 1200
setp stepgen.0.dirhold 1000
setp stepgen.0.dirsetup 5000
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable
net home-x => axis.0.home-sw-in
net min-home-x => axis.0.home-sw-in
net min-home-x => axis.0.neg-lim-sw-in

setp stepgen.1.position-scale [AXIS_1]SCALE
setp stepgen.1.steplen 1000
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 200
setp stepgen.1.dirsetup 200
setp stepgen.1.steplen 1200
setp stepgen.1.stepspace 1200
setp stepgen.1.dirhold 1000
setp stepgen.1.dirsetup 5000
setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable axis.1.amp-enable-out => stepgen.1.enable
net home-y => axis.1.home-sw-in

setp stepgen.2.position-scale [AXIS_6]SCALE
setp stepgen.2.steplen 1000
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 200
setp stepgen.2.dirsetup 200
setp stepgen.2.maxaccel [AXIS_6]STEPGEN_MAXACCEL
net upos-cmd axis.6.motor-pos-cmd => stepgen.2.position-cmd
net upos-fb stepgen.2.position-fb => axis.6.motor-pos-fb
net ustep <= stepgen.2.step
net udir <= stepgen.2.dir
net uenable axis.6.amp-enable-out => stepgen.2.enable
net max-home-y => axis.1.home-sw-in
net max-home-y => axis.1.pos-lim-sw-in

setp stepgen.2.position-scale [AXIS_8]SCALE
setp stepgen.2.steplen 1200
setp stepgen.2.stepspace 1200
setp stepgen.2.dirhold 1000
setp stepgen.2.dirsetup 5000
setp stepgen.2.maxaccel [AXIS_8]STEPGEN_MAXACCEL
net wpos-cmd axis.8.motor-pos-cmd => stepgen.2.position-cmd
net wpos-fb stepgen.2.position-fb => axis.8.motor-pos-fb
net wstep <= stepgen.2.step
net wdir <= stepgen.2.dir
net wenable axis.8.amp-enable-out => stepgen.2.enable
net both-w => axis.8.neg-lim-sw-in
net both-w => axis.8.pos-lim-sw-in

net zpos-cmd-fb <= axis.2.motor-pos-cmd => axis.2.motor-pos-fb

net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in

net tool-change-loop iocontrol.0.tool-change => iocontrol.0.tool-changed
net tool-prepare-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared

Expand All @@ -119,7 +130,7 @@ net laser-dout <= motion.digital-out-00
########################

loadrt laserfreq
addf laserfreq.0.make-pulses laser-thread
addf laserfreq.0.make-pulses base-thread
addf laserfreq.0.update servo-thread
setp laserfreq.0.duration [LASER]PULSED_CUT_DURATION
net current-vel motion.current-vel => laserfreq.0.velocity
Expand All @@ -143,7 +154,7 @@ net xpos-jcmd axis.0.joint-pos-cmd => motion-offset-sub.in0
net xpos-cmd axis.0.motor-pos-cmd => motion-offset-sub.in1
net motion-offset <= motion-offset-sub.out

addf motion-offset-apply laser-thread
addf motion-offset-apply base-thread
net xpos-fb => motion-offset-apply.in0
net motion-offset => motion-offset-apply.in1
net raster-pos-fb <= motion-offset-apply.out
Expand All @@ -156,11 +167,11 @@ loadrt streamer depth=256 cfg=bbf

# The order of addf determines the order of execution.
# Order these so that the inputs cascade correctly to the outputs:
addf raster-pos-gt-comp laser-thread
addf raster-read-lut laser-thread
addf streamer.0 laser-thread
addf raster-fire-lut laser-thread
addf laser-final-lut laser-thread
addf raster-pos-gt-comp base-thread
addf raster-read-lut base-thread
addf streamer.0 base-thread
addf raster-fire-lut base-thread
addf laser-final-lut base-thread

net raster-fire <= streamer.0.pin.0
net raster-rev <= streamer.0.pin.1
Expand Down Expand Up @@ -200,7 +211,7 @@ net laser-raster <= raster-fire-lut.out

addf laser-magic-z-comp servo-thread
net zpos-fb <= axis.2.joint-pos-fb => laser-magic-z-comp.in0
setp laser-magic-z-comp.in1 0.0
setp laser-magic-z-comp.in1 -0.0001
net laser-magic-z <= laser-magic-z-comp.out

########################
Expand Down
104 changes: 56 additions & 48 deletions 2x_Laser.ini
Expand Up @@ -15,38 +15,40 @@ PULSED_CUT_DURATION = 0.003

[DISPLAY]
DISPLAY = axis
USER_COMMAND_FILE = /home/bjj/Desktop/2x_Laser/axisrc
USER_COMMAND_FILE = /home/jvangrin/emc2/configs/2x_laser/axisrc
EDITOR = gedit
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 5
INTRO_GRAPHIC = emc2.gif
INTRO_TIME = 5
#PROGRAM_PREFIX = /home/ubuntu/emc2/nc_files
PROGRAM_PREFIX = /home/bjj/Desktop/2x_Laser
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
PROGRAM_PREFIX = /home/jvangrin/emc2/configs/2x_laser
INCREMENTS = .1in .05in .01in .005in .001in .0001in
GEOMETRY = XYZ
PYVCP = custompanel.xml

#[FILTER]
#PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
#PROGRAM_EXTENSION = .py Python Script
#png = image-to-gcode
#gif = image-to-gcode
#jpg = image-to-gcode
#py = python
[FILTER]
PROGRAM_EXTENSION = .[nN][gG][cC] rs273ngc Gcode File
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python

[TASK]
TASK = milltask
CYCLE_TIME = 0.010

[RS274NGC]
PARAMETER_FILE = emc.var
RS274NGC_STARTUP_CODE = G20 G90 G64 P0.001

[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
BASE_PERIOD = 27000
BASE_PERIOD = 25000
SERVO_PERIOD = 1000000

[HAL]
Expand All @@ -56,14 +58,18 @@ POSTGUI_HALFILE = custom_postgui.hal
# for joystick:
HALUI = halui

[HALUI]
MDI_COMMAND = G0 G53 Z0
MDI_COMMAND = G10 L20 P1 X0 Y0

[TRAJ]
AXES = 7
COORDINATES = X Y Z U
LINEAR_UNITS = mm
AXES = 9
COORDINATES = X Y Z W
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_VELOCITY = 50.00
MAX_LINEAR_VELOCITY = 470
DEFAULT_VELOCITY = 8.0
MAX_LINEAR_VELOCITY = 18.0

[EMCIO]
EMCIO = io
Expand All @@ -72,46 +78,47 @@ TOOL_TABLE = tool.tbl

[AXIS_0]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 470
#MAX_ACCELERATION = 2500.0
MAX_ACCELERATION = 7500.0
STEPGEN_MAXACCEL = 9375.0
SCALE = 78.7401574803
FERROR = 1
MIN_FERROR = .25
MAX_VELOCITY = 17.575017575
MAX_ACCELERATION = 300.0
STEPGEN_MAXACCEL = 375.0
SCALE = 1000.0
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -0.001
MAX_LIMIT = 535
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 120
HOME_LATCH_VEL = 1
MAX_LIMIT = 31.501
HOME = 0
HOME_OFFSET = -0.25
HOME_SEARCH_VEL = -2.5
HOME_LATCH_VEL = 0.83
HOME_SEQUENCE = 0
HOME_IGNORE_LIMITS = YES

[AXIS_1]
TYPE = LINEAR
#HOME = 285.0
MAX_VELOCITY = 200.0
MAX_ACCELERATION = 5000.0
STEPGEN_MAXACCEL = 6250.0
SCALE = 78.7401574803
MAX_VELOCITY = 17.575017575
MAX_ACCELERATION = 200.0
STEPGEN_MAXACCEL = 250.0
SCALE = 1000.0
FERROR = 1
MIN_FERROR = .25
MIN_FERROR = 0.05
MIN_LIMIT = -0.001
MAX_LIMIT = 285
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 100
HOME_LATCH_VEL = 1
MAX_LIMIT = 15.751
HOME = 15.75
HOME_OFFSET = 16.0
HOME_SEARCH_VEL = 2.5
HOME_LATCH_VEL = -0.83
HOME_SEQUENCE = 0
HOME_IGNORE_LIMITS = YES

[AXIS_6]
[AXIS_8]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 6
MAX_ACCELERATION = 50.0
STEPGEN_MAXACCEL = 62.5
SCALE = 6047.24409
FERROR = 1
MIN_FERROR = .25
MAX_VELOCITY = 0.5
MAX_ACCELERATION = 20.0
STEPGEN_MAXACCEL = 25.0
SCALE = 19200.0
FERROR = 0.05
MIN_FERROR = 0.01
HOME_SEQUENCE = 0

[AXIS_2]
Expand All @@ -123,6 +130,7 @@ STEPGEN_MAXACCEL = 60000
SCALE = 1
FERROR = 1
MIN_FERROR = .25
MIN_LIMIT = -100
MAX_LIMIT = 100
MIN_LIMIT = -6
MAX_LIMIT = 6
HOME_SEQUENCE = 0

4 changes: 2 additions & 2 deletions axisrc
Expand Up @@ -16,8 +16,8 @@ laser_hide(widgets.view_p)
commands.set_view_z()

# Attach table U to traditional Pg Up/Dn
bind_axis("Next", "Prior", 6)
bind_axis("KP_Next", "KP_Prior", 6)
bind_axis("Next", "Prior", 8)
bind_axis("KP_Next", "KP_Prior", 8)

# Make Z accessible with [] just in case
bind_axis("bracketleft", "bracketright", 2)
Expand Down

0 comments on commit 3601ed5

Please sign in to comment.