- Posts: 4
- Thank you received: 0
Spindle Coordinated motion with Mesa 7i43 & 7i33
4 years 6 months ago #240409
by jatimo
Spindle Coordinated motion with Mesa 7i43 & 7i33 was created by jatimo
Pretty sure I've just been looking at this too long and am missing something simple. Hoping someone could take a look and tell me what I might be missing.
Working on a secondary spindle on a milling machine (mounted to the table like a rotary but will be used for high speed turning). It's an AC servo with a 2500ppr quadrature encoder with index, connected to Mesa 7i43 and 7i33. Everything is working as expected now in regard to speed control and position/speed feedback. But I can't seem to get coordinated motion to work, like G33 or M19.
I have this spindle setup as spindle $1, and in the hal file I have referred to it as "lathe" instead of "spindle" in order to disambiguate it from the primary. It's using PWM and encoder 03 on the Mesa card.
Things I have checked:
Working on a secondary spindle on a milling machine (mounted to the table like a rotary but will be used for high speed turning). It's an AC servo with a 2500ppr quadrature encoder with index, connected to Mesa 7i43 and 7i33. Everything is working as expected now in regard to speed control and position/speed feedback. But I can't seem to get coordinated motion to work, like G33 or M19.
I have this spindle setup as spindle $1, and in the hal file I have referred to it as "lathe" instead of "spindle" in order to disambiguate it from the primary. It's using PWM and encoder 03 on the Mesa card.
Things I have checked:
- velocity and position feedback read as expected in halshow watch. rps/rpm/revs as expected and confirmed with laser rpm meter
- pid.lathe.index-enable, spindle.1.index-enable and hm7i43.0.encoder.03.index-enable are connected in hal
- hm7i43.encoder.03.input-index does trigger once as expected when rotated a full rev
- manually setting the index-enable signal chain to true stays true until input-index is triggered.
- input-index trigger event properly sets the index-enable signal back to false and resets spindle.1.revs to 0
- spindle.1.at-speed is just hardwired to true for now to isolate that from the issue
Everything appears to be working correctly at a glance but if I try to issue the following command, no axis motion takes place:
M3 $1 S100
G33 K0.1 X2 $1
Also M19 does not work. No spindle motion begins and it will time out after the Q term has elapsed.
Notably, the index-enable signal does not get set to true when G33 command is issued. spindle-orient does seem to get triggered for M19 but the cycle never goes through motion. These could be separate issues I suppose but it feels related like whatever is supposed to set index-enable is not happening and why the cycles never start.
My hal file is below. Thanks in advance for any insight.
note the primary spindle is driven by a separate pwm on the parport sent to a DAC, that is all working fine and can be ignored.
Code:loadrt [KINS]KINEMATICS loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_spindles=2 loadrt hostmot2 loadrt hm2_7i43 ioaddr=0x378 ioaddr_hi=0 epp_wide=1 config="firmware=hm2/7i43-4/SVST4_4.BIT num_encoders=4 num_pwmgens=4 num_stepgens=4" setp hm2_7i43.0.pwmgen.pwm_frequency 20000 setp hm2_7i43.0.pwmgen.pdm_frequency 6000000 setp hm2_7i43.0.watchdog.timeout_ns 5000000 loadrt hal_parport cfg="cc00 out" loadrt pid names=pid.x,pid.y,pid.z,pid.s,pid.lathe addf parport.0.read servo-thread addf hm2_7i43.0.read servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread addf pid.x.do-pid-calcs servo-thread addf pid.y.do-pid-calcs servo-thread addf pid.z.do-pid-calcs servo-thread addf pid.s.do-pid-calcs servo-thread addf pid.lathe.do-pid-calcs servo-thread addf parport.0.write servo-thread addf hm2_7i43.0.write servo-thread # external output signals loadrt pwmgen output_type=0 addf pwmgen.make-pulses servo-thread addf pwmgen.update servo-thread setp pwmgen.0.pwm-freq 2000 setp pwmgen.0.dither-pwm 1 setp pwmgen.0.max-dc 0.9 setp pwmgen.0.min-dc 0.01 net spindle-speed-cmd spindle.0.speed-out => pwmgen.0.value net spindle-on spindle.0.on => pwmgen.0.enable net spindle-pwm pwmgen.0.pwm => parport.0.pin-09-out # Set the spindle's top speed in RPM setp pwmgen.0.scale 20500 # external input signals loadrt debounce cfg=4 setp debounce.0.delay 50 addf debounce.0 servo-thread net debounce-y-home-in debounce.0.1.in <= parport.0.pin-13-in-not net debounce-z-home-in debounce.0.2.in <= parport.0.pin-15-in-not net X-home debounce.0.1.out => joint.0.home-sw-in joint.1.home-sw-in net Z-home debounce.0.2.out => joint.2.home-sw-in net debounce-probe-in debounce.0.3.in <= parport.0.pin-12-in-not net probe-in debounce.0.3.out => motion.probe-input setp parport.0.pin-16-out 1 #******************* # AXIS X JOINT 0 #******************* 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 net x-index-enable <=> pid.x.index-enable net x-enable => pid.x.enable net x-pos-cmd => pid.x.command net x-pos-fb => pid.x.feedback net x-output <= pid.x.output # ---PWM Generator signals/setup--- setp hm2_7i43.0.pwmgen.00.output-type 1 setp hm2_7i43.0.pwmgen.00.scale [JOINT_0]OUTPUT_SCALE net x-output => hm2_7i43.0.pwmgen.00.value net x-pos-cmd joint.0.motor-pos-cmd net x-enable joint.0.amp-enable-out => hm2_7i43.0.pwmgen.00.enable parport.0.pin-03-out # ---Encoder feedback signals/setup--- setp hm2_7i43.0.encoder.00.counter-mode 0 setp hm2_7i43.0.encoder.00.filter 1 setp hm2_7i43.0.encoder.00.index-invert 0 setp hm2_7i43.0.encoder.00.index-mask 0 setp hm2_7i43.0.encoder.00.index-mask-invert 0 setp hm2_7i43.0.encoder.00.scale [JOINT_0]ENCODER_SCALE net x-pos-fb <= hm2_7i43.0.encoder.00.position net x-vel-fb <= hm2_7i43.0.encoder.00.velocity net x-pos-fb => joint.0.motor-pos-fb net x-index-enable joint.0.index-enable <=> hm2_7i43.0.encoder.00.index-enable net x-pos-rawcounts <= hm2_7i43.0.encoder.00.rawcounts # ---setup home / limit switch signals--- net x-neg-limit => joint.0.neg-lim-sw-in net x-pos-limit => joint.0.pos-lim-sw-in #******************* # AXIS Y JOINT 1 #******************* setp pid.y.Pgain [JOINT_1]P setp pid.y.Igain [JOINT_1]I setp pid.y.Dgain [JOINT_1]D setp pid.y.bias [JOINT_1]BIAS setp pid.y.FF0 [JOINT_1]FF0 setp pid.y.FF1 [JOINT_1]FF1 setp pid.y.FF2 [JOINT_1]FF2 setp pid.y.deadband [JOINT_1]DEADBAND setp pid.y.maxoutput [JOINT_1]MAX_OUTPUT setp pid.y.error-previous-target true net y-index-enable <=> pid.y.index-enable net y-enable => pid.y.enable net y-pos-cmd => pid.y.command net y-pos-fb => pid.y.feedback net y-output <= pid.y.output # ---PWM Generator signals/setup--- setp hm2_7i43.0.pwmgen.01.output-type 1 setp hm2_7i43.0.pwmgen.01.scale [JOINT_1]OUTPUT_SCALE net y-output => hm2_7i43.0.pwmgen.01.value net y-pos-cmd joint.1.motor-pos-cmd net y-enable joint.1.amp-enable-out => hm2_7i43.0.pwmgen.01.enable # ---Encoder feedback signals/setup--- setp hm2_7i43.0.encoder.01.counter-mode 0 setp hm2_7i43.0.encoder.01.filter 1 setp hm2_7i43.0.encoder.01.index-invert 0 setp hm2_7i43.0.encoder.01.index-mask 0 setp hm2_7i43.0.encoder.01.index-mask-invert 0 setp hm2_7i43.0.encoder.01.scale [JOINT_1]ENCODER_SCALE net y-pos-fb <= hm2_7i43.0.encoder.01.position net y-vel-fb <= hm2_7i43.0.encoder.01.velocity net y-pos-fb => joint.1.motor-pos-fb net y-index-enable joint.1.index-enable <=> hm2_7i43.0.encoder.01.index-enable net y-pos-rawcounts <= hm2_7i43.0.encoder.01.rawcounts # ---setup home / limit switch signals--- net y-neg-limit => joint.1.neg-lim-sw-in net y-pos-limit => joint.1.pos-lim-sw-in #******************* # AXIS Z JOINT 2 #******************* setp pid.z.Pgain [JOINT_2]P setp pid.z.Igain [JOINT_2]I setp pid.z.Dgain [JOINT_2]D setp pid.z.bias [JOINT_2]BIAS setp pid.z.FF0 [JOINT_2]FF0 setp pid.z.FF1 [JOINT_2]FF1 setp pid.z.FF2 [JOINT_2]FF2 setp pid.z.deadband [JOINT_2]DEADBAND setp pid.z.maxoutput [JOINT_2]MAX_OUTPUT setp pid.z.error-previous-target true net z-index-enable <=> pid.z.index-enable net z-enable => pid.z.enable net z-pos-cmd => pid.z.command net z-pos-fb => pid.z.feedback net z-output <= pid.z.output # ---PWM Generator signals/setup--- setp hm2_7i43.0.pwmgen.02.output-type 1 setp hm2_7i43.0.pwmgen.02.scale [JOINT_2]OUTPUT_SCALE net z-output => hm2_7i43.0.pwmgen.02.value net z-pos-cmd joint.2.motor-pos-cmd net z-enable joint.2.amp-enable-out => hm2_7i43.0.pwmgen.02.enable # ---Encoder feedback signals/setup--- setp hm2_7i43.0.encoder.02.counter-mode 0 setp hm2_7i43.0.encoder.02.filter 1 setp hm2_7i43.0.encoder.02.index-invert 0 setp hm2_7i43.0.encoder.02.index-mask 0 setp hm2_7i43.0.encoder.02.index-mask-invert 0 setp hm2_7i43.0.encoder.02.scale [JOINT_2]ENCODER_SCALE net z-pos-fb <= hm2_7i43.0.encoder.02.position net z-vel-fb <= hm2_7i43.0.encoder.02.velocity net z-pos-fb => joint.2.motor-pos-fb net z-index-enable joint.2.index-enable <=> hm2_7i43.0.encoder.02.index-enable net z-pos-rawcounts <= hm2_7i43.0.encoder.02.rawcounts # ---setup home / limit switch signals--- net z-neg-limit => joint.2.neg-lim-sw-in net z-pos-limit => joint.2.pos-lim-sw-in #****************************** # connect miscellaneous signals #****************************** # ---HALUI signals--- net axis-select-x halui.axis.x.select 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 x-is-homed halui.joint.0.is-homed net axis-select-y halui.axis.y.select net jog-y-pos halui.axis.y.plus net jog-y-neg halui.axis.y.minus net jog-y-analog halui.axis.y.analog net y-is-homed halui.joint.1.is-homed net axis-select-z halui.axis.z.select 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 z-is-homed halui.joint.2.is-homed net jog-selected-pos halui.axis.selected.plus net jog-selected-neg halui.axis.selected.minus net spindle-manual-cw halui.spindle.0.forward net spindle-manual-ccw halui.spindle.0.reverse net spindle-manual-stop halui.spindle.0.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--- net coolant-mist <= iocontrol.0.coolant-mist net coolant-flood <= iocontrol.0.coolant-flood # ---probe signal--- 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 # ---manual tool change signals--- 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 ### secondary servo spindle (lathe turn axis) on Mesa0 joint3 setp hm2_7i43.0.pwmgen.03.output-type 1 setp hm2_7i43.0.pwmgen.03.scale [SPINDLE_1]OUTPUT_SCALE setp hm2_7i43.0.encoder.03.counter-mode 0 setp hm2_7i43.0.encoder.03.filter 1 setp hm2_7i43.0.encoder.03.index-invert 0 setp hm2_7i43.0.encoder.03.index-mask 0 setp hm2_7i43.0.encoder.03.index-mask-invert 0 setp hm2_7i43.0.encoder.03.scale [SPINDLE_1]ENCODER_SCALE setp pid.lathe.Pgain [SPINDLE_1]P setp pid.lathe.Igain [SPINDLE_1]I setp pid.lathe.Dgain [SPINDLE_1]D setp pid.lathe.bias [SPINDLE_1]BIAS setp pid.lathe.FF0 [SPINDLE_1]FF0 setp pid.lathe.FF1 [SPINDLE_1]FF1 setp pid.lathe.FF2 [SPINDLE_1]FF2 setp pid.lathe.deadband [SPINDLE_1]DEADBAND setp pid.lathe.maxoutput [SPINDLE_1]MAX_OUTPUT setp pid.lathe.error-previous-target true net lathe-revs <= hm2_7i43.0.encoder.03.position net lathe-vel-fb-rps <= hm2_7i43.0.encoder.03.velocity net lathe-vel-fb-rpm <= hm2_7i43.0.encoder.03.velocity-rpm net lathe-index-enable hm2_7i43.0.encoder.03.index-enable <=> spindle.1.index-enable net lathe-index-enable <=> pid.lathe.index-enable net lathe-vel-cmd-rpm => pid.lathe.command net lathe-vel-fb-rpm => pid.lathe.feedback net lathe-enable pid.lathe.enable => hm2_7i43.0.pwmgen.03.enable net lathe-output pid.lathe.output => hm2_7i43.0.pwmgen.03.value # ---setup spindle control signals--- net lathe-vel-cmd-rps <= spindle.1.speed-out-rps net lathe-vel-cmd-rps-abs <= spindle.1.speed-out-rps-abs net lathe-vel-cmd-rpm <= spindle.1.speed-out net lathe-vel-cmd-rpm-abs <= spindle.1.speed-out-abs net lathe-enable <= spindle.1.on net lathe-cw <= spindle.1.forward net lathe-ccw <= spindle.1.reverse net lathe-brake <= spindle.1.brake net lathe-revs => spindle.1.revs net lathe-at-speed => spindle.1.at-speed net lathe-vel-fb-rps => spindle.1.speed-in
Please Log in to join the conversation.
4 years 6 months ago #240419
by jatimo
Replied by jatimo on topic Spindle Coordinated motion with Mesa 7i43 & 7i33
So spooled up a new configuration with PNCConf with XZ and letting it configure everything think and g33 works fine there. So I guess it's just a matter of comparing the configs now to see what I left out in my manually edited version.
Please Log in to join the conversation.
4 years 6 months ago #240546
by andypugh
I don't see that in the HAL file, but I think that if it were not true then you would be seeing other problems.
Have you got to the bottom of this? I suspect that spindle-synched motion with secondary spindles is not used very often, and as multiple spindle support is relatively new there may still be some outstanding issues.
As for M19, I don't see any sign of a position PID in the code, so I don't think that can work yet with this config.
Replied by andypugh on topic Spindle Coordinated motion with Mesa 7i43 & 7i33
[*]spindle.1.at-speed is just hardwired to true for now to isolate that from the issue
I don't see that in the HAL file, but I think that if it were not true then you would be seeing other problems.
Have you got to the bottom of this? I suspect that spindle-synched motion with secondary spindles is not used very often, and as multiple spindle support is relatively new there may still be some outstanding issues.
As for M19, I don't see any sign of a position PID in the code, so I don't think that can work yet with this config.
Please Log in to join the conversation.
4 years 6 months ago #240564
by jatimo
Replied by jatimo on topic Spindle Coordinated motion with Mesa 7i43 & 7i33
Thanks for taking the time to look and respond.
I put a watch on the spindle.1.at-speed pin and confirmed it's staying true. I guess it defaulted to true without having been otherwise wired.
I put a watch on index-enable in the other working config (PNCConf generated) and noted the index-enable getting set by the G33 and then unset itself as it rotates past the index, then coordinated motion as expected. On my handwritten config I don't see this happening. Setting it by hand with setp/sets sets it, and it does automatically unset itself as it rotates, but this doesn't seem to work in tricking the g33 cycle to start.
I was setting it up as secondary just to avoid having to copy over all the separate axis config and pid tuning but it makes more sense to run this as XZ anyway for turning. So in theory I have what I need now. But for the sake of other people who may need this functionality later I'll keep the proposed config to the side and try some things to narrow it down as I find time.
And oh, sorry for failing to mention, re M19 -- I had all the spindle orient stuff removed to isolate/clean up for debugging purposes. I had an or2, mux2, 2 spindles , 3 spindle pids, and and the orient component. it was getting awfully "spaghetti" in there so I removed it all to isolate one issue at a time. M19 is working OK on the generated config. From what I'm seeing I think it will work in the multi spindle config but I'll report back if I find that not to be the case.
Thanks again.
I put a watch on the spindle.1.at-speed pin and confirmed it's staying true. I guess it defaulted to true without having been otherwise wired.
I put a watch on index-enable in the other working config (PNCConf generated) and noted the index-enable getting set by the G33 and then unset itself as it rotates past the index, then coordinated motion as expected. On my handwritten config I don't see this happening. Setting it by hand with setp/sets sets it, and it does automatically unset itself as it rotates, but this doesn't seem to work in tricking the g33 cycle to start.
I was setting it up as secondary just to avoid having to copy over all the separate axis config and pid tuning but it makes more sense to run this as XZ anyway for turning. So in theory I have what I need now. But for the sake of other people who may need this functionality later I'll keep the proposed config to the side and try some things to narrow it down as I find time.
And oh, sorry for failing to mention, re M19 -- I had all the spindle orient stuff removed to isolate/clean up for debugging purposes. I had an or2, mux2, 2 spindles , 3 spindle pids, and and the orient component. it was getting awfully "spaghetti" in there so I removed it all to isolate one issue at a time. M19 is working OK on the generated config. From what I'm seeing I think it will work in the multi spindle config but I'll report back if I find that not to be the case.
Thanks again.
Please Log in to join the conversation.
4 years 5 months ago #242502
by jatimo
Replied by jatimo on topic Spindle Coordinated motion with Mesa 7i43 & 7i33
So I got some time to look at this again. Swapped ONLY the spindle ID number in the hal config and restarted, and G33 worked fine. Renamed the original spindle to 1 and the new testing spindle as 0.
I might have made a mistake that didn't get repeated this time around. Lots of variant config files at this point trying to isolate things, and I'm a bit "punch drunk" on the issue at this point, but tried it twice and same results. So certainly not conclusive, but perhaps worth just counting as one "upvote" that there could be an issue with spindles other than #0 with coordinated motion.
I might have made a mistake that didn't get repeated this time around. Lots of variant config files at this point trying to isolate things, and I'm a bit "punch drunk" on the issue at this point, but tried it twice and same results. So certainly not conclusive, but perhaps worth just counting as one "upvote" that there could be an issue with spindles other than #0 with coordinated motion.
Please Log in to join the conversation.
Time to create page: 0.109 seconds
