How do CNC Machine Tools Move?
Category : The Professor's Thoughts
Only 3 possible motions…
There are really only three ways a standard CNC machine tool moves today: linear motion, arc motion, and what is called rapid motion. To understand these types of motion we should talk a little bit about how machines are made and how they are program. To do this we will first look at the construction of a 3 axis vertical machining center, or milling machine.
For this discussion we will start with the z-axis and the spindle since it is the rotation of the tool by the spindle that makes all of the cutting happen. A typical setup for vertical machining center is to have the tool mounted in a spindle which is aligned with the Z axis of the machine. This spindle is typically attached to a mechanism or “way” that allows vertical motion along the z-axis of the machine. Note that misalignment between the spindle and the z-axis way can lead to error in the finished part.
The typical z-axis drive will be a servo motor connected to a ball screw. Ball screws are really quite fascinating in how they work but for the purpose of this discussion you can imagine it simply like a nut on a bolt or screw. If you remove the threads from each end of the screw and mount the smooth parts in fixed bearing blocks with a nut in between them. The nut will move up and down along the screw as you turn it as long as you don’t allow the nut to rotate. If the spindle is then attached the nut you can turn the screw and make the spindle go up and down. To keep the nut with the spindle attached from rotating you need to attach it to something that is fixed rotationally simply welding it to the back of the machine won’t work. Instead it is attached to a bracket that is intended to slide along a guide rail. This guide rail is typically called the way. A typical axis might have two ways with a ball screw between them.
The x-axis is designed and constructed similarly to the z-axis and is installed orthogonally to the z-axis typically moving from right to left from the operator’s perspective. A y-axis can then be mounted orthogonally to the z and x-axes forming a right hand coordinate system.
Each axis is typically driven by a servo motor. Servo motor control systems, at a minimum, require feedback about position to operate. The typical method for getting this information is to attach a rotary encoder between the servo and the ball screw. This allows the controller to know “where” the spindle or x and y tables “are” at any given time as long as it hasn’t lost track of the encoder pulses which measure rotation of the motors. Because of this machine tools of this construction do not know where they are when they are turned on and will have some type of homing sequence that must be run before running any programs. The homing sequence will move each axis on at a time to the end of its travel where a switch is installed. They will drive the axis slowly across the switch noting the encoder position at the instant the switch makes contact and defining the “zero” or “home” position for this instance of operation.
As to programming: the typical machine tool today is programmed with a text based language that is sort of standardized, and goes by several names. I’ve heard NC-code, G-code, G&M-code, and simply code, or machine code. In this text I will try to stick to the terms “code,” and “g-code.” Several standard have been written over the years but as the technology has been developing so quickly the standards didn’t cover all situations individual machine tool makers wanted to address, so there are a core of “codes” common to most machines but when implementing common macros and canned cycles there can be great variation from one machine tool maker to another.
Why call it G-code or G&M-Code? The answer is simple most lines of code start with either the letter G or M followed by a string of numbers or letters that mean something to the machine tool controller. A typical command for example would be something like “G00 X1.4 Y3.5 Z4.0 F96.” This command tells the machine tool to move the axes as fast as possible (G00) to the Cartesian coordinates X=1.4 Y=3.5 Z=4.0 at the rate of 96 inches per minute (assuming the “English” system of units is being used.) Another common command might be “M03 S12000”. This tells the machine tool controller to start the spindle I the clockwise direction (M03) at 12,000 RPM (S12000). It is important to note that It doesn’t matter what the position of the machine tool axes are when the first command is received the machine tool moves as fast as it can from wherever it is to the programmed end position. Another thing to note is that the S12000 can be omitted if the last spindle command was to spin at 12,000 RPM as Spindle speed is a modal command and will stay in memory until it is changed.
Future posts will include a detailed discussion of Machine tool programming and G and M codes. The above paragraphs are enough information to continue the initial discussion on machine tool motion. As stated above there are only three ways a typical modern CNC tool can be told to move.
- G01 – linear motion
- G02 or G03 – arc motion (constant radius)
- G00 – rapid motion
Let’s look at each in turn
G01 pronounced “gee zero one”
The G01 command is given when the programmer wants the tool to move in a straight line relative to the workpiece at a specified feed rate. This command is typically used when cutting is happen or imminent. The feed rate can be specified on the G01 line or previously in the program as feed like speed is a modal command. No starting point is specified. The machine tool commands the servo motors to move from the current position to the end point specified at the feed rate specified accelerating from the current location and decelerating to stop at the end point.
If motion in only one plane or along one line is desired it is possible to omit endpoint coordinates for the axis or axes that will not need to move. For example if the tool is at X=0.1, Y=3.0, Z=0.01 when the G01 command is given and the desired end point for the move is X=0.1, Y=7.0, Z=0.01, the command G01 Y7.0 is equivalent to the command G01 X0.1 Y7.0 Z0.01 and preferable as it is easy for someone looking at the program to recognize that only motion in the Y direction is called for at this point in the program.
G02 pronounced “gee zero two”
G02 like G01 is typically used when the programmer intends for the tool to be in contact with the workpiece, i.e. when cutting is happening, or when the tool is entering or exiting the workpiece material these entry and exit moves are typically called lead in and lead out or entry and exit respectively. G02 commands the machine to move from its current location to a specified endpoint like G01, but instead of interpolating a straight line the servo motor controllers are commanded to interpolate a constant radius arc motion. To this end the programmer must specify the desired end point of the motion, and a radius to define the arc. There are a couple of common ways to define the radius those will be discussed in future posts on programming. The command “G02 X1. Y1. R1.” tells the controller to move the tool from where ever it is to the point X=1.0 Y=1.0 Z= (whatever it is at the start) along an arc with a 1 inch radius (again assuming the English system of units.)
It is important to note that if the straight-line distance from the current position to the commanded end point is less than 2 times the radius the command will fail generating an error code on the machine controller.
It is possible to make arcs in the x/y plane, the x/z plane, or the y/z plane but you need to tell the machine controller which plane you want to arc in. There will be more discussion on this in posts on programming.
G03 pronounced “gee zero three”
G03 acts just like G02 except the arc is counter clockwise.
G00 pronounced “gee zero zero”
The G00 command is typically used for positioning the tool and is not usually used when the tool is intended to be in contact with the workpiece. It is used for moves to and from the tool change location and moves or “links” from the end of one cutting operation to the start of another.
G00 motion is called rapid motion and it’s goal is typically to waste as little time as possible performing non value-added motion. For setup operations and proving out (testing) programs most machine tools will have a rapid override command that allows the operator to decrease the full speed rapid to some percentage of the machines full speed capability. Operators should know something about the machine when selecting rapid overrides; I regularly use machines that move at about 600 inches per minute at full speed rapid, and another that moves at 2000 inches per minute. Twenty five percent rapid 2000 in/min machine is almost equal to full speed rapid on a 600 in/min machine.
The other thing operators and programmers should be aware of is the fact that many engineers are lazy and the easiest way to implement rapid motion in the machine controller does not allow the tool to move in a straight line from the current point to the programmed end point. The path the tool will take is predictable, but not a straight line! (By “easiest” I mean the way that requires the least math and thus the least processing resources)
The easiest way to implement rapid motion is to command each axis independently, but simultaneously. For the command “G00 X10.0 Y4.0 Z-3.5” the controller looks at the end point for x and compares it with the current x position if they are not the same it starts the x-axis motor spinning at full speed in the correct direction continually checking if it has reached the correct value. When the current position equals the desired end position the x-axis motor is stopped. At the same time the controller is moving the y and z axis servo motors checking their current positions and the commanded end positions stopping each servo when its axis has reached the commanded position.
Many of the most modern controllers have options that will disable dogleg rapid but it is best for programmers and operators to know that the machine they are using today probably moves this way.