Attempting to modify the spindle HAL code

More
13 Dec 2010 22:41 #6013 by garymcrobertpdx
It appears the best way to obtain accurate positioning of my
Spindle is to use a DC servo. I have a 1-1/2 HP PM motor, the
power supply is no problem and I have found an affordable high
power motor servo board with step and direction input.

I used the configure wizard to create the HAL code with an encoder
then edited to substitute a setepgen in velocity mode for the pwmgen
component trying to be certain to connect all signals to appropriate
pins.

I rigged a test system on my desktop using a step motor and drive as
a stand in for the DC motor and servo drive (I don’t have the servo drive yet).
Connected a shaft encoder to the motor shaft and parport pins used my
bench power supply to energize the encoder +5V .

This works but only halfway I can control the motor speed from the
AXIS GUI, even the spindle speed meter works. But the servo loop
seems to not be working. If I disturbed the loop such as turn off the
encoder +5V the motor velocity is unaffected. I would expect the motor
speed to change if the servo loop was actually working.

I have tried many experiments (such as inverting the motor direction bit)
to ferret out the problem but no with success. Using Hal meter and Hal
scope I know the encoder signals are reaching the Hal encoder component
and I have examining every signal, pin and parameter that has to do with
the spindle and have yet to put my finger on the problem.

Has anyone successfully done something like this???
Thanks

Please Log in or Create an account to join the conversation.

More
14 Dec 2010 00:19 #6014 by andypugh
Have you tuned the PID parameters at all?

Please Log in or Create an account to join the conversation.

More
14 Dec 2010 02:59 #6016 by garymcrobertpdx
I have not found any PID parameters for the spindle I have checked the
man motion doc since there is spindle related info there and I have searched
the integrators manual and the HAL user manual for spindle related info.
Is this spindle documentation on line?

I tried a end run around the problem I loaded a PID and connected
motion.spindle-speed-out to pid.0.command.
connected the encoder.0.velocity to pid.0.feedback. Then connected
pid.0.output to the stepgen.3.velocity-cmd. Then stepgen.3.step to
parport.0.pin-08-out this steps the drive.

Messed around with the PID gains and the stepgen accel. This sort
of works but not well in part due to the junk box encoder and step motor
hack but it behaves like a closed loop system.

Please Log in or Create an account to join the conversation.

More
14 Dec 2010 10:46 #6023 by andypugh
The default spindle speed control is open-loop, simply passing the values in S2000 (etc) commands straight through to motion.spindle-cmd with suitable scaling. The wizard sets the spindle encoder up correctly for rigid tapping or lathe threading, but it is not used to control the spindle speed at all.

The second system you have set up is a proper closed-loop system. it sounds like you have already figured it out for yourself, but this wiki page describes one way to achieve closed-loop spindle speed:
wiki.linuxcnc.org/emcinfo.pl?Closed_Loop_Spindle_Speed_Control

Please Log in or Create an account to join the conversation.

More
14 Dec 2010 17:33 #6042 by garymcrobertpdx
Thank you for the explanation it is much appreciated also thanks
for the link to the spindle code info, now this is making more sense.

Please Log in or Create an account to join the conversation.

More
27 Mar 2011 10:46 #8146 by cncbasher
andypugh wrote:

The default spindle speed control is open-loop, simply passing the values in S2000 (etc) commands straight through to motion.spindle-cmd with suitable scaling. The wizard sets the spindle encoder up correctly for rigid tapping or lathe threading, but it is not used to control the spindle speed at all.

The second system you have set up is a proper closed-loop system. it sounds like you have already figured it out for yourself, but this wiki page describes one way to achieve closed-loop spindle speed:
wiki.linuxcnc.org/emcinfo.pl?Closed_Loop_Spindle_Speed_Control



could someone clarify how to show the resultant spindle speed in pyvcp , linking the output to show correctly , if i am correct taking the scale.0.out then remove the decimal places using abs
and output , the correct syntax of the line is probably stareing in my the face

Please Log in or Create an account to join the conversation.

More
27 Mar 2011 20:43 #8170 by andypugh
cncbasher wrote:

could someone clarify how to show the resultant spindle speed in pyvcp , linking the output to show correctly , if i am correct taking the scale.0.out then remove the decimal places using abs
and output , the correct syntax of the line is probably stareing in my the face


abs doesn't remove decimal places, it removes any negative signs. ie abs(-3.1415926) = 3.1415926.

To link it to a pyvcp panel then you need to put something in the postgui hal file (as the pyvcp pins don't exist until the gui loads). As you can't use an output pin name twice, not even in separate HAL files, it means that in the postgui hal file you need to refer to the signal by the signal name. (And what that is depends on what you decided to call it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.748 seconds
Powered by Kunena Forum