Best update of the night is that I remeasured the height of the machine and, as long as I take off the Z-axis servo, it turns out I will be able to fit this machine into the new house. The garage has 8ft doors the tallest permanent hard spot is about 88". YES!!
Ok - so Andy was right about the spindle enable preventing movement. However, I cannot for the life of me figure out how to incorporate it into the logic. Because I have the
velocity-mode signal connected to
motion.spindle-on I don't seem to be able to drive
hm2_5i25.0.7i77.0.1.spinena with
motion.spindle-on (through the
spindle-enable signal that is standard).
I've racked my brain over and over but I can't come up with a solution - advice?
To keep progressing, I started my config using the .hal below and used halcmd to
sets spindle-enable true. This gave me signal on analogout5 in
both modes (success) but only resulted in movement when I was in velocity mode.
So once I can get the spindle enabled in both modes, then I need to:
1) determine why there is no motion in orient mode
2) scale the spindle speed correctly
The two might be related? I found a diagram that shows a similar logic setup for position vs. velocity mode that incorporates some scaling but I haven't fully digested it yet. It seems to be setup differently than how I have it now (where 1 spindle revolution = +1 encoder position).
spindle hal section below. It's been cleaned up, I left my attempt at using an or2 component to flip the spindle-enable but, again, I run into the issue of the pins already being in use.
Code:
#*******************
# SPINDLE S
#*******************
setp pid.s.Pgain [SPINDLE]P
setp pid.s.Igain [SPINDLE]I
setp pid.s.Dgain [SPINDLE]D
setp pid.s.bias [SPINDLE]BIAS
setp pid.s.FF0 [SPINDLE]FF0
setp pid.s.FF1 [SPINDLE]FF1
setp pid.s.FF2 [SPINDLE]FF2
setp pid.s.deadband [SPINDLE]DEADBAND
setp pid.s.maxoutput [SPINDLE]MAX_OUTPUT
setp pid.s.error-previous-target true
setp pid.1.Pgain [SPINDLE]PGAIN_P
setp pid.1.Igain [SPINDLE]IGAIN_P
setp pid.1.Dgain [SPINDLE]DGAIN_P
setp pid.1.FF0 [SPINDLE]FF0_P
setp pid.1.FF1 [SPINDLE]FF1_P
# ---PWM Generator signals/setup---
setp hm2_5i25.0.7i77.0.1.analogout5-scalemax [SPINDLE]OUTPUT_SCALE
setp hm2_5i25.0.7i77.0.1.analogout5-minlim [SPINDLE]OUTPUT_MIN_LIMIT
setp hm2_5i25.0.7i77.0.1.analogout5-maxlim [SPINDLE]OUTPUT_MAX_LIMIT
net spindle-index-enable <=> pid.s.index-enable
net spindle-enable => hm2_5i25.0.7i77.0.1.spinena
#####
net spindle-pos pid.1.feedback orient.0.position
net spindle-vel pid.s.feedback hm2_5i25.0.encoder.05.velocity
net spindle-vel-cmd motion.spindle-speed-out pid.s.command
#net spindle-vel-cmd motion.spindle-speed-out-rps pid.s.command
net spindle-vel-pid pid.s.output mux2.0.in0
net spindle-pos pid.1.feedback orient.0.position near.0.in1 hm2_5i25.0.encoder.05.position
net spindle-pos-cmd orient.0.command pid.1.command near.0.in2
net spindle-angle motion.spindle-orient-angle orient.0.angle
net spindle-pos-pid pid.1.output mux2.0.in1
setp near.0.difference 0.0005
net spindle-in-pos-raw near.0.out edge.0.in #not needed v2.8+, use orient.0.is-oriented
net spindle-in-pos edge.0.out motion.spindle-is-oriented
# this switches modes
net orient-mode motion.spindle-orient orient.0.enable pid.1.enable mux2.0.sel
net velocity-mode motion.spindle-on pid.s.enable #hm2_5i25.0.7i77.0.1.spinena
net orient-dir motion.spindle-orient-mode orient.0.mode
#####
# ---Encoder feedback signals/setup---
setp hm2_5i25.0.encoder.05.counter-mode 0
setp hm2_5i25.0.encoder.05.filter 1
setp hm2_5i25.0.encoder.05.index-invert 0
setp hm2_5i25.0.encoder.05.index-mask 0
setp hm2_5i25.0.encoder.05.index-mask-invert 0
setp hm2_5i25.0.encoder.05.scale [SPINDLE]ENCODER_SCALE
net spindle-cmd mux2.0.out hm2_5i25.0.7i77.0.1.analogout5
net spindle-index-enable <=> hm2_5i25.0.encoder.05.index-enable
#loadrt or2
#addf or2.0 servo-thread
#net velocity-enable or2.0.in0 pid.s.enable
#net position-enable or2.0.in1 pid.1.enable
#net spindle-enable or2.0.out
# ---setup spindle control signals---
#net spindle-vel-cmd-rps <= motion.spindle-speed-out-rps
net spindle-vel-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
#net spindle-vel-cmd-rpm <= motion.spindle-speed-out
net spindle-vel-cmd-rpm-abs <= motion.spindle-speed-out-abs
#net spindle-enable <= motion.spindle-on
net spindle-cw <= motion.spindle-forward
net spindle-ccw <= motion.spindle-reverse
net spindle-brake <= motion.spindle-brake
net spindle-pos => motion.spindle-revs
net spindle-at-speed => motion.spindle-at-speed
net spindle-vel => motion.spindle-speed-in
net spindle-index-enable <=> motion.spindle-index-enable
# ---Setup spindle at speed signals---
sets spindle-at-speed true
Current spindle PID section for reference. Just playing with numbers right now to see if they affected the motion:
Code:
#********************
# Spindle
#********************
[SPINDLE]
P = 5
I = 0
D = 0.0
FF0 = 1
FF1 = 0.0
FF2 = 0.0
PGAIN_P = 60
IGAIN_P = 0
DGAIN_P = 0
FF0_P = 1
FF1_P = 0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 10000.0
ENCODER_SCALE = -4096.0
OUTPUT_SCALE = 10000
OUTPUT_MIN_LIMIT = -10000
OUTPUT_MAX_LIMIT = 10000