Trying to wrap my head around using servos...

More
05 Jun 2015 07:24 #59451 by GaryLa
As a stepper motor user, I know the holy grail is to use servos. What I don't understand is how LinuxCNC commands the servo to a position.

An encoder is on the shaft of the servo motor but certainly doesn't "understand" the length of the bed, so does LinuxCNC count the encoder pulses until it's happy with the position and then expects the servo driver to hold the position?

I realize steppers (particularly when micro-stepped) can be "pushed" or coerced away from a position (even if ever-so-slightly), but is it safe to say that it is *possible* to use an encoder with a stepper and achieve the same results -- academically speaking. Strictly so I can understand what's going on here...

To reiterate, I don't understand how LinuxCNC commands a servo drive/motor differently from a stepper. I do understand (from my days using RC servos) that a servo inherently wants to stay where commanded.

But if LinuxCNC wanted to move X 10 inches using a stepper it would issue 10 x STEPS PER INCH pulses and cross its fingers...

How does it perform this same operation using the servo?

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

More
05 Jun 2015 07:54 #59452 by LearningLinuxCNC
I am sure others can give a better and more detailed response but I will give it a go.

The similarity between both systems is that neither knows the absolute location of the motor until the axis is homed. This sets the home position for that axis and then all moves from that point on are relative to the home position. There is a setup that does know the absolute location of the axis at all times and that is if absolute linear scales are used on the axis.

The first and major difference between steppers and servos is that steppers are open loop. The pulses are sent to the stepper motor and it will move 1 step (or a microstep) for each pulse so long as the required torque to do so is not more than the stepper motor can produce. The controller never knows for sure where the motor has moved to. It assumes that the motor moved the step that was commanded by the pulse. So the open loop is command a position but do not get feedback of actually obtaining the position.

The servo drives are closed loop. The position is commanded the servo controller applies voltage to the drive to get it to move towards the commanded position at the commanded speed. The encoder is used to keep track of the position of the axis at all times. The servo system may also use tachometers in the motors and servo amplifier system to further improve accuracy of slow speed moves. In any case servo controller and LinuxCNC are in a closed loop control where the position of the axis is always known due to the feedback of the position from the encoder to the controller.

Most encoders are quadrature encoders and they simply send a pulse for each fraction of a rotation that is made. The quadrature enables it to sense direction of rotation as well as the actual rotation amount. Other methods of providing feedback to the LinuxCNC system are resolvers (rotary analog position sensor that is absolute per rotation) and linear scales.

You can also do a hybrid servo stepper drive where the stepper drive provides the position output and you get feedback from an encoder so that correction steps can be made if the stepper motor would stall in a move.

Keep in mind that with any servo system if the system is overpowered by the move the following error (delta between the commanded position and the actual position) can increase to a level where the system may fault and stop. This is similar to stalling a stepper system except you know that it happened because of the closed loop feedback.

With a servo system it is not necessary to home the machine after an e-stop scenario as the encoders keep track of the position even in the event of an e-stop. An e-stop of a stepper system causes missed steps and requires that the machine be homed to obtain a good absolute position.

I have both systems. My router uses stepper motors and works fine as long as you don't overpower it. My milling machine uses servos but I have little experience with it as I am in the middle of retrofitting it at this point in time.

Both systems work. Just depends on the requirements of the job.
The following user(s) said Thank You: GaryLa

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

More
05 Jun 2015 08:38 #59453 by GaryLa
Thank you for your response.

I fully understand it as you've described it. But what I'm trying to grasp is how LinuxCNC commands the servo to a specific position from a linear point-of-view. For example:

If LinuxCNC needs the servo to move the X axis 10 inches, yet one full rotation of the servo's shaft yields only 1 inch of linear travel, what is LinuxCNC doing in order to achieve the linear move?

The encoder can only report 0 - 360 degrees of rotation (assuming there is no absolute scale on the machine). Therefore, is LinuxCNC counting the pulses and adding them up to achieve 10 inches of travel?

If so, it sounds to me as the encoder is the real "magic" of the servo system. That is, if a stepper is powerful enough and has an acceptable step resolution, could it be used in place of the servo motor?

Again, this is academic -- for the purpose of grasping what exactly is happening under the hood.

If an appropriately-sized stepper could be used instead of the servo, would LinuxCNC care/know? As long as there's encoder feedback and a motor accepting pulses, why would it matter if it's a servo or stepper?

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

More
05 Jun 2015 10:04 #59454 by Todd Zuercher
Actually the real magic in a servo control system is in the PID loop, which is how a servo system (be it Linuxcnc or any thing else with a closed loop servo) uses the position feed back to command the motor. A servo is always moving, even when it looks still, the movement is just too small to see.

PID stands for Proportional, Integral, Derivative. Through a series of mathematical formulas the commanded position, is compared with the feed back position from the encoder and outputs a command value from the amount of error, to tell the servo drive, or amp to turn harder (in a torque mode) or faster (in velocity mode) and in witch direction.

The tuning you often hear talked about when working with servos, is the adjusting of the constants used in the PID formula, that determines the response to an amount of error.

A really good analogy for a PID loop is to try to balance a ball on a curved track. If you stop the ball will roll off to the left or right. Your correcting the angle of the track, is analogous to the PIDs changing of the command output.
The following user(s) said Thank You: GaryLa

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

More
05 Jun 2015 18:59 #59473 by LearningLinuxCNC
I am not sure there is a documented example of using steppers and encoders in a servo system with LinuxCNC. I am sure that it could be done it just might take some experimenting or a new HAL component to do so.
The following user(s) said Thank You: GaryLa

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

More
05 Jun 2015 20:59 #59477 by andypugh

If LinuxCNC needs the servo to move the X axis 10 inches, yet one full rotation of the servo's shaft yields only 1 inch of linear travel, what is LinuxCNC doing in order to achieve the linear move?
The encoder can only report 0 - 360 degrees of rotation (assuming there is no absolute scale on the machine). Therefore, is LinuxCNC counting the pulses and adding them up to achieve 10 inches of travel?


LinuxCNC counts every single pulse from the encoder. This is typically thousands of pulses per shaft revolution.

If the system is 1024 pulses per inch and the servo is at the 20,000 counts positiion at the start of a 10" move then LinuxCNC applies a voltage to the motors until it sees 30240 counts in the encoder accumulator.

In practice the counts are scaled to engineering units, but internally it is all individual counts.

With a stepper system LinuxCNC passes requested positions to the stepgen component (in mm or inches) and the stepgen decides how may step pulses that is. With a servo system the setpoint goes to the PID component and it is the encoder counter component that does the pulses-to-inches conversion.
The following user(s) said Thank You: GaryLa

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

More
05 Jun 2015 21:32 #59481 by GaryLa
Ok, thanks. I get it now.

I've used PID loops for temperature and pressure controllers. I was aware a PID loop existed in the servo situation. So, in conclusion I guess it could summarized as:

LinuxCNC passes a destination count value to the PID loop code. The PID loop code is aware of the current count value. It then issues a + or - voltage to the servo motor and counts the encoder pulses. Once the count value is acquired, the PID loop, being a PID loop, "fights" to keep it there (if necessary). Tuning is needed to prevent the PID loop from being insensitive or overly-sensitive to push/pull from the load.

So in theory, one could use a stepper motor along with an encoder and tie the two together with a PID loop - and in an academic sense, achieve similar or possibly identical results. I'm not going to experiment with this, I just wanted to be sure I knew exactly what I was about to drop a bunch of cash on...

Thanks to all of you!

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

More
05 Jun 2015 21:45 #59482 by andypugh

So in theory, one could use a stepper motor along with an encoder and tie the two together with a PID loop - and in an academic sense, achieve similar or possibly identical results.


In theory yes.
In practice no.
In advanced practice, yes.

The thing is that as the PID output increases with a servo motor the current to the motor and so the motor force increases.

With a stepper motor as the step-rate increases the torque actually falls, so the result is not what one might be hoping for.

However, there are closed-loop steppers that have enough encoder resolution to basically operate as a 100-pole brushless motor. These can control the motor current to hold position. But LinuxCNC can't do that, it can only vary the step rate.
The following user(s) said Thank You: GaryLa

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

More
05 Jun 2015 21:50 #59484 by GaryLa
I'm glad you pointed that out. I agree. Just as with my heaters, the PID loop increases or decreases the PWM duty cycle to the heating unit per the tuned specs.

Therefore, the servo does everything "in its power" (pun intended) to stay put.

A typical stepper, however, can't be operated in this fashion.

It's very clear to me now -- I really appreciate your answers!!

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

More
06 Jun 2015 01:09 - 06 Jun 2015 01:10 #59496 by alan_3301

I just wanted to be sure I knew exactly what I was about to drop a bunch of cash on...


What servo setup are you shopping for?
Last edit: 06 Jun 2015 01:10 by alan_3301.

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

Time to create page: 0.202 seconds
Powered by Kunena Forum