584,829 active members*
4,890 visitors online*
Register for free
Login
IndustryArena Forum > CNC Electronics > Stepper Motors / Drives > controller positioning algorithms ?
Results 1 to 12 of 12
  1. #1
    Join Date
    Aug 2006
    Posts
    6

    controller positioning algorithms ?

    For example any CNC controller. If I command a movement from 0 origin to X10 Y10, the tool should traverse a 45deg angle to the destination.
    With resolution of internal CNC and resolution of motors and feedback mechanisms,
    does the traverse actually take a path of minute, or even not so minute, series of stacked 'Z"s ? Like a minute series of zig-zags to the destination as one motor moves and then the other motor moves.
    The feedback of the encoders is not (usually) presented to the CNC controller, therefore how does the controller know where the tool is during the transit? Does the controller need to know where the tool is during the transit?
    The controller can only make an assumption AFTER the move, that the tool is where it was commanded.
    So therefore why is not the encoder feedback presented back to the CNC controller?
    Shane,
    AU

  2. #2
    Join Date
    Dec 2013
    Posts
    5717

    Re: controller positioning algorithms ?

    In a perfect world, the controller should be moving both motors simultaneously but that depends on the controller as to how faithfully it is accomplished.

    In an open loop system, the controller blindly sends step & direction commands to the steppers and assumes that the motors are doing what has been commanded.

    In a system where the loop is closed at the drive, it's the drive's responsibility to make sure the motor is doing what it';s commanded by the controller. The controller has no idea what the actual position is.

    In a full closed loop system where the encoder is connected to the controller, the controller will make needed corrections to insure that the motor are following the commanded path. The controller has full control over the motors and knows exactly where the motors are at all times.
    Jim Dawson
    Sandy, Oregon, USA

  3. #3
    Join Date
    Sep 2006
    Posts
    6463

    Re: controller positioning algorithms ?

    Does that mean that if you have an open loop system....whatever that is.....you will not get any smooth curves or straight line angled traverses?

    I though that with the X and Y code on the same line you get a straight line angled move whereas with the X code on one line and the Y code on the next line you would get an L shaped move.

    What is the difference between a closed loop system and an open loop system …..how is it accomplished?
    Ian.

  4. #4
    Join Date
    Apr 2005
    Posts
    629

    Re: controller positioning algorithms ?

    An open loop system is nearly as accurate as a closed loop system until something goes wrong.

    In both cases, the tool is commanded to go to a specific coordinate and that coordinate would be the same for both, open and closed loop. The intermediate points would also be the same for both systems.

    It is when things go wrong that the closed loop systems are better and more accurate.

    In a closed loop system,, the encoder provides feedback as to where an axis is. The drive, and in some cases the control, monitor that programmed position against the actual position and the control or drive will adjust position to get it back back to where it should be. A typical example would be overshoot of an endpoint, the control will bring back the axis to where it should be (meaning at the end of a motion). A another typical example is overloading of a tool or hitting an object during a motion and the motion stops. The drive and control work in unison to halt the system and create an alarm condition.

    While all servo driven CNC machines are "Closed loop" because the encoder provides positional (and velocity) feedback, they are not truly closed loop machines!

    The rotary encoder is almost always on the backside of the servo motor and it is attached to the servo's motor shaft. In this arrangement, the system is ONLY closed loop up to the servo motor, however, in reality that isn't very helpful.

    In a CNC machine, any of the following conditions are outside the "Closed loop" due to mechanical issues;
    ** Backlash caused by a low quality ball screw or a good quality ball screw that is worn out.
    ** Backlash caused by low quality end bearings, end bearings that are not properly installed, end bearings that are worn out.
    ** Slippage between the servo motor and the ball screw in direct coupled configurations
    ** Belt tension take-up on systems that have a belt between the servo and the screw.
    ** Thermal growth of the ball screw or other slide components

    All of these issues greatly affect the positional accuracy of the machine and they are not accounted for in a simple "Closed loop" system.

    In the machine tool world, a TRUE closed loop system takes into account the actual position of the slide relative to the machine. This is accomplished by using a glass scale that very accurately provides feedback to the control system as to where that axis is. Within the control loop, the servo's encoder is usually used to provide velocity feedback and positional feedback is from glass scale (linear scale). If at anytime (even during the motion), that the real position is not in synch with the actual position, the control will stop the motion and cause an alarm (Servo disconnect on a FANUC).

    Hopefully that will help with your understanding of closed loop systems as they apply to CNC machine tools.

    Chris D

  5. #5
    Join Date
    Sep 2006
    Posts
    6463

    Re: controller positioning algorithms ?

    Now that is what I called an explanation.....thanks a lot, it expands the limit of my horizon tremendously.
    Ian.

  6. #6
    Join Date
    Sep 2006
    Posts
    6463

    Re: controller positioning algorithms ?

    edit....double post.

  7. #7
    Join Date
    Apr 2005
    Posts
    629

    Re: controller positioning algorithms ?

    For what it is worth, the vast majority of professionals in this industry do not understand that their CNC machines are running open loop (past the servo motor).

    Chris D

  8. #8
    Join Date
    Aug 2009
    Posts
    230

    Re: controller positioning algorithms ?

    The exact details depend on the controller.

    Most software step-and-direction based controllers that I am aware of fire the step signals simultaneously (or very near to it); with the result that any two axes can - in principle - move only in the cardinal 8 directions. This is a result of the motion engine of the controller operating off of a single timer. However, it is possible to have a timer for each axis; and then the motion at the step level would more precisely track the commanded line. I have not had the opportunity to examine the source code of FPGA based systems; but due to the greater resources available; I would expect them to use individual timers per axis; and likewise for any hardware-based motion engines.

    Systems that do not have a step-and-direction stage; but instead output velocity commands for driving servomotors (AC or DC) will have a smoother motion profile in principle because the quantitation error caused by the finite resolution of the machine is spread over a longer area. On the other hand; these systems usually don't update the servo loop as quickly as a step-and-direction based system does, so in principle they can have poorer path tracking around sharp curves and at sudden endpoints. Also, these systems have following error that stepper based systems don't have (but, they can usually go much faster than a stepper, due to the differences in motor construction).

    All of this happens at the resolution of the machine - typically less than 0.001", sometimes well less than 0.00001" - and at these scales other factors come into play: machine inertia, flex, as well as mechanical sources of inaccuracy like chatter/vibration and, at least for mills, the fact that you have a spinning toothed cutter with a chipload that's larger than the machine resolution. The consequence of all this is that either system can be made to outperform the mechanical limits of the machine tool; and typical configurations produce parts with no detectable stair-stepping from machine resolution issues.

    Practically, if one is deciding on open-loop steppers vs closed-loop steppers vs servos (and I'm ignoring the table positioning loop in this; I'm just talking about the motors) other factors dominate the decision (like torque-at-speed, mechanical-upset tolerance, and cost); hypothetical accuracy doesn't really enter the equation, so-to-speak.

    As for actually figuring the motion, both DDA and Bresenham algorithms are often used; and I would suspect that with more modern controls that have CPUs capable of high-performance floating point math, direct solution of the line and circle equations as a function of time would also be employed.

    https://en.wikipedia.org/wiki/Digita...ics_algorithm)
    https://en.wikipedia.org/wiki/Bresen...line_algorithm

  9. #9
    Join Date
    Aug 2006
    Posts
    6

    Re: controller positioning algorithms ?

    Thank you all, very informative answers.
    So could you say that.... Because of the algorithms employed by decent CNC controllers, its safe enough to close the loop at the motor.
    And because the motor takes care of the loop with decent algorithms within its own feedback loop, the encoder is safe enough on the motor or screw shaft, and no need for linear encoder on the slide to feedback to motor.

    Only reason I asked the initial question is because I have for weeks been looking at aliexpress CNC controllers, and have not found one yet that has encoder feedback to the controller.

    I have a little Australian made gear hobber Qualos #0, cuts 5" x 5" spur and helical gears.
    I want to CNC it, but I need rotation feedback of hob tool shaft sent to the controller, then divide these pulses by a number, the result pulse train will be sent to drive the gear blank motor.
    I cant CNC command the drive motor speed, its fixed, so therefore 2 axis G Code cant help, What I have to do is pick off at an appropriate shaft the rpm with an encoder, and use this as the starting point for gear blank rotation and feed motor rotation.
    What a hobber needs is a whole number ratio of hob rpm to gear blank rpm. For example, a 40 T gear, the hob makes 40 rev, whilst the blank does 1 rev.
    This is usually done with change gears. but to cut a prime number, you need the same prime on the change gears.
    It also needs a feedrate that slightly "drags" (or advances) the hob rpm across the black, to give the helix of helicals.
    CNC can do this for me, but I have to find controller with encoder input, I cant rely on closed loop at the motors.
    The feed rate is important as it helps with cutting helicals.
    So a 2 axis controller is needed.
    And I have thought about an Arduino, There is code available to read quad encoders , all have to do is insert gear blank and feedrate divisor into code.
    Shane,
    AU

  10. #10
    Join Date
    May 2015
    Posts
    684

    Re: controller positioning algorithms ?

    You should be able to do this with Linuxcnc. There are some examples around for hobbing. If you are confident programming an Arduino in C, you should have no troubles writing a Hal component to do exactly what you want.

    Components are LinuxCNC's best kept secret. They allow you to write custom C code snippets that are embedded in the core servo thread and execute as if they are a part of LinuxCNC's core.

    Here is an example. Feel free to ask for guidance on the Linuxcnc forum
    https://forum.linuxcnc.org/10-advanc...tronic-gearing
    Rod Webster
    www.vehiclemods.net.au

  11. #11
    Join Date
    Aug 2009
    Posts
    230

    Re: controller positioning algorithms ?

    and no need for linear encoder on the slide to feedback to motor.
    Most CNCs don't have this; and rely on the mechanical parts to be rigid and tight. It's usually only found on higher-end machines; and you won't find that on Aliexpress.

    I cant CNC command the drive motor speed, its fixed,
    How many HP (or Watts) is that motor? I'm wondering if it might be feasible to replace it with a servo...

  12. #12
    Join Date
    Jan 2005
    Posts
    15362

    Re: controller positioning algorithms ?

    Quote Originally Posted by dwyersm View Post
    Thank you all, very informative answers.
    So could you say that.... Because of the algorithms employed by decent CNC controllers, its safe enough to close the loop at the motor.
    And because the motor takes care of the loop with decent algorithms within its own feedback loop, the encoder is safe enough on the motor or screw shaft, and no need for linear encoder on the slide to feedback to motor.

    Only reason I asked the initial question is because I have for weeks been looking at aliexpress CNC controllers, and have not found one yet that has encoder feedback to the controller.

    I have a little Australian made gear hobber Qualos #0, cuts 5" x 5" spur and helical gears.
    I want to CNC it, but I need rotation feedback of hob tool shaft sent to the controller, then divide these pulses by a number, the result pulse train will be sent to drive the gear blank motor.
    I cant CNC command the drive motor speed, its fixed, so therefore 2 axis G Code cant help, What I have to do is pick off at an appropriate shaft the rpm with an encoder, and use this as the starting point for gear blank rotation and feed motor rotation.
    What a hobber needs is a whole number ratio of hob rpm to gear blank rpm. For example, a 40 T gear, the hob makes 40 rev, whilst the blank does 1 rev.
    This is usually done with change gears. but to cut a prime number, you need the same prime on the change gears.
    It also needs a feedrate that slightly "drags" (or advances) the hob rpm across the black, to give the helix of helicals.
    CNC can do this for me, but I have to find controller with encoder input, I cant rely on closed loop at the motors.
    The feed rate is important as it helps with cutting helicals.
    So a 2 axis controller is needed.
    And I have thought about an Arduino, There is code available to read quad encoders , all have to do is insert gear blank and feedrate divisor into code.
    Shane,
    AU
    The loop is not closed at the motor it is closed in the Servo Drive and is very sophisticated in modern AC Servo drives, this will do everything you need and much more, so your control would need an encoder input like Centroid has this will read your Encoder on the spindle ( Gear blank ) and then the control would control the feed motor ( servo motor ) all simultaneously to what ever you program it to do
    Mactec54

Similar Threads

  1. General Motion Control Algorithms
    By yngndrw in forum OpenSource Software
    Replies: 2
    Last Post: 01-31-2014, 08:22 PM
  2. Replies: 3
    Last Post: 03-14-2013, 01:12 AM
  3. Best Interpolation algorithms
    By youssefedward in forum Uncategorised CAM Discussion
    Replies: 1
    Last Post: 05-12-2012, 05:17 PM
  4. NC Deckel FP2NC controller positioning
    By raimafa in forum Deckel / Dialog
    Replies: 0
    Last Post: 02-18-2011, 11:02 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •