Show all articles

How CNC Calculates Each Axis Velocity During G01, G02 and G03 Interpolation

TRASA3 Blog

CNC Library Published: 2026-10-08 Author: trasa3 183 views
How CNC Calculates Each Axis Velocity During G01, G02 and G03 Interpolation

The command G01 X1000. Y300. F125. specifies one feed rate, yet two axes have different distances to travel. From X0 Y0, X moves 1000 mm and Y moves 300 mm. To produce a straight line, both axes must complete their moves together.

Circular interpolation adds another requirement: the direction of motion turns continuously. Even at a constant feed along the arc, individual axis velocities change.

The calculations below cover linear Cartesian axes X, Y and Z. The examples assume millimetres, absolute coordinates, feed in millimetres per minute and cutter radius compensation disabled. Circular moves use the XY plane and incremental centre offsets specified by I/J.

What F specifies and what the interpolator calculates

Interpolation calculates intermediate coordinates for coordinated axis movement along a specified path. The program supplies geometry and feed; the control determines axis travel, intermediate positions and a permissible speed profile.

In the G94 mode considered here, F specifies speed along the path. It is the magnitude of the resultant velocity vector, from which the individual axis components are calculated.

Geometry calculations work together with trajectory planning and drive control. Actual feed depends on velocity, acceleration, jerk and accuracy limits, as well as neighbouring program blocks.

G01: X1000 Y300 at F125

The starting point is X0 Y0. The block is:

G01 X1000. Y300. F125.

The calculation assumes G21, G90 and G94. This is a mathematical example; the commanded travel may exceed a particular machine's working envelope.

Axis displacement and path length

Subtract the starting coordinates from the end coordinates:

ΔX = 1000 − 0 = 1000 mm
ΔY = 300 − 0 = 300 mm.

Since the axes move together, the straight-line distance follows the Pythagorean theorem:

L = √(ΔX² + ΔY²)

L = √(1000² + 300²) = √1 090 000 ≈ 1044.03 mm.

Ideal time and axis velocity components

At constant feed, without acceleration or deceleration:

t = L / F

t = 1044.03065 / 125 ≈ 8.3522 min, or approximately 8 minutes 21 seconds.

Each axis must cover its distance in that time:

Vx = ΔX / t ≈ 119.73 mm/min
Vy = ΔY / t ≈ 35.92 mm/min.

X moves faster than Y, and both reach their end coordinates together. The resultant speed is 125 mm/min. These values describe steady motion; during acceleration and deceleration, the components scale with the instantaneous speed along the straight line.

If both axes were assigned 125 mm/min

Moving independently at the same speed, X would cover 1000 mm in 8 minutes, while Y would cover 300 mm in 2.4 minutes. The tool would initially follow a diagonal with equal X and Y increments, then continue along X alone. The result would be a broken-line path.

While both axes were moving, the resultant speed would also be:

V = √(125² + 125²) ≈ 176.78 mm/min.

That matches neither the specified straight line nor F125. The interpolator coordinates the axes according to the block geometry.

General formulas for two and three axes

For a non-zero linear move in XY:

L = √(ΔX² + ΔY²)
Vx = F × ΔX / L
Vy = F × ΔY / L.

The ratios ΔX/L and ΔY/L are the components of a unit direction vector. Multiplying them by F gives the velocity components, which satisfy:

F² = Vx² + Vy².

A component's sign indicates direction. For example, moving from X0 Y0 with G01 X-100. Y50. F500. gives a negative Vx and a positive Vy. The feed magnitude remains positive.

For three linear axes, the formulas become:

L = √(ΔX² + ΔY² + ΔZ²)
Vx = F × ΔX / L
Vy = F × ΔY / L
Vz = F × ΔZ / L.

For example, from X0 Y0 Z0, the command G01 X100. Y50. Z-20. F300. uses displacements ΔX = 100, ΔY = 50 and ΔZ = −20 mm. All three axes reach the endpoint in coordination.

This model applies to linear Cartesian coordinates. Combined linear and rotary motion requires the machine kinematics and the controller's feed specification method to be taken into account.

G03: a quarter-circle with a 50 mm radius

G02 commands clockwise circular interpolation; G03 commands counterclockwise motion. Direction is defined relative to the selected plane. G17 selects XY, where G03 is counterclockwise when viewed from the positive Z side towards the plane.

Starting at X0 Y0, consider:

G03 X50. Y50. I0. J50. F600.

This example assumes G17, G21, G90, G94 and incremental I/J offsets from the arc start to its centre. G90 specifies absolute endpoint coordinates; check the interpretation of I/J separately in the control settings.

Centre, radius and length

The centre coordinates are:

Xc = Xstart + I = 0 + 0 = 0
Yc = Ystart + J = 0 + 50 = 50.

The centre is C = (0; 50), the start is A = (0; 0), and the end is B = (50; 50). The radius is the distance from the centre to the start:

R = √[(0 − 0)² + (0 − 50)²] = 50 mm.

The start lies below the centre and the end lies to its right. Counterclockwise G03 motion therefore covers a quarter-circle, or 90°.

L = πR / 2 = π × 50 / 2 ≈ 78.54 mm.

Motion time

At a constant F600, the ideal time is:

t = L / F ≈ 78.53982 / 600 = 0.1309 min ≈ 7.854 s.

This excludes acceleration, deceleration and machine limits. Unlike a straight line, an arc requires continuously changing velocity components even at a constant path feed.

How Vx and Vy change along the arc

A circle's coordinates can be expressed using the radial angle θ, measured from positive X:

X = Xc + R × cos θ
Y = Yc + R × sin θ.

For this arc, Xc = 0, Yc = 50 and R = 50 mm, while θ increases from −90° to 0°. Thus X = 50 × cos θ and Y = 50 + 50 × sin θ.

Angular velocity

Linear and angular velocity are related by V = ωR. At constant feed:

ω = F / R = 600 / 50 = 12 rad/min = 0.2 rad/s ≈ 11.46°/s.

Angles must be expressed in radians when differentiating the trigonometric expressions. Degrees are used in the examples and table to make positions around the circle easier to read.

Components for G03

Differentiating the coordinates gives:

Vx = −Rω × sin θ = −F × sin θ
Vy = Rω × cos θ = F × cos θ.

At the start, θ = −90° gives Vx = 600 mm/min and Vy = 0. At the midpoint, θ = −45°, both components are approximately 424.26 mm/min. At the end, θ = 0°, Vx = 0 and Vy = 600 mm/min.

The velocity vector is tangent to the circle. As the tool follows the arc, its direction turns from positive X towards positive Y.

Angle θX, mmY, mmVx, mm/minVy, mm/min
−90°0.000.00600.000.00
−67.5°19.133.81554.33229.61
−45°35.3614.64424.26424.26
−22.5°46.1930.87229.61554.33
0°50.0050.000.00600.00

The resultant speed remains constant because sin² θ + cos² θ = 1:

Vx² + Vy² = F² × (sin² θ + cos² θ) = F².

The start and end values describe ideal tangential motion at constant feed. A real controller may accelerate, decelerate or coordinate the speed with neighbouring blocks. Actual velocities at block boundaries can therefore differ.

G02: the same principle with clockwise motion

From X0 Y0, use:

G02 X50. Y50. I50. J0. F600.

The centre is now C = (50; 0), again with a 50 mm radius. This is a different arc between the same endpoints: its centre differs from the G03 example.

The start lies to the left of the centre and the end lies above it. Clockwise motion decreases the angle from 180° to 90°. The initial velocity points along positive Y, and the final velocity along positive X.

PositionVx, mm/minVy, mm/min
Start0600
Midpoint424.26424.26
End6000

For G02 with a positive feed magnitude F, the formulas are Vx = F × sin θ and Vy = −F × cos θ. The current angle determines the component signs. One axis slowing while the other speeds up, as in these examples, is not a universal rule for every arc.

Radius, acceleration and feed limits

During steady straight-line motion, the velocity vector is constant. On a circle, its direction changes continuously, so even a constant speed along the arc requires acceleration.

The magnitude of centripetal acceleration is:

a = V² / R.

With radius in millimetres and acceleration in mm/s², V must be expressed in mm/s. For F600 and R50:

V = 600 / 60 = 10 mm/s
a = 10² / 50 = 2 mm/s².

A small radius at high feed

With R = 10 mm and F = 6000 mm/min, the speed is 100 mm/s. Required acceleration is:

a = 100² / 10 = 1000 mm/s².

Suppose an illustrative model limits the resultant acceleration for this move to a_max = 500 mm/s². Then:

V_max = √(a_max × R)
V_max = √(500 × 10) ≈ 70.71 mm/s
F_max ≈ 4243 mm/min.

F6000 cannot be maintained under this model. The planner must limit speed to suit the available dynamics; the response to inadmissible parameters depends on the controller implementation.

This is an idealised estimate based on a resultant acceleration limit. A real machine has separate axis, jerk and accuracy constraints. Changing the feed also introduces tangential acceleration. These conditions may require further speed reduction.

At a fixed speed, reducing radius increases the required acceleration. At a fixed radius, acceleration rises with the square of speed. Small radii are therefore particularly sensitive to high feed rates.

Short straight moves and corners between blocks

Dynamic limits also apply to G01. Consider a 10 mm move from rest at a commanded 10 000 mm/min. If a stop is required at the end, the machine must accelerate and decelerate within those 10 mm. There may be insufficient distance to reach the programmed feed.

A long move can contain a constant-speed section between acceleration and deceleration. A short move may have no such section. L/F therefore gives an ideal time at a specified constant feed, rather than a guaranteed real block time.

Another reason for slowing is a direction change between successive straight moves. Starting at X0 Y0, these commands:

G01 X100. Y0. F3000.
G01 X100. Y100.

form a 90° corner. Passing through the exact vertex at non-zero speed while instantly turning the velocity vector is impossible with finite acceleration. To follow that corner exactly, the machine must stop and accelerate in the new direction.

If the settings permit deviation from the vertex, the planner can blend the segments smoothly while retaining some speed. This is known as corner blending. The tolerance and blending behaviour depend on the controller and trajectory-control mode.

The effect is particularly noticeable in programs containing many short linear segments. Neighbouring block geometry influences the speed that can be maintained on each section.

From a program block to drive motion

The formulas above describe kinematics. In a typical control system, they form part of a broader process:

  1. Block interpretation. Identify the motion type, coordinates, arc parameters, feed and active modes.
  2. Geometry construction. Calculate the start and end positions, straight-line length or arc centre, radius and direction.
  3. Speed planning. Account for machine limits and transitions to neighbouring blocks.
  4. Cyclic interpolation. Calculate commanded intermediate axis positions according to the selected speed profile.
  5. Drive control. Control loops and feedback ensure tracking of commanded positions and velocities.

For a circle, the commanded positions follow X = Xc + R cos θ and Y = Yc + R sin θ. An implementation may use numerical and recurrence algorithms. These expressions do not describe the internal code of a particular FANUC, HAAS or SYNTEC controller.

Interpolation coordinates the axes along the path, while the drives track the commands within permissible error. When monitored parameters are violated, the system responds according to its configuration.

Feed mode and spindle speed

All preceding calculations use feed in length units per minute. On systems where G95 selects feed per revolution, F is specified in mm/rev when metric units are active.

For example, with F0.2 and a spindle speed of 1000 rpm:

F_min = 0.2 × 1000 = 200 mm/min.

The resulting path speed is distributed between axes according to the motion geometry. If spindle speed changes, the equivalent feed per minute changes too.

G-code meanings depend on machine type and control system. On HAAS lathes, for example, G94 specifies an end-facing cycle. Begin feed analysis by checking the active mode and the manual for the actual controller.

Comparing G01 with G02/G03

CharacteristicG01Planar G02/G03
PathStraight lineCircular arc
Velocity direction within the segmentConstantChanges continuously
Components at constant feedConstantVary with angle
Geometric calculationUnit direction vectorTangent to the circle
Acceleration at constant path speedNoneCentripetal
Acceleration and decelerationDepend on dynamics and neighbouring blocksDepend on dynamics, curvature and neighbouring blocks

In both cases, F describes motion along the path in the selected feed mode. The distinction is the tangent direction: it stays constant on a straight line and turns continuously on an arc.

Exercises in NCPlayer

NCPlayer from TRASA3 can be used to study the geometry. The first example defines a straight line:

G21 G17 G90 G94 G40
G00 X0. Y0.
G01 X1000. Y300. F125.
M30

The second creates an arc with incremental I/J interpretation:

G21 G17 G90 G94 G40
G00 X0. Y0.
G03 X50. Y50. I0. J50. F600.
M30

Compare the path shape, length, intermediate coordinates and ideal time with the manual calculations. The I/J mode must match the example assumptions. If using a runtime calculation tool, account for its settings and the model's available constraints.

These programs are intended for simulation and theoretical analysis. They do not define a safe machining process on real equipment, and X1000 may exceed the machine's travel.

Visualisation shows motion geometry, but does not necessarily reproduce an industrial controller's dynamics or those of every servo drive. Compare calculated axis velocity components with the actual feed and block execution mode.

Understanding interpolation explains the differences between commanded feed, axis velocities and machining time. Straight-line components follow the motion direction; arc components change with the tangent. In both cases, actual speed is constrained by machine capabilities and trajectory planning.

Technical sources

This article is available in the following languages:

Related posts