This documentation is no longer maintained. For documentation of the current version of emc2, please see http://www.linuxcnc.org/docview/html

Table of Contents

1 User Concepts

This chapter covers important user concepts that should be understood before attempting to run a CNC machine with g code.

1.1 Trajectory Control

1.1.1 Trajectory Planning

Trajectory planning, in general, is the means by which EMC follows the path specified by your G Code program, while still operating within the limits of your machinery.

A G Code program can never be fully obeyed. For example imagine you specify as a single-line program the following move:

G1 X1 F10 (G1 is linear move, X1 is the destination, F10 is the speed)

In reality, the whole move can't be made at F10, since the machine must accelerate from a stop, move toward X=1, and then decelerate to stop again. Sometimes part of the move is done at F10, but for many moves, especially short ones, the specified feed rate is never reached at all.

The basic acceleration and deceleration described above is not complex and there is no compromise to be made. In the INI file the specified machine constraints such as maximum axis velocity and axis acceleration must be obeyed by the trajectory planner.

1.1.2 Path Following

A less straightforward problem is that of path following. When you program a corner in G Code, the trajectory planner can do several things, all of which are right in some cases: it can decelerate to a stop exactly at the coordinates of the corner, and then accelerate in the new direction. It can also do what is called blending, which is to keep the feed rate up while going through the corner, making it necessary to round the corner off in order to obey machine constraints. You can see that there is a trade off here: you can slow down to get better path following, or keep the speed up and have worse path following. Depending on the particular cut, the material, the tooling, etc., the programmer may want to compromise differently.

Rapid moves also obey the current trajectory control. With moves long enough to reach maximum velocity on a machine with low acceleration and no path tolerance specified, you can get a fairly round corner.

1.1.3 Programming the Planner

The trajectory control commands are as follows:

G61
(Exact Stop Mode) G61 tells the planner to come to an exact stop at every segment's end. This ensures exact path following but the full stops can be harmful to the workpiece or the tooling, depending on the particular cut.
G64
(Blend Without Tolerance Mode) [Default] G64 is just blending and the naive cam detector is not enabled. G64 and G64P0 tell the planner to sacrifice path following accuracy in order to keep the feed rate up. This is necessary for some types of material or tooling where exact stops are harmful, and can work great as long as the programmer is careful to keep in mind that the tool's path will be somewhat more curvy than the program specifies. When using G0 (rapid) moves with G64 use caution on clearance moves and allow enough distance to clear obstacles based on the capabilities of your machine.
G64 Px.xxx
(blend tolerance mode) This enables the "naive cam detector" and enables blending with a tolerance. If you are in inch mode and program G64 P0.05, you tell the planner that you want continuous feed, but at programmed corners you want it to slow down enough so that the tool path can stay within 0.05 inches of the programmed path. The exact amount of slowdown depends on the geometry of the programmed corner and the machine constraints, but the only thing the programmer needs to worry about is the tolerance. This gives the programmer complete control over the path following compromise. The blend tolerance can be changed throughout the program as necessary. Beware that a specification of G64 P0 has the same effect as G64 alone (above), which is necessary for backward compatibility for old G Code programs.
Blending without tolerance
The controlled point will touch each specified movement at at least one point. The machine will never move at such a speed that it cannot come to an exact stop at the end of the current movement (or next movement, if you pause when blending has already started). The distance from the end point of the move is as large as it needs to be to keep up the best contouring feed.
Naive Cam Detector
Successive G1 moves that involve only the XYZ axes that deviate less than P- from a straight line are merged into a single straight line. This merged movement replaces the individual G1 movements for the purposes of blending with tolerance. Between successive movements, the controlled point will pass no more than P- from the actual endpoints of the movements. The controlled point will touch at least one point on each movement. The machine will never move at such a speed that it cannot come to an exact stop at the end of the current movement (or next movement, if you pause when blending has already started) On G2/3 moves in the G17 (XY) plane when the maximum deviation of an arc from a straight line is less than the G64 P- tolerance the arc is broken into two lines (from start of arc to midpoint, and from midpoint to end). those lines are then subject to the naive cam algorithm for lines. Thus, line-arc, arc-arc, and arc-line cases as well as line-line benefit from the "naive cam detector". This improves contouring performance by simplifying the path.

1.1.4 Planning Moves

Make sure moves are "long enough" to suit your machine/material. Principally because of the rule that "the machine will never move at such a speed that it cannot come to a complete stop at the end of the current movement", there is a minimum movement length that will allow the machine to keep up a requested feed rate with a given acceleration setting.

The acceleration and deceleration phase each use half the inifile MAX_ACCELERATION. In a blend that is an exact reversal, this causes the total axis acceleration to equal the inifile MAX_ACCELERATION. In other cases, the actual machine acceleration is somewhat less than the inifile acceleration

To keep up feed rate, the move must be longer than the distance it takes to accelerate from 0 to the desired feed rate and then stop again. Using A as 1/2 the inifile MAX_ACCELERATION and F as the feed rate *in units per second*, the acceleration time is ta = F/A and the acceleration distance is da=(1/2)*F*ta the deceleration time and distance are the same, making the critical distance d = da + dd = 2*da = F^2 / A.

For example, for a feed rate of 1 inch per second and an acceleration of 10 inch/sec^2, the critical distance is 1^2 / 10 = .1 inch. For a feed rate of .5 inch per second, the critical distance is .5^2 / 10 = .025 inch.

1.2 G Code

1.2.1 Defaults

When EMC first starts up many G and M codes are loaded by default. The current active G and M codes can be viewed on the MDI tab in the "Active G-Codes:" window in the AXIS interface. These G and M codes define the behavior of EMC and it is important that you understand what each one does before running EMC. The defaults can be changed when running a G-Code file and left in a different state than when you started your EMC session. The best practice is to set the defaults needed for the job in the preamble of your G-Code file and not assume that the defaults have not changed. Printing out the G-Code Quick Reference ([->]) page can help you remember what each one is.

1.2.2 Feed Rate

How the feed rate is applied depends on if an axis involved with the move is a rotory axis. Read and understand the Feed Rate section ([->]) if you have a rotary axis or a lathe.

1.2.3 Tool Radius Offset

Tool Radius Offset (G41/42) requires that the tool be able to touch somewhere along each programmed move without gouging the two adjacent moves. If that is not possible with the current tool diameter you will get an error. A smaller diameter tool may run without an error on the same path. This means you can program a cutter to pass down a path that is narrower than the cutter without any errors. See the Tool Compensation Section ([->]) for more information.

1.3 Homing

After starting EMC2 each axis must be homed prior to running a program or running a MDI command. Homing each axis and having the machine limits correctly set will prevent you from running a program that would exceed any travel for an axis. If your machine does not have home switches you should jog each axis to a match mark and home at the same place each time. Just because you home an axis in a particular spot does not limit you to how a program center is done. For example if you home your X axis with the table all the way to the right (the tool is in the left most position) and you encounter a g code program that has the X axis 0 position in the center of the part you jog over to the center of the part and touch off the X axis (using the AXIS interface).

If you want to deviate from the default behaviour, or want to use the Mini interface you will need to set the option NO_FORCE_HOMING = 1 in the [TRAJ] section of your ini file.

1.4 Touching Off

Touching Off is how you tell EMC where your tool and material is. For example if you have a g code program that referenced the X zero from the left side of the material (viewed from the front) and referenced the Y zero from the back side of the materal and the Z zero from the top of the material. Touching off is how you set the X zero, Y zero, and Z zero positions for the cooridnate system your using. In the AXIS interface you simply move the tool to a known position for that axis then select the radio button for that axis on the Manual Control tab then select Touch Off and enter in any offset. If for an example if you are using an edge finder and locating the left edge of your material and the edge finder has a 0.100” offset then once you find the edge you select touch off and enter -0.100 indicating that your present position is 0.100” to the left of edge of the part. One method for touching off Z axis is to have a cylindrical part of known diameter and to lower the tool tip to a point where the cylinder will not roll under the tool, then raise the Z up slowly until the cylinder just rolls under the tool tip. Then touch off and enter the diameter of the cylinder and your Z zero will be set to the top of the material. For more information on coordinate systems see the Coordinate System Chapter ([->]) in this manual .

1.5 Tool Changes

There are several options when doing manual tool changes. See the [EMCIO] section of the Integrators Manual for information on configuration of these options. Also see the G28 and G30 section of the User Manual.