Carousel with analog servo drive

More
1 year 10 months ago #316884 by lukin1156
Hello everyone, I am starting up an automatic tool change on my new milling machine and I have a problem connecting the carousel component. The carousel is rotated by a servo motor that I control with an analog signal. There is a gear transmission of unknown ratio between the motor and the carousel. There are two inductive sensors on the carousel for sensing the index and the tool position. Currently, the carousel rotates to the index after enabling. When entering the pocket number, the carousel rotates to the selected position, but only based on the number of encoder pulses, it ignores the tool position sensor. The signal for the motor goes through a PID loop, named pid.c. Should I unlink the encoder from the carousel component and connect the encoder only to the PID loop?
Code:
 loadrt carousel pockets=6 encoding=index dir=2 addf carousel.0     servo-thread net carousel-index carousel.0.sense-0 hm2_5i25.0.7i77.0.0.input-03-not net carousel-pulse carousel.0.sense-1 hm2_5i25.0.7i77.0.0.input-02-not net carousel-enable <= motion.digital-out-05 => carousel.0.enable net carousel-pocket <= motion.analog-out-00 => conv-float-s32.0.in net carousel-pocket-out <= carousel.0.pocket-number => conv-float-s32.0.out # PID carousel setp   pid.c.Pgain     [JOINT_3]P setp   pid.c.Igain     [JOINT_3]I setp   pid.c.Dgain     [JOINT_3]D setp   pid.c.bias      [JOINT_3]BIAS setp   pid.c.FF0       [JOINT_3]FF0 setp   pid.c.FF1       [JOINT_3]FF1 setp   pid.c.FF2       [JOINT_3]FF2 setp   pid.c.deadband  [JOINT_3]DEADBAND setp   pid.c.maxoutput [JOINT_3]MAX_OUTPUT setp   pid.c.error-previous-target true net c-index-enable  =>  pid.c.index-enable net machine-is-enabled  =>  pid.c.enable net c-pos-cmd       =>  pid.c.command net c-pos-fb        =>  pid.c.feedback net c-output        <=  pid.c.output # ---PWM Generator signals/setup--- setp   hm2_5i25.0.7i77.0.1.analogout3-scalemax  [JOINT_3]OUTPUT_SCALE setp   hm2_5i25.0.7i77.0.1.analogout3-minlim    [JOINT_3]OUTPUT_MIN_LIMIT setp   hm2_5i25.0.7i77.0.1.analogout3-maxlim    [JOINT_3]OUTPUT_MAX_LIMIT net c-output     => hm2_5i25.0.7i77.0.1.analogout3 net c-pos-cmd    <= carousel.0.counts-target # ---Encoder feedback signals/setup--- setp    hm2_5i25.0.encoder.03.counter-mode 0 setp    hm2_5i25.0.encoder.03.filter 1 setp    hm2_5i25.0.encoder.03.index-invert 0 setp    hm2_5i25.0.encoder.03.index-mask 0 setp    hm2_5i25.0.encoder.03.index-mask-invert 0 setp    hm2_5i25.0.encoder.03.scale  [JOINT_3]ENCODER_SCALE net c-pos-fb               <=  hm2_5i25.0.encoder.03.position net c-vel-fb               <=  hm2_5i25.0.encoder.03.velocity net c-pos-fb               =>  conv-float-s32.1.in net c-pos-fb-out            => conv-float-s32.1.out => carousel.0.counts
 

Please Log in to join the conversation.

More
1 year 10 months ago #316885 by andypugh
Does your PID control velocity or position? It would need to control velocity to work as intended with the carousel component.

The use the carousel.N.motor-vel output as the (velocity) PID command.

Now the component will derive the tool number from the index and tool pule inputs, and will simply drive the carousel motor at constant speed until the it sees the sensor for the selected too.

It _might_ work better in counts mode based on the encoder in the servo motor, but try it this way first.

Please Log in to join the conversation.

More
1 year 9 months ago #318888 by lukin1156
I tried using the speed mode, but it didn't work. So I went back to the original control. By manually rotating the carousel, I determined the number of pulses between the individual pockets. The automatic tool change works quite well, sometimes there is just a problem with homing the carousel. If the carousel goes to the same side at the home position, it is fine. However, if the carousel goes to the other side after homing, there is a small error in the position. I tried using rotation in only one direction, but there is another problem that the error in the number of pulses between the individual pockets adds up over time.

Here is short video from tool change.

youtube.com/shorts/BAgzHO6OKA0?si=I7e9RTFSHqlaFPUl

Code:
 #  --- automatic tool change --- loadrt carousel pockets=6 encoding=index dir=2 addf carousel.0        servo-thread setp carousel.0.scale 1666 setp carousel.0.home-offset -70 net spindlenot <= halui.spindle.0.is-on => not.0.in net spindlenotout <= not.0.out => and2.2.in0 net toolunlock <= motion.digital-out-00 => or2.1.in0 net toolunlockkey <= hm2_5i25.0.7i84.0.2.input-07 => or2.1.in1 net toolunlockout <= or2.1.out => and2.2.in1 net toolunlockout1 <= and2.2.out => hm2_5i25.0.7i77.0.0.output-00 net carouselup <= motion.digital-out-01 => hm2_5i25.0.7i77.0.0.output-01 net spindleair <= motion.digital-out-02 => hm2_5i25.0.7i77.0.0.output-02 net orient1   <= motion.digital-out-03 => hm2_5i25.0.7i77.0.0.output-12 net orient2     <= motion.digital-out-04 => hm2_5i25.0.7i77.0.0.output-13 net toolisunlock   <= motion.digital-in-00  => hm2_5i25.0.7i77.0.0.input-04 net toolislock        <= motion.digital-in-01  => hm2_5i25.0.7i77.0.0.input-05 net carouselisup     <= motion.digital-in-02  => hm2_5i25.0.7i77.0.0.input-06 net carouselisdown  <= motion.digital-in-03  => hm2_5i25.0.7i77.0.0.input-07 net spindleinposition <= motion.digital-in-04 => hm2_5i25.0.7i77.0.0.input-24 net carousel-index carousel.0.sense-0 hm2_5i25.0.7i77.0.0.input-03-not net carousel-pulse carousel.0.sense-1 hm2_5i25.0.7i77.0.0.input-02-not net carousel-enable <= motion.digital-out-05 => carousel.0.enable net carousel-pocket <= motion.analog-out-00 => conv-float-s32.0.in net carousel-pocket-out <= carousel.0.pocket-number => conv-float-s32.0.out net carousel-finish <= motion.digital-in-08  <= carousel.0.ready # PID carousel setp   pid.c.Pgain     [SPINDLE_2]P setp   pid.c.Igain     [SPINDLE_2]I setp   pid.c.Dgain     [SPINDLE_2]D setp   pid.c.bias      [SPINDLE_2]BIAS setp   pid.c.FF0       [SPINDLE_2]FF0 setp   pid.c.FF1       [SPINDLE_2]FF1 setp   pid.c.FF2       [SPINDLE_2]FF2 setp   pid.c.deadband  [SPINDLE_2]DEADBAND setp   pid.c.maxoutput [SPINDLE_2]MAX_OUTPUT setp   pid.c.error-previous-target true net c-index-enable  =>  pid.c.index-enable net machine-is-enabled    =>  pid.c.enable net c-vel-cmd       =>  pid.c.command net c-pos-fb       =>  pid.c.feedback net c-output        <=  pid.c.output # ---PWM Generator signals/setup--- setp   hm2_5i25.0.7i77.0.1.analogout3-scalemax  [SPINDLE_2]OUTPUT_SCALE setp   hm2_5i25.0.7i77.0.1.analogout3-minlim    [SPINDLE_2]OUTPUT_MIN_LIMIT setp   hm2_5i25.0.7i77.0.1.analogout3-maxlim    [SPINDLE_2]OUTPUT_MAX_LIMIT net c-output     => hm2_5i25.0.7i77.0.1.analogout3 net c-vel-cmd    <= carousel.0.counts-target # ---Encoder feedback signals/setup--- setp    hm2_5i25.0.encoder.03.counter-mode 0 setp    hm2_5i25.0.encoder.03.filter 1 setp    hm2_5i25.0.encoder.03.index-invert 0 setp    hm2_5i25.0.encoder.03.index-mask 0 setp    hm2_5i25.0.encoder.03.index-mask-invert 0 setp    hm2_5i25.0.encoder.03.scale  [SPINDLE_2]ENCODER_SCALE net c-pos-fb               <=  hm2_5i25.0.encoder.03.position net c-vel-fb               <=  hm2_5i25.0.encoder.03.velocity net c-pos-fb               =>  conv-float-s32.1.in net c-pos-fb-out             => conv-float-s32.1.out => carousel.0.counts net tool-changed    <= iocontrol.0.tool-change  => iocontrol.0.tool-changed


 

Please Log in to join the conversation.

More
1 year 9 months ago #318894 by PCW
If it's losing counts you might try decreasing the encoder sample rate
(which has the effect of increasing the input filter time constant)

Since this is global and affects all axis, one trick is to decrease the sample
rate by a factor of 5 and disable the encoder filter on all but the tool changer
encoder. (keeping the main axis encoders with the same filter time but
increasing the tool changer encoder filter time constant by a factor of 5)

Please Log in to join the conversation.

Time to create page: 0.098 seconds
Powered by Kunena Forum