Workpiece Setting Error Compensation (G54.4)
You clamp a plate on the table, probe it, and find it’s sitting 0.5 mm over and rotated 1.5° from where the program expects it. The old answer is to loosen the vise and re-tap it true — slow, and only as good as your tap. G54.4 Workpiece Setting Error Compensation (WSEC) is the other answer: you tell the control the setting error, and it rotates and shifts the coordinate system so the part program — written for the ideal position — cuts correctly on the part as it actually sits. This is the feature behind “set-and-inspect” probing macros that align to a feature instead of a hard stop. It is the most misunderstood of the Fanuc work-coordinate commands, largely because it looks like a work offset but is really a small 3-D coordinate transformation. This page is derived from FANUC’s Series 30i/31i/32i-B Plus Operator’s Manual (B-64724EN), §15.5.
What G54.4 Compensates For
A workpiece setting error is the displacement from the correct workpiece position to the actual one — the part is shifted and/or slightly rotated on the table. G54.4 defines a second coordinate system, the workpiece setting coordinate system (call it X′Y′Z′), that follows the displaced part, and runs the program in it. In the manual’s words, the function “can compensate for a workpiece setting error on a rotation axis used with a function” — in practice, any small translational + rotational misalignment you can measure with a probe.
It is not a fixture offset you type once and forget, and it is not for programming a deliberately tilted feature — that is G68.2 tilted working plane. G54.4 corrects the error between where the part should be and where it is. The two are frequently combined: probe and correct the setup error with G54.4, then tilt into a feature plane with G68.2.
x, y and rotated by c from the ideal frame (XYZ) the program assumes. G54.4 stores that error and runs the program in the corrected frame. Rotation exaggerated; after FANUC B-64724EN Fig. 15.5.The Command: G54.4 Pn
| Block | Meaning |
|---|---|
G54.4 P1 … G54.4 P7 | Start workpiece setting error compensation using setting-error set n. Seven sets (No. 01–07) are available. |
G54.4 P0 | Cancel workpiece setting error compensation. |
Pn is the workpiece setting error specification code — it selects which stored error set to apply. A start block and a cancel block both suppress buffering (the control stops look-ahead across them), because the coordinate system changes at that point. Typical shape of a probing routine: probe the part, write the measured error into a set, then G54.4 P1 to switch the program into the corrected frame, machine, and G54.4 P0 at the end.
The Eight Values That Define a Setting Error
Each error set is defined by eight values:
| Value | Meaning |
|---|---|
x, y, z | X / Y / Z direction error — the coordinates of the displaced workpiece origin, as seen from the original workpiece coordinate system. |
a | Rotation error about the X-axis, in degrees. |
b | Rotation error about the Y-axis, in degrees. |
c | Rotation error about the Z-axis, in degrees. |
| Table rotation axis position 1 | Position of the machine’s first table rotation axis at which the error was measured (5-axis table/composite machines only). |
| Table rotation axis position 2 | Position of the second table rotation axis, likewise. |
The model (order matters). The corrected coordinate system is built by rotating then shifting: take the workpiece coordinate system, rotate it about the X-axis by a, about the Y-axis by b, and about the Z-axis by c, then shift its origin by (x, y, z). The result is the workpiece setting coordinate system the program then runs in. So a/b/c capture the part’s tilt/skew and x/y/z capture where its zero landed — exactly the two things a probe measures when it finds a corner and an edge.
The COMMON Set (No. 00)
Alongside the seven selectable sets there is a special set No. 00 (COMMON). Each value in No. 00 is added to the corresponding value of every set No. 01–07. It exists for the error that’s the same for every fixture on the table — a pallet offset, a common datum shift — so you set it once instead of baking it into all seven sets. One catch worth committing to memory: rotation errors are not available for No. 00 — COMMON carries translation (and table-axis positions) only, not a/b/c.
The manual’s worked example — COMMON X 10.000, set No. 01 x 0.500, a 1.500:
| Selected | Effective x | Effective a |
|---|---|---|
G54.4 P1 (No. 01) | 10.000 + 0.500 = 10.500 | 1.500 (from the set; COMMON has none) |
G54.4 P2 (No. 02, x 0.800 a 1.800) | 10.000 + 0.800 = 10.800 | 1.800 |
5-axis subtlety. On a table-rotation or composite 5-axis machine, if the table rotation axis position stored in No. 00 differs from the one in the selected set, the values are not simply added. The control first converts both to a common basis (the errors expressed as if the table rotation axis were at 0°), then adds — because a translation measured at C = −90° points in a different machine direction than the same translation measured at C = +90°. On a 3-axis machine you can ignore this; on a trunnion or rotary-table 5-axis you cannot.
Setting the Data
Error sets live on the workpiece-setting-error setting screen, not in ordinary work-offset registers — this is why you won’t find G54.4 data at #5221+ like G54–G59. Each set has fields for x/y/z, a/b/c, and the two table-rotation-axis positions (shown under the a/b/c fields, labelled with the rotary-axis names). You enter a set number and press [NO.SRH] to jump to it; [INPUT] sets a value, [+INPUT] adds to it (handy for a probing macro that nudges a stored value), and [ERASE] → [NO.] / [ALL] clears one set or all of them. Values can also be read and written through the screen’s input/output function (B-64724EN §8.2.11), which is how a Renishaw set-and-inspect cycle drops a measured error into a set automatically.
Which axes count as table rotation axes — and therefore whether the table-position fields even appear — is set by machine parameters: No. 19680 selects the machine configuration (12 = table-rotation type, 21 = mixed/composite type), No. 19681 and No. 19686 name the rotation-axis numbers, and bit 0 of No. 1006 must be set (rotation axis) for those axes. On most machining-center work with no table rotary, only x/y/z/a/b/c are in play.
G54.4 vs. G54.1 vs. G68.2 — Don’t Confuse Them
| Command | What it is | Reach for it when… |
|---|---|---|
| G54–G59, G54.1 Pn | Additional work coordinate systems — pure origin shifts, one per fixture/part. | You have several parts/datums on the table and want a clean origin for each. |
| G54.4 Pn | Workpiece setting-error compensation — a small translation and rotation correcting a mis-set part. | The part is clamped slightly crooked and you’d rather correct in software than re-fixture. |
| G68.2 / G53.1 | Tilted working plane — deliberately program a feature in its own tilted plane and orient the tool to it. | The feature is designed at an angle (a bore on a ramp), not misaligned. |
The through-line: G54.1 moves the origin, G68.2 tilts the plane on purpose, and G54.4 undoes an accidental tilt/shift. They stack — a real 5-axis job often probes with G54.4 to true the setup, then G68.2 to get into the feature plane.
Restrictions & Notes
- Start (
G54.4 Pn) and cancel (G54.4 P0) blocks suppress buffering; don’t rely on look-ahead across them. - It is an option — on machines without it,
G54.4alarms. On Mazak Smooth (EIA/ISO) it appears as the sameG54.4 P_“workpiece setup error correction” option, with the seven data sets exposed at#5801–#5878; see the Mazak EIA/ISO page. - Beware the register trap: the WSEC data is not a system-variable block on the 30i. (The similarly-numbered
#5801+ on a Fanuc lathe is the second geometry tool offset — unrelated.) - On 5-axis table/composite machines, mind the table-rotation-axis-position conversion when combining COMMON with a set (above) — simple addition is only valid when the positions match.
Parameters That Affect G54.4
Workpiece setting error compensation has its own parameter block (FANUC B-64730EN §4.96), plus the 5-axis machine-configuration parameters it shares with tilted working plane and TCP. These are machine-tool-builder settings you don’t normally touch — but they explain why WSEC behaves one way on a 3-axis mill and another on a trunnion 5-axis.
| Parameter | What it controls |
|---|---|
No. 11200 #0 (RCM) | On a 5-axis machine, whether tool-direction compensation (compensation for a rotation axis) is performed during WSEC. 0 = not performed, 1 = performed. |
No. 11200 #1 (CL2) | When the rotation axis is compensated, which of the multiple candidate compensated positions is chosen — governs how the control avoids passing through a singular posture. |
No. 11200 #3 (WSK) | Whether skip (probe-trip) coordinates #100151–#100182 read during WSEC return workpiece-coordinate values (0) or machine values (1). |
No. 11201 | Number of decimal places for the rotation-direction errors a/b/c on the setting screen. |
No. 11204 | Angle used to decide a singular posture during WSEC (when rotation-axis compensation is active). |
No. 11411 / 11414 | Number of the workpiece coordinate system used as the reference for the workpiece-setting-error amount. |
No. 19680 | Machine configuration: 12 = table-rotation type, 21 = mixed/composite — decides whether the table-rotation-axis-position fields apply at all. |
No. 19681 / 19686 | The rotation-axis numbers — which machine axes are the table rotation axes. |
No. 1006 #0 | Must be set (rotation axis) for the axes named in 19681/19686. |
Parameter details from FANUC Parameter Manual B-64730EN §4.96 (Parameters of Workpiece Setting Error Compensation); machine-configuration parameters from B-64724EN.
See also — the same idea on other controls: Siemens aligns a mis-set workpiece with measuring cycles that write a frame (base/settable frames, kinematic alignment); Heidenhain uses 3D basic rotation and a preset written from probed points. And for the neighbouring Fanuc features: G68.2 tilted working plane and tool centre point control (G43.4/G43.5).
Sources: FANUC Series 30i/31i/32i-MODEL B Plus Operator’s Manual (Common to Lathe System / Machining Center System), B-64724EN/01 — §15.5 Workpiece Setting Error Compensation (G54.4), data-screen input/output §8.2.11, display and setting §12.3.16; and FANUC Parameter Manual B-64730EN/01 — §4.96 Parameters of Workpiece Setting Error Compensation.
Have a question or want to contribute?
Contact us with corrections, additions, or topics you'd like covered.
Get in Touch