Greetings guys;
Chucking up that pulley to start making the taper boring, I found TLM
wouldn't run, throwing errors about a non-existant Y axis
I had not run it since before the joints merge.
3 hours worth of checking and editing later, I can make it run but the
axis's are all weird. Pressing a left-right key runs X, and the in-out
keys run Z.
Watching the leds on the bob, it is actually driving the wrong axis.
But, the DRO is showing the axis thats moving as the correct axis for the
one thats actually moving. Me confused. Bumfuzzled even. Configs
attached. Hopefully enough to run it.
What did I miss?
Thanks all;
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>
# This config file was created 2016-07-12 08:21:11.341654 by the update_ini
script
# The original config files may be found in the
/home/gene/linuxcnc/configs/my_LinuxCNC_machine2/my_LinuxCNC_machine2.old
directory
# Generated by PNCconf at Sat Jul 12 11:01:07 2014
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
[EMC]
# The version string for this INI file.
VERSION = 1.0
MACHINE = my_LinuxCNC_machine2
DEBUG = 0
[DISPLAY]
DISPLAY = axis
LATHE = 1
CYCLE_TIME = 0.0500
DEFAULT_SPINDLE_SPEED = 100
HELP_FILE = tklinuxcnc.txt
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.000000
MAX_SPINDLE_OVERRIDE = 2.000000
MIN_SPINDLE_OVERRIDE = 0.500000
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 3
PROGRAM_PREFIX = /home/gene/linuxcnc/nc_files
PYVCP = pyvcp-panel.xml
(INCREMENTS = 50mm 10mm 5mm 1mm .5mm .1mm .05mm .01mm .005mm)
INCREMENTS = .001in .002in .005in .010000 .020000 .050000 .1000in .200in .500in
1.000in
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
DEFAULT_LINEAR_VELOCITY = 10.000
MAX_LINEAR_VELOCITY = 27.000000
MIN_LINEAR_VELOCITY = 0.010000
DEFAULT_ANGULAR_VELOCITY = 0.250000
MAX_ANGULAR_VELOCITY = 90.000000
MIN_ANGULAR_VELOCITY = 0.010000
EDITOR = geany
GEOMETRY = xyz
[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
[RS274NGC]
PARAMETER_FILE = linuxcnc.var
RS274NGC_STARTUP_CODE=G8 G18 G21 G40 G49 G64 P.005 Q.005 G80 G90 G94 G97
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[HAL]
TWO_PASS = tryme
HALUI = halui
HALFILE = my_LinuxCNC_machine2.hal
HALFILE = custom.hal
POSTGUI_HALFILE = postgui_call_list.hal
SHUTDOWN = shutdown.hal
[HALUI]
#no content yet
[TRAJ]
COORDINATES = X Z
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_LINEAR_VELOCITY = 30.0
MAX_LINEAR_VELOCITY = 70.00
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
#********************
# Axis X
#********************
[KINS]
KINEMATICS = trivkins coordinates=XZ
#This is a best-guess at the number of joints, it should be checked
JOINTS = 2
[AXIS_X]
MIN_LIMIT = -40.50000000
MAX_LIMIT = 45.85000000
MAX_VELOCITY = 20.0
MAX_ACCELERATION = 350.0
[JOINT_0]
MIN_LIMIT = -40.50000000
MAX_LIMIT = 45.85000000
TYPE = LINEAR
FERROR = 1.0
MIN_FERROR = 0.01
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 350.0
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 50.0
STEPGEN_MAXACCEL = 700.0
P = 1000.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.001
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 0.0
# these are in nanoseconds
DIRSETUP = 6000
DIRHOLD = 6000
STEPLEN = 2500
STEPSPACE = 2500
STEP_SCALE = 315.150
# all thes are in machine units, g7 doesn't mean shit here!
BACKLASH = 0.075
HOME = 45.40000000
HOME_OFFSET = 45.800000
HOME_SEARCH_VEL = -10.000000
HOME_LATCH_VEL = 1.5
HOME_FINAL_VEL = 18.333333
HOME_USE_INDEX = NO
HOME_SEQUENCE = 0
#********************
# Axis Z
#********************
[AXIS_Z]
MIN_LIMIT = -24.0
MAX_LIMIT = 370.00
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 250.0
[JOINT_1]
MIN_LIMIT = -24.0
MAX_LIMIT = 370.00
TYPE = LINEAR
HOME = 75.0
FERROR = 10.0
MIN_FERROR = 10.50
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 250.0
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
STEPGEN_MAXVEL = 50.0
STEPGEN_MAXACCEL = 500.0000
P = 50.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 40.0
# these are in nanoseconds
DIRSETUP = 6000
DIRHOLD = 6000
STEPLEN = 2500
STEPSPACE = 2500
STEP_SCALE = 401.250
BACKLASH = 0.163
HOME_OFFSET = 60.000000
HOME_SEARCH_VEL = 10.000
HOME_LATCH_VEL = 1.000
HOME_FINAL_VEL = 20.0
HOME_USE_INDEX = NO
HOME_SEQUENCE = 1
#********************
# Spindle
#********************
[SPINDLE_9]
P = 3.0000
#P = 0.000
#I = 0.005
I = 0.035
D = 0.000
#FF0 = 86.00
FF0 = 1.000
#FF1 = 20.000
FF1 = 0.001
FF2 = 0.00
BIAS = 0.0000
FBIAS = 0.570
RBIAS = -0.570
ACCEL = 6.7
LIMIT_RVS_ACCEL = 200.0
#LOWGEAR_S = 0.006000
#HIGHGEAR_S = 0.003000
DEADBAND = 0.000
# diff between s_max_outut and s_scale sets max pwm duty, make max_out 99% of
s_scale
LIMIT_S_MAX_OUTPUT = 99
# But it need clipped in both directions, so...
LIMIT_S_MIN_OUTPUT = -99
ENCODER_SCALE = 200.0
PWMGEN_S_SCALE = 23.00
PWMGEN_S_FREQ = 30000
# near_tol is near.difference in .hal speak
NEAR_TOL = 0.75
NEAR_SCALE = 1.00
ENCODER_SAMPLE = 500000
[HOSTMOT2]
# **** This is for info only ****
DRIVER = hm2_pci
BOARD = 5i25
CONFIG = "num_encoders=1 num_pwmgens=1 num_stepgen=2"
# Generated by PNCconf at Sat Jul 12 11:01:07 2014
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
# Heavily edited by Gene Heskett, Sept 5 12;05 2016 version
# Is work in progress and a mess cluttered with unused stuff!
# today, rigging up a spindle is moving when commanded detector,
# if not, e-stop it. Will use comp.filter-equal pulse as motion detector
# and2.estop to exert the estop, And at least one time-delay. The general idea
# is to have a delay, say 50 milliseconds between motion.spindle-on
# fed to and2-stop.in0, and a oneshot, retriggerable, triggered by
comp.filter-equal
# so if the spindle is on, but not moving after a few milliseconds, shut it off.
# bare start today, but need a working machine to complete the configuration.
loadrt [KINS]KINEMATICS
#autoconverted trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD
num_joints=[KINS]JOINTS
loadrt hostmot2
loadrt hm2_pci config="num_encoders=1 num_pwmgens=1 num_stepgens=2"
#setp hm2_5i25.0.watchdog.timeout_ns 4000000 # no clue, no docs
loadrt boot count=1
loadrt conv_bit_u32 names=conv_bit_u32.dirF,conv_bit_u32.dirR
loadrt conv_u32_float
names=conv_u32_float.boot,conv_u32_float.dirF,conv_u32_float.dirR
loadrt conv_s32_float names=s32_float.cmd,s32_float.spndl
loadrt sample_hold names=sample.dirchg,sample.spndlchg
loadrt sum2
names=sum01,sum23,sumenc,sum2.ovrtrvl,sum2.gearchg,sum2.bias
loadrt pid names=pid.x,pid.z,pid.s
#loadrt at_pid names=pid.s
loadrt abs
names=abs.spindle,abs.vel,abs.tachplus,abs.encdir,abs.piddir,abs.delay
loadrt and2
names=and2.dirchg,and2.yaspindle,and2.lkoutspndl,and2.X,and2.Z,estop_detect
loadrt mult2 names=mult2.buttonscale
loadrt comp names=comp.drvbooted,comp-filter
loadrt oneshot names=spndlmoving
loadrt timedelay names=spndlcmddelay
loadrt mux2 names=enc0,enc1,enc2,enc3,mux2.fwd-rev,mux2.spndl
# name these limit2 turkeys
loadrt limit2 count=3
loadrt limit3 names=rvsaccel
loadrt siggen names=spdwobbler
loadrt lowpass count=2
loadrt scale
names=scale.spindle,scale.limit,scale.motion,scaleX60 #,scale.gc
loadrt debounce cfg=1,1
loadrt lut5 names=lut5-fwd,lut5-rvs,lut5-protect
loadrt not names=not.load,not.spndl,estop_inv # was count=5
loadrt or2 names=or2.0,or2.1,or2.Z,or2.A,or2.B # was count=1
loadrt xor2 names=xor2.dirchg,xor2.motchg
#loadrt mux16 names=ratio-select # for backgear change
loadrt near names=near.speed
#loadrt timedelay names=gcdelay # unused
addf hm2_5i25.0.read servo-thread # first get the data
addf debounce.0 servo-thread # for home switches
addf debounce.1 servo-thread # to sequence a reversal
addf motion-controller servo-thread
# sequence encoder filters shift registers
addf scaleX60 servo-thread
addf comp-filter servo-thread
#sequence the stopped spindle shutdown
addf spndlmoving servo-thread
addf spndlcmddelay servo-thread
addf estop_detect servo-thread # a tristate_bit for backgear in
neutral safety shutdown
addf estop_inv servo-thread
addf motion-command-handler servo-thread
# note reversed order here is part of the filter
addf enc3 servo-thread
addf enc2 servo-thread
addf enc1 servo-thread
addf enc0 servo-thread
addf sum01 servo-thread
addf sum23 servo-thread
addf sumenc servo-thread # this is the output of encoder velocity filter
addf not.load servo-thread
#addf limit2.0 servo-thread
addf comp.drvbooted servo-thread
addf limit2.2 servo-thread
addf boot.0 servo-thread
# these next 5 in sequence for instant action
addf abs.encdir servo-thread
addf abs.piddir servo-thread
addf lut5-fwd servo-thread
addf lut5-rvs servo-thread
addf lut5-protect servo-thread
addf xor2.dirchg servo-thread # extra at moment
addf xor2.motchg servo-thread # extra at moment
addf and2.lkoutspndl servo-thread
addf and2.yaspindle servo-thread
addf and2.dirchg servo-thread
addf and2.X servo-thread
addf and2.Z servo-thread
addf scale.spindle servo-thread # smooth tach needle
addf scale.limit servo-thread
addf pid.x.do-pid-calcs servo-thread
addf pid.z.do-pid-calcs servo-thread
addf conv_u32_float.boot servo-thread
addf conv_bit_u32.dirF servo-thread # now, fix a method of
diddling pid.s.bias
addf conv_u32_float.dirF servo-thread # then conv to a float
for a sum2 input
addf conv_bit_u32.dirR servo-thread #likewise, make a u32
out of a bit
addf conv_u32_float.dirR servo-thread # and make a float out
of that
addf sum2.bias servo-thread
addf spdwobbler.update servo-thread
addf rvsaccel servo-thread
addf pid.s.do-pid-calcs servo-thread
#addf ratio-select servo-thread
addf abs.spindle servo-thread
addf abs.vel servo-thread
addf abs.tachplus servo-thread # make tach read upscale in
reverse
addf not.spndl servo-thread
addf limit2.1 servo-thread
addf or2.0 servo-thread
addf or2.1 servo-thread
addf or2.Z servo-thread
addf or2.A servo-thread
addf or2.B servo-thread
addf lowpass.0 servo-thread
addf lowpass.1 servo-thread
addf mult2.buttonscale servo-thread # s/b in front of near.speed
addf near.speed servo-thread
addf hm2_5i25.0.write servo-thread # then write it
# this is no longer needed, the write above does it
#addf hm2_5i25.0.pet_watchdog servo-thread # else he bites!
# for G33.1 overtravel display
addf s32_float.cmd servo-thread
addf s32_float.spndl servo-thread
addf sample.dirchg servo-thread
addf sample.spndlchg servo-thread
addf sum2.ovrtrvl servo-thread
# for gearchange detection
##addf lowpass.2 servo-thread
#addf sum2.gearchg servo-thread
##addf wcomp.gc servo-thread
#addf gcdelay servo-thread
#addf abs.delay servo-thread
# external input signals
# --- ALL-HOME ---abs.piddir
setp debounce.0.delay 1
net home-switch hm2_5i25.0.gpio.013.in debounce.0.0.in
net debncd-home debounce.0.0.out joint.0.home-sw-in
joint.1.home-sw-in
# switch home stuff to probe
# net dis-home0 joint.0.homing lut5.0.in-0
# net dis-home2 joint.1.homing lut5.0.in-1
# setp lut5.0.function 0x10 # 3 input semi-xor?
# net home-out lut5.0.out # motion.probe-input, not used
anymore
#**************************************
# AXIS X is all joint_0 and stepgen.00
#**************************************
setp pid.x.Pgain [JOINT_0]P
setp pid.x.Igain [JOINT_0]I
setp pid.x.Dgain [JOINT_0]D
setp pid.x.bias [JOINT_0]BIAS
setp pid.x.FF0 [JOINT_0]FF0
setp pid.x.FF1 [JOINT_0]FF1
setp pid.x.FF2 [JOINT_0]FF2
setp pid.x.deadband [JOINT_0]DEADBAND
setp pid.x.maxoutput [JOINT_0]MAX_OUTPUT
setp pid.x.error-previous-target true
setp pid.x.maxerror .0005
net x-index-enable <=> pid.x.index-enable
net x-enable => pid.x.enable
net x-output => pid.x.output
net x-pos-cmd => pid.x.command
net x-vel-cmd => pid.x.command-deriv
net x-pos-fb => pid.x.feedback
# Step Gen X signals/setup
setp hm2_5i25.0.stepgen.00.dirsetup [JOINT_0]DIRSETUP
setp hm2_5i25.0.stepgen.00.dirhold [JOINT_0]DIRHOLD
setp hm2_5i25.0.stepgen.00.steplen [JOINT_0]STEPLEN
setp hm2_5i25.0.stepgen.00.stepspace [JOINT_0]STEPSPACE
setp hm2_5i25.0.stepgen.00.position-scale [JOINT_0]STEP_SCALE
setp hm2_5i25.0.stepgen.00.step_type 0
setp hm2_5i25.0.stepgen.00.control-type 1
setp hm2_5i25.0.stepgen.00.maxaccel [JOINT_0]STEPGEN_MAXACCEL
setp hm2_5i25.0.stepgen.00.maxvel [JOINT_0]STEPGEN_MAXVEL
setp hm2_5i25.0.gpio.004.invert_output true # should change dir, false
was backwards
setp hm2_5i25.0.gpio.002.invert_output false # get active high pulses,
but true gets none
# ---closedloop stepper signals for X---
net x-pos-cmd <= joint.0.motor-pos-cmd
net x-vel-cmd <= joint.0.vel-cmd
net x-output <= hm2_5i25.0.stepgen.00.velocity-cmd
net x-pos-fb <= hm2_5i25.0.stepgen.00.position-fb
net x-pos-fb => joint.0.motor-pos-fb
net x-enable <= joint.0.amp-enable-out
net x-enable => hm2_5i25.0.stepgen.00.enable
#***************************************
# AXIS Z, is all joint_1 and stepgen.01
#***************************************
setp pid.z.Pgain [JOINT_1]P
setp pid.z.Igain [JOINT_1]I
setp pid.z.Dgain [JOINT_1]D
setp pid.z.bias [JOINT_1]BIAS
setp pid.z.FF0 [JOINT_1]FF0
setp pid.z.FF1 [JOINT_1]FF1
setp pid.z.FF2 [JOINT_1]FF2
setp pid.z.deadband [JOINT_1]DEADBAND
setp pid.z.maxoutput [JOINT_1]MAX_OUTPUT
setp pid.z.error-previous-target true
setp pid.z.maxerror .0005
net z-index-enable <=> pid.z.index-enable
net z-enable => pid.z.enable
net z-output => pid.z.output
net z-pos-cmd => pid.z.command
net z-vel-cmd => pid.z.command-deriv
net z-pos-fb => pid.z.feedback
# Step Gen Z signals/setup
setp hm2_5i25.0.stepgen.01.dirsetup [JOINT_1]DIRSETUP
setp hm2_5i25.0.stepgen.01.dirhold [JOINT_1]DIRHOLD
setp hm2_5i25.0.stepgen.01.steplen [JOINT_1]STEPLEN
setp hm2_5i25.0.stepgen.01.stepspace [JOINT_1]STEPSPACE
setp hm2_5i25.0.stepgen.01.position-scale [JOINT_1]STEP_SCALE
setp hm2_5i25.0.stepgen.01.step_type 0
setp hm2_5i25.0.stepgen.01.control-type 1
setp hm2_5i25.0.stepgen.01.maxaccel [JOINT_1]STEPGEN_MAXACCEL
setp hm2_5i25.0.stepgen.01.maxvel [JOINT_1]STEPGEN_MAXVEL
setp hm2_5i25.0.gpio.008.invert_output true # should change change
dir, false=backwards
setp hm2_5i25.0.gpio.006.invert_output false # get active high pulses,
but true=none
# ---closedloop stepper signals for Z---
net z-pos-cmd <= joint.1.motor-pos-cmd
net z-vel-cmd <= joint.1.vel-cmd
net z-output <= hm2_5i25.0.stepgen.01.velocity-cmd
net z-pos-fb <= hm2_5i25.0.stepgen.01.position-fb
net z-pos-fb => joint.1.motor-pos-fb
net z-enable <= joint.1.amp-enable-out
net z-enable => hm2_5i25.0.stepgen.01.enable
#*******************
# SPINDLE_9
#*******************
# do I need this first one? Maybe use it for a limit3's maxa?
#setp limit2.0.maxv [SPINDLE_9]ACCEL
setp pid.s.Pgain [SPINDLE_9]P
setp pid.s.Igain [SPINDLE_9]I
setp pid.s.Dgain [SPINDLE_9]D
setp pid.s.bias [SPINDLE_9]BIAS
setp pid.s.FF0 [SPINDLE_9]FF0
setp pid.s.FF1 [SPINDLE_9]FF1
setp pid.s.FF2 [SPINDLE_9]FF2
setp pid.s.deadband [SPINDLE_9]DEADBAND
setp hm2_5i25.0.pwmgen.00.scale [SPINDLE_9]PWMGEN_S_SCALE
setp hm2_5i25.0.pwmgen.pwm_frequency [SPINDLE_9]PWMGEN_S_FREQ
setp hm2_5i25.0.encoder.sample-frequency [SPINDLE_9]ENCODER_SAMPLE
setp pid.s.error-previous-target true
setp rvsaccel.maxa [SPINDLE_9]LIMIT_RVS_ACCEL
setp scale.limit.gain 0.98
setp scale.limit.in [SPINDLE_9]PWMGEN_S_SCALE
net maxdrive scale.limit.out =>
pid.s.maxoutput
# lets kill things if spindle on, but no motion
# based on a delayed motion.spindle-on for starters
setp spndlcmddelay.on-delay .2 # time to detect spindle movement
setp spndlcmddelay.off-delay .1
net spindle-on motion.spindle-on spndlcmddelay.in # to
be delayed by on-delay
# works, gives true when spindle turned on, so feed it to a tristate_bit called
# estop_detect to enable it,
net estop10 spndlcmddelay.out estop_detect.in1
# next, is spindle moving?
setp spndlmoving.width 0.5 #seconds it can stop
w/o triggering a shutdown
setp spndlmoving.retriggerable True
setp spndlmoving.rising True
setp spndlmoving.falling False
net trigger_move hm2_5i25.0.encoder.00.input-b spndlmoving.in
# now feed the and2
net shutrdown spndlmoving.out-not estop_detect.in0
net gateholderdown estop_detect.out estop_inv.in
net shutitdown estop_inv.out motion.enable # shuts it down
# ---Encoder feedback signals/setup---
setp hm2_5i25.0.encoder.00.counter-mode false
setp hm2_5i25.0.encoder.00.filter true
setp hm2_5i25.0.encoder.00.index-enable true
setp hm2_5i25.0.encoder.00.index-invert false
setp hm2_5i25.0.encoder.00.index-mask false
setp hm2_5i25.0.encoder.00.index-mask-invert false
setp hm2_5i25.0.encoder.00.scale [SPINDLE_9]ENCODER_SCALE
# filter quadrature error noise
# I do not need this x60 in the feedback!
setp scaleX60.gain 60.0000
setp sumenc.gain0 .2500
setp sumenc.gain1 .2500
# detect a passing edge
setp comp-filter.hyst 0.0004 # all we need is a diff of any kind to
trigger the fifo effect
# so by pass it here
net spindle-vel-fb-rps hm2_5i25.0.encoder.00.velocity # src of
signal
# all of this signal name's loads
net spindle-vel-fb-rps scaleX60.in abs.encdir.in
lowpass.0.in enc0.in0 comp-filter.in0
# then continue
net encoderhold-0 enc0.out enc0.in1
enc1.in0 comp-filter.in1 sum01.in0
# IF there is a diff between enc0.in and enc0.out by the unequal from
comp-filter, clock the 4 stage fifo
net encoder-sel comp-filter.equal enc0.sel
enc1.sel enc2.sel enc3.sel
net encoderhold-1 enc1.out enc1.in1 enc2.in0
sum01.in1
net encoderhold-2 enc2.out enc2.in1 enc3.in0
sum23.in0
net encoderhold-3 enc3.out enc3.in1 sum23.in1
net encoderfilter-sum4 sum01.out sumenc.in0
net encoderfilter-sum5 sum23.out sumenc.in1
net spindle-velocity sumenc.out pid.s.feedback
near.speed.in2
net spindle-index hm2_5i25.0.encoder.00.index-enable <=>
motion.spindle-index-enable pid.s.index-enable
net spindle-pos hm2_5i25.0.encoder.00.position
motion.spindle-revs
setp lowpass.0.gain .0125
# Get ready to boot Jonś driver/amp, put boot.0ś addf immediately after motion
net spindle-on boot.0.enable hm2_5i25.0.pwmgen.00.enable
net spindle-on hm2_5i25.0.gpio.007.out #need
to run p3-17 to enable Jonś driver
#net spindle-on not.load.in
#net load-inverted not.load.out limit2.0.load #limit3.0.load
#lowpass.2.load
# has spindle boot done its thing? develop enable chain
# for pid.s, limit2.0.load, limit3.0.load, from boot.0.state=5
setp comp.drvbooted.in1 4.50000
net spindle-boot0 boot.0.state conv_u32_float.boot.in
net spindle-boot1 conv_u32_float.boot.out comp.drvbooted.in0
# We should have true, causing a load of limit2.0 when stopped, but false
# when boot has completed its thing
# Now enable limit2.0 out of preload, pid.s & make inverted boot.0.completed
net spindle-booted comp.drvbooted.out not.spndl.in
net spindle-booted-inv not.spndl.out pid.s.enable
# now hook motions speed cmd to mux16 for gearchange and detection of need
#setp ratio-select.in00 [SPINDLE_9]HIGHGEAR_S
#setp ratio-select.in01 [SPINDLE_9]LOWGEAR_S
#setp ratio-select.sel0 false # true for low gear, false for high gear
setp spdwobbler.frequency .500
setp spdwobbler.amplitude 0.125
net spindle-drive0 motion.spindle-speed-out-rps spdwobbler.offset
# now, look at spdwobbler.triangular output
net spindle-drive1 spdwobbler.triangle rvsaccel.in
net spindle-drive2 rvsaccel.out pid.s.command
near.speed.in1
net spindle-drive3 pid.s.output limit2.2.in
abs.piddir.in #needed now?
setp limit2.2.max [SPINDLE_9]LIMIT_S_MAX_OUTPUT
setp limit2.2.min [SPINDLE_9]LIMIT_S_MIN_OUTPUT
setp rvsaccel.maxa [SPINDLE_9]LIMIT_RVS_ACCEL # to cushion
gearchg effects
# do NOTHING that changes gain after here!
# limit2.3.max & min establishes maximum pwm duty % at about 98% either
direction
net gearchg2 limit2.2.out boot.0.pid0
net gearchg3 boot.0.pout0
hm2_5i25.0.pwmgen.00.value
# then, correct for friction in drive
setp sum2.bias.gain0 [SPINDLE_9]FBIAS # 40.0 # trim for
proper speed at 20 rpm in low backgear
setp sum2.bias.gain1 [SPINDLE_9]RBIAS #-40.0 # ditto
net is-plus0 abs.piddir.is-positive conv_bit_u32.dirF.in
net is-plus1 conv_bit_u32.dirF.out conv_u32_float.dirF.in
net is-neg0 abs.piddir.is-negative conv_bit_u32.dirR.in
net is-neg1 conv_bit_u32.dirR.out conv_u32_float.dirR.in
net bias-dirF conv_u32_float.dirF.out sum2.bias.in0
net bias-dirR conv_u32_float.dirR.out sum2.bias.in1
net pid.bias sum2.bias.out pid.s.bias
# low and high backgears might need a compromise value for bias.gains above
# now, start processing pid.s.error to see which gear weŕe in, might need
pid.s.FF0 adjusted
#setp lowpass.2.gain 0.000125 # very slow, but do I need it
since sum2 is integrating
net gearchg.drv0 pid.s.error sum2.gearchg.in0 #lowpass.2.in
# use sum2 as error accumulator
#net gearchg.drv1 lowpass.2.out sum2.gearchg.in0
net gearchg.drv2 sum2.gearchg.out sum2.gearchg.in1
abs.delay.in
setp sum2.gearchg.gain1 .98 # some reset and deadband? save and
integrate error
# in the meantime set it for low speed and tune
# works so far, but keeps counting, needs a limit3? no, will settle eventually,
# but does need a reset mechanism.
#setp gcdelay.on-delay 5
#setp gcdelay.off-delay 0.1
setp debounce.1.delay 50
setp hm2_5i25.0.gpio.007.is_output true
setp hm2_5i25.0.gpio.007.invert_output false
# above to see if pin 17 goes low when off now, might have to invert
# lets get rid of 2 other confusing ledś on the BOB, until I find a use for them
setp hm2_5i25.0.gpio.009.is_output true
setp hm2_5i25.0.gpio.009.invert_output true
setp hm2_5i25.0.gpio.009.out true # turn off the led, signal
is free to use
setp hm2_5i25.0.gpio.010.is_output true
setp hm2_5i25.0.gpio.010.invert_output false # now will control mist?
# old dynamic brakes Now unused, but use one for the right hand relay resistor
switch
setp hm2_5i25.0.gpio.011.is_output true # p3-pin-8 drive
setp hm2_5i25.0.gpio.011.invert_output false # invert logic if true
# unused yet see halui where it might be linked
# this pin will operate protection relay
setp hm2_5i25.0.gpio.012.is_output true # p3-pin-9 for output
drive
setp hm2_5i25.0.gpio.012.invert_output true # invert logic if needed
net prot-out lut5-protect.out hm2_5i25.0.gpio.012.out
# required by axis, is in rpms and signed
net dumbsig motion.spindle-speed-out
# for axis & gladevcp use
net spindle-brake motion.spindle-brake
net spindle-at-speed near.speed.out motion.spindle-at-speed
setp lowpass.1.gain .0125
net spindle-vel-filtered lowpass.1.out motion.spindle-speed-in
#net spindle-gear mux16.gc.sel0
# ---Setup spindle at speed signals---
# near.speed.in1 is from pid.s.command
net spindle-at-speed <= near.speed.out
setp near.speed.scale [SPINDLE_9]NEAR_SCALE
setp near.speed.difference [SPINDLE_9]NEAR_TOL
# Use ACTUAL spindle velocity from spindle encoder
# spindle-velocity bounces around so we filter it with lowpass
# spindle-velocity is signed so we use absolute component to remove sign
# ACTUAL velocity is in RPS not RPM so we scale it too.
# in final, the only place this x60 is needed it to drive the glade rpms
display!
setp scale.spindle.gain 60
net spindle-fb-filtered-rps <= lowpass.0.out => abs.spindle.in
lowpass.1.in
net spindle-fb-filtered-abs-rps <= abs.spindle.out => scale.spindle.in
net spindle-fb-filtered-abs-rpm <= scale.spindle.out
# Now, lets see if we can track the G33.1 turnaround overtravel
# first, make a sum2 a sub2
setp sum2.ovrtrvl.gain0 -1.0000
# then net the sample holds but sample needs s32, not float so use count
net ovrtrvl1 hm2_5i25.0.encoder.00.count
sample.dirchg.in sample.spndlchg.in
net spindle-ccwcmd motion.spindle-reverse
sample.dirchg.hold
net spindle-reverse abs.encdir.is-negative
sample.spndlchg.hold
# and calc the overtravel from s32ś
net ovrtrvl2 sample.dirchg.out s32_float.cmd.in
net ovrtrvl3 s32_float.cmd.out sum2.ovrtrvl.in0
net ovrtrvl4 sample.spndlchg.out
s32_float.spndl.in
net ovrtrvl5 s32_float.spndl.out sum2.ovrtrvl.in1
# the hal pin sample.ovrtrvl.out should be shown with a hal__meter, is encoder
counts
#******************************
# connect miscellaneous signals
#******************************
# ---HALUI signals---
net joint-select-a halui.axis.x.select
net x-is-homed halui.joint.0.is-homed
net jog-x-pos halui.axis.x.plus
net jog-x-neg halui.axis.x.minus
net jog-x-analog halui.axis.x.analog
net joint-select-c halui.axis.z.select
net z-is-homed halui.joint.1.is-homed
net jog-z-pos halui.axis.z.plus
net jog-z-neg halui.axis.z.minus
net jog-z-analog halui.axis.z.analog
net jog-selected-pos halui.axis.selected.plus
net jog-selected-neg halui.axis.selected.minus
net spindle-manual-cw halui.spindle.forward
net spindle-manual-ccw halui.spindle.reverse
net spindle-manual-stop halui.spindle.stop
net machine-is-on halui.machine.is-on
net jog-speed halui.axis.jog-speed
net MDI-mode halui.mode.is-mdi
# ---coolant signals---
# hijack the flood to run the gearchange, needs fine tuned yet.
net coolant-mist <= iocontrol.0.coolant-mist => hm2_5i25.0.gpio.010.out
#net coolant-flood <= iocontrol.0.coolant-flood => hm2_5i25.0.gpio.009.out
net coolant-flood <= iocontrol.0.coolant-flood => hm2_5i25.0.gpio.009.out
# ---probe signal, now unused---
# net probe-in => motion.probe-input
# ---motion control signals---
net in-position <= motion.in-position
net machine-is-enabled <= motion.motion-enabled
# ---digital in / out signals---
# ---estop signals---
net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in
#net estop-in and2.estop.out
# ---manual tool change signals---
# I have 5 more tool holders now, maybe put this to use?
loadusr -W hal_manualtoolchange
net tool-change-request iocontrol.0.tool-change =>
hal_manualtoolchange.change
net tool-change-confirmed iocontrol.0.tool-changed <=
hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number =>
hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare =>
iocontrol.0.tool-prepared
# These files are loaded post GUI, in the order they appear
source pyvcp_options.hal
#source custom_postgui.hal
<?xml version='1.0' encoding='UTF-8'?>
<pyvcp>
<vbox>
<relief>RIDGE</relief>
<bd>6</bd>
<label>
<text>"Spindle Speed:"</text>
<font>("Helvetica",16)</font>
</label>
<bar>
<halpin>"spindle-speed"</halpin>
<max_>2000</max_>
</bar>
<label>
<text>"Spindle-At-Speed:"</text>
<font>("Helvetica",16)</font>
</label>
<hbox>
<label>
<text>" "</text>
<font>("Helvetica",16)</font>
</label>
<led>
<halpin>"spindle-at-speed-led"</halpin>
<size>20</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
</vbox>
</pyvcp>
# _DO NOT_ include your HAL commands here.
# Put custom HAL commands in custom_postgui.hal
# The commands in this file are run after the GUI loads
# **** Setup of spindle speed display using pyvcp -START ****
net spindle-fb-filtered-abs-rpm => pyvcp.spindle-speed
net spindle-at-speed => pyvcp.spindle-at-speed-led
# **** Setup of spindle speed display using pyvcp -END ****
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers