CalWest ManufacturingRobotics Fontana, CA

Call or text (818) 397-4809

FANUC palletizing programming, explained from a working cell

We build and program FANUC palletizing cells in our Fontana, CA shop. This guide covers the palletizing instructions on R-30iB and R-30iB Plus controllers, the position register method used without them, and how a stack pattern gets taught.

A FANUC palletizing program answers the same questions for every case: which spot on the pallet it goes to, which way it faces, and what path gets it there without touching the cases already stacked. This guide explains how the controller’s palletizing instructions handle each one, with photos from palletizing cells we designed, built and programmed for a plant in Temecula, CA. The example program was written for this guide. It is not the code running in those cells.

In short

A FANUC palletizing program is built from three instructions in the controller’s Palletizing option. PALLETIZING-B, BX, E or EX reads a pallet register that holds the row, column and layer of the next case, and works out where that case goes. PAL motion lines carry the robot through approach points, the stack point and retract points. PALLETIZING-END then steps the register on. The pattern itself is taught from a few corner points.

For a screen-by-screen FANUC palletizing tutorial, see the palletizing chapter of FANUC’s R-30iB operator’s manual (Basic Function, B-83284EN). This guide covers the decisions around those screens.

How is a FANUC palletizing program structured?

On R-30iB and R-30iB Plus controllers, palletizing is a software option, listed in FANUC’s operator’s manual as the Palletizing option, J500. It adds three instructions to the ordinary teach pendant editor, and the pattern data is stored with them in the program.

Instruction What it does
PALLETIZING-EX_1 Reads the pallet register, works out where the next case goes and which path it takes, and writes those positions into the PAL_1 motion lines. B, BX, E or EX after the dash sets the type.
PAL_1[A_n] Approach points, up to eight, passed on the way in
PAL_1[BTM] The stack point, where the case is set down
PAL_1[R_n] Retract points, up to eight, passed on the way out
PALLETIZING-END_1 Steps the pallet register on to the next position

The pallet register, PL[1] to PL[32], holds the row, column and layer of the next case, and everything else is calculated from it. A program can hold up to 16 sets of palletizing data, numbered after the underscore, and each program keeps its own. The registers are shared across the controller, so give each pattern its own.

The three instructions have to stay together in one program. FANUC’s manual warns that if one of them lands in a subprogram on its own, for example by copying lines, palletizing won’t run normally. The fix is to delete them and teach the palletizing instruction again.

A FANUC palletizing program example, line by line

A simple routine for a 4 × 3 × 5 pallet (four rows, three columns, five layers) that places one case each time it runs:

Line Instruction What it does
1 WAIT DI[101:CASE READY]=ON Waits for a case at the end of the infeed
2–5 J P[1:ABOVE PICK] 100% CNT50, L P[2:PICK] 500mm/sec FINE, CALL GRIP_CLOSE, L P[1:ABOVE PICK] 1000mm/sec CNT50 An ordinary pick, nothing specific to palletizing
6 PALLETIZING-EX_1 Reads PL[1] and fills in this case’s stack point and path
7 J PAL_1[A_2] 100% CNT50 Travel height over the stack, as a joint move (see case orientation below)
8 L PAL_1[A_1] 1000mm/sec CNT10 Just above the case’s spot
9 L PAL_1[BTM] 200mm/sec FINE Sets the case down. FINE, so the robot reaches the point instead of rounding past it
10 CALL GRIP_OPEN Lets go
11–12 L PAL_1[R_1] 1000mm/sec CNT10, J PAL_1[R_2] 100% CNT50 Straight up off the case, then back to travel height
13 IF PL[1]=[4,3,5],JMP LBL[9] Checks for the last case on the pallet
14 PALLETIZING-END_1 Steps PL[1] to the next spot
15 END Done with this case
16–18 LBL[9], DO[102:PALLET FULL]=ON, PL[1]=[1,1,1] Tells the PLC the pallet is full and resets the count

The speeds and CNT values are placeholders, tuned on the real cell with real cases. The pallet change itself belongs to the PLC and safety logic, which are left out here. So is the payload switch as each case is picked and released, covered in our FANUC payload setting guide.

Yellow FANUC robot holding a tall corrugated case upright above a vertical fixture with green product standing on end in it, inside a cell with green-painted frames and mesh guarding
Fig. 1The robot holds a case upright above the fixture, with the product standing on end below it. Temecula, CA.
Yellow FANUC robot carrying a tall corrugated case tilted sideways as it swings from the pick station toward the pallet
Fig. 2Mid-swing, the case tilted on its way from the line to the pallet. Temecula, CA.

Palletizing with position registers instead of the PALLETIZING instruction

Plenty of palletizing programs never use J500. The programmer teaches one corner of the pallet, counts rows, columns and layers in ordinary registers, and works out each case’s offset from the case size. It’s the usual route on a controller without the Palletizing option, for a plain grid of identical cases, or when the pattern is built in logic, for example from case dimensions the PLC sends with each product.

Here is the same 4 × 3 × 5 pallet, starting after the pick in lines 1 to 5 above. The counters start at 0, so each offset is just the count times the case pitch.

Line Instruction What it does
1 UFRAME_NUM=2 Selects a user frame taught on the pallet corner, with X along the rows and Y along the columns
2 PR[10:CASE OFS]=LPOS-LPOS Clears the offset register to zeros, so the case keeps the orientation taught at the origin
3–5 PR[10,1:CASE OFS]=R[1:ROW]*R[11:ROW PITCH], PR[10,2:CASE OFS]=R[2:COL]*R[12:COL PITCH], PR[10,3:CASE OFS]=R[3:LAYER]*R[13:CASE HT] X, Y and Z offsets: each count times the case pitch in that direction, which for Z is the case height
6–7 PR[11:ABOVE OFS]=PR[10:CASE OFS], PR[11,3:ABOVE OFS]=PR[10,3:CASE OFS]+150 The same spot 150 mm higher, for the approach and the retract
8 LOCK PREG Locks the position registers so the controller can look ahead through the moves that use them
9 J PR[1:PALLET ORIGIN] 100% CNT50 Offset,PR[11:ABOVE OFS] Over the case’s spot. PR[1] is taught once, with a case in the gripper set down in the first corner
10–12 L PR[1:PALLET ORIGIN] 200mm/sec FINE Offset,PR[10:CASE OFS], CALL GRIP_OPEN, L PR[1:PALLET ORIGIN] 1000mm/sec CNT10 Offset,PR[11:ABOVE OFS] Sets the case down, lets go and backs straight up
13–15 UNLOCK PREG, R[1:ROW]=R[1:ROW]+1, IF R[1:ROW]<4,JMP LBL[9] Counts the case. While the row count is under 4, this cycle ends here
16–21 R[1:ROW]=0, R[2:COL]=R[2:COL]+1, IF R[2:COL]<3,JMP LBL[9], then the same for R[3:LAYER] against 5 Rolls the count over in the same order as the example above: rows first, then columns, then layers
22–24 R[3:LAYER]=0, DO[102:PALLET FULL]=ON, LBL[9] Resets the layer count and tells the PLC the pallet is full

The 150 mm, the speeds and the CNT values are placeholders again. If a main program calls this routine, keep the UNLOCK PREG. The lock only clears by itself when the program that set it ends, and line 2 can’t write to a locked register on the next case.

Because the offsets are applied in a user frame, this version can do one thing the palletizing instructions can’t. If a pallet station moves, re-teach the frame and every case position moves with it. Palletizing instructions are always taught in the world frame, as the user frame question under common questions explains.

What it gives up is everything the option does for you: split posture, layer patterns, path patterns matched to positions, and the pendant screens for checking a pattern spot by spot. A case that turns partway through a layer, or a layer laid out differently from the one below, becomes more logic to write and test. The three counters do the job of the pallet register, so they need the same care when a case is pulled off by hand or a pallet restarts partway.

Stack patterns and layers

With the palletizing instructions, the first choice is the palletizing type, which sets what the pattern can do. FANUC’s manual teaches EX in full and treats the other three as restricted versions of it.

Type How positions are taught Case orientation Layer patterns Path patterns
B 2-point teaching Same for every case No 1
BX 2-point teaching Same for every case No Up to 16
E 2-point, all-point or interval Fixed or split Yes 1
EX 2-point, all-point or interval Fixed or split Yes Up to 16

Selecting the instruction opens the initial data screen, where the pattern is described before any point is taught:

  • TYPE is PALLET to stack or DEPALLET to unstack. INCR is how far the register steps each time, normally 1.
  • PAL REG is the pallet register this pattern uses.
  • ORDER is the stacking order. With RCL the row number counts up first, then the column, then the layer.
  • ROWS, COLUMNS and LAYERS take 1 to 127 each, plus a teaching method for each direction (LINE for 2-point, FREE for all-point, or a spacing in millimeters) and a posture setting.
  • APPR and RTRT set the number of approach and retract points. PATTERN sets the number of path patterns on BX and EX.

Then the pendant asks for the bottom points. For the 4 × 3 × 5 example with 2-point teaching that is four positions: P[1,1,1], P[4,1,1], P[1,3,1] and P[1,1,5]. Jog to each with a case in the gripper and record it, and the controller calculates every position in between. Interval specification suits uniform cases: teach the two ends and enter the spacing. All-point teaching records every point in a direction, for cases that don’t sit on an even grid. A first layer whose outline is a trapezoid rather than a rectangle or parallelogram takes a fifth, auxiliary point (AUXILIARY POS = YES).

Bottom points and path points are always taught in the world frame, with user frame 0, and a program with palletizing instructions can’t use the coordinate system change shift function. If a pallet station moves, plan on touching up the points rather than shifting a frame.

Layer patterns and interlocked loads

Many loads are interlocked rather than stacked in straight columns: alternate layers are laid out differently so the layers tie together. E and EX do this with layer patterns. With a layer pattern count of 2, layers 1, 3 and 5 use pattern 1 and layers 2 and 4 use pattern 2. Up to 16 layer patterns can be set, and they need 2-point teaching in the layer direction.

Where a layer holds fewer cases than the one below it, the manual tests the register before the move. IF PL[1]=[5,*,2-0],JMP LBL[2] skips row 5 on even layers: the asterisk matches any column, and 2-0 means a layer number that leaves 0 when divided by 2.

The palletizing instructions don’t place slip sheets or tier sheets. If a load needs one between layers, that is a separate routine the program calls when the layer changes.

Palletizing function limits
ControllersR-30iB and R-30iB Plus
Palletizing data1 to 16 per program
Pallet registersPL[1] to PL[32]
Rows, columns, layers1 to 127 each
Approach and retract points0 to 8 each, per path pattern
Path patternsUp to 16 (BX and EX)
Layer patternsUp to 16 (E and EX)
Motion types on PAL linesJoint and linear only; no circular, arc or spline
SourceFANUC operator's manual B-83284EN/12

Approach and retract points around the stack

Each case needs a way into its spot that misses the cases already placed, and a way out that doesn’t drag the one just released. The approach points (A_n) and retract points (R_n) are taught once, around a stack point, and the controller moves them with the stack point for every case after that. A path that works for many cases on a flat pallet:

  1. A_2 at travel height, far enough above the current layer that the case clears everything on it.
  2. A_1 a short distance above the spot and offset away from the cases already placed, so the case comes down at a slight angle into its corner instead of scraping past its neighbor.
  3. BTM at the stack point, taught with a real case, on a FINE move.
  4. R_1 straight up, until the gripper is clear of the case.
  5. R_2 back at travel height.
Yellow FANUC robot setting a tall case down on end, still tilted, beside a case already standing at the edge of the pallet
Fig. 3Setting a case down beside the one already placed. Temecula, CA.

One path seldom suits every spot. A case going into the far corner may need to come in from a different side than one next to the robot. BX and EX match up to 16 path patterns to stack points with conditions such as PTN[1]=[*,1,*] (every case in column 1) or [*,*,2-1] (odd layers). If a stack point matches no condition, the controller alarms. With the cursor on the palletizing instruction, F5, LIST shows the current bottom point, register value and path pattern, which makes checking a pattern position by position much quicker.

The manual also rules out circular, arc and spline motion on palletizing motion lines, and says not to add the Time Before function to them. Look at the top layer separately. The approach points rise with the stack, so the last layer is where a pattern runs into the robot’s reach, the guarding or the building.

How do you turn a case in a FANUC palletizing program?

In the Temecula cells, every case is gripped off the line, turned and swung onto the pallet, then placed to the stack pattern layer by layer (Figs. 1 to 3). When the robot turns the case on the way over, the conveyor doesn’t need a turning device. With the palletizing instructions, each case’s orientation comes from posture control:

  • Fixed posture (FIX on the pendant) gives every case the orientation taught at P[1,1,1]. B and BX always work this way.
  • Split posture (INTER), on E and EX, divides the orientation between the two taught end points in 2-point teaching. In all-point teaching, each case takes the orientation taught at its own point.

For cases in one layer that face different ways, such as a row turned 90 degrees to tie the layer together, all-point teaching with split posture is the usual route. Layer patterns handle a whole layer turning.

Turning a case can also change the robot’s configuration between stack points, such as a wrist flip or a different J6 turn. FANUC’s palletizing all-point teaching function keeps each taught point’s configuration when the system variable $PALCFG.$FREE_CFG_EN is TRUE (the default) and a direction set to FREE has its posture set to INTER. Only one direction can be set up this way. The approach and retract points take the stack point’s configuration, so a linear first move can stop on a configuration mismatch alarm. That is why the manual recommends a joint move first, as on line 7 of the example.

Choose the direction of each turn so the wrist doesn’t wind up the gripper’s hoses and cables over a full pallet. If the plant wants labels facing out, that decides the orientations, so get a photo of a finished pallet before teaching anything. The gripper matters here too; our end-of-arm tooling page covers how we design and machine grippers in-house.

How do you change or add a stack pattern?

With the palletizing instructions, put the cursor on the instruction and press F1, MODIFY, which opens the CONFIG, BOTTOM, PATTERN and ROUTE screens. Finishing a change to the initial data (CONFIG) re-initializes the pallet register, so make that kind of change between pallets.

Because each program carries its own palletizing data, one manageable layout is a program per product or pattern, with the PLC sending a recipe number that tells the main program which one to call. The PLC can also start that main program through the robot’s UOP inputs. A new pattern is then a new program and a new entry in the recipe list.

The register is also what gets corrected when a case is pulled off by hand or a pallet restarts partway. It can be set from a program, as in PL[1]=[1,2,3], or on the DATA screen under Pallet Register, and FANUC’s manual warns against changing one before checking how the program uses it. That correction belongs on the operator screen, designed in from the start, with the robot and the PLC logic agreeing on who owns the count. Our custom HMI page covers how we build those screens.

FANUC PalletTool and PalletPRO

For lines that change products often, FANUC sells PalletTool, application software built for palletizing. With PalletTool 3, operators create, edit and compare pallet patterns on the tablet teach pendant. FANUC says the operator can enter the product dimensions and get a list of possible patterns, with the space efficiency of each. PalletPRO, PC simulation software that FANUC describes as a plugin to ROBOGUIDE, lays out the cell and builds unit loads on a PC, and that data can be loaded onto a controller running PalletTool.

Which route fits depends on how many SKUs share the line and whether the crew or a programmer adds patterns. It’s worth settling in the design review, because it shapes both the robot program and the screens. The robotic palletizing page covers what else gets decided there.

Before a new pattern runs at speed

  1. Step through the first layer in T1 with a real case, watching every approach and place
  2. Check the top layer for reach and for clearance to the guarding
  3. Run every position that uses a different path pattern at least once
  4. Stop partway, correct the register, and check that the restart puts the next case in the right spot

The cells behind the photos

The photos come from a plant in Temecula, CA, belonging to a national lawn and garden brand, where FANUC robots build the pallets at the end of each packaging line. We designed, fabricated, wired and programmed the cells in our Fontana shop, then installed and commissioned them on the plant’s live production floor. The Temecula palletizing case study covers the job, and FANUC robot programming covers how we write and tune robot programs.

If your line still ends at a pallet stacked by hand, include a photo of a finished pallet and the case sizes when you send us a project note.

Common questions

What is the difference between PALLETIZING-B, BX, E and EX?
B and BX handle simple patterns taught from corner points, with every case in the same orientation. E and EX add all-point teaching, interval spacing, layer patterns and split posture, so a case can face a different way from one position or layer to the next. The X versions allow up to 16 path patterns, so different spots on the pallet can use different approach and retract paths. B and E have one path pattern.
Do you need PalletTool to palletize with a FANUC robot?
No. The controller's Palletizing option adds the palletizing instructions, pallet registers and pattern teaching screens to the regular teach pendant editor, and a cell with a few fixed patterns can run on that. Some programmers skip it and calculate offsets in registers instead. PalletTool is FANUC's dedicated palletizing software, built around stored unit loads, and PalletTool 3 lets operators edit patterns on the tablet teach pendant. It suits cells whose products change often.
What does the pallet register PL hold?
Three numbers: the row, column and layer of the next case. The palletizing instruction reads it to work out the stack point and path, and PALLETIZING-END steps it on to the next position in the order set for the pattern. A program can set it, for example PL[1]=[1,1,1] for an empty pallet, and IF statements can test it to skip a position or catch the last case on the pallet.
Why does a palletizing program stop on a configuration mismatch alarm?
The approach and retract points take their configuration from the stack point. If the robot arrives in a different configuration and the first palletizing move is linear, the controller cannot make that move in a straight line and stops. FANUC's manual recommends making the first palletizing motion a joint move. It is most likely in patterns that turn cases, since the wrist configuration can change from one stack point to the next.
Can a palletizing pattern be shifted with a user frame?
Not with FANUC's palletizing instructions. The operator's manual says bottom points and path points are always taught in the world frame, with user frame 0, and a program containing palletizing instructions cannot use the coordinate system change shift function. If a pallet station is moved, touch up the bottom points and path points through the MODIFY menu on the palletizing instruction.

Sources

  1. FANUC America: PalletTool 3
  2. FANUC America: Palletizing and depalletizing robots (PalletTool and PalletPRO)
  3. FANUC America: ROBOGUIDE robot simulation software (PalletPRO)
  4. FANUC Tech Transfer: What is PalletTool 3?
  5. FANUC America: Robot support and manuals (R-30iB and R-30iB Plus Operator's Manual, Basic Function, B-83284EN, which covers HandlingTool: palletizing, position register, Offset,PR[] and LOCK PREG instructions; via the Customer Resource Center)

Start a project

Bring us the process. We'll bring the cell.

Send a phone video of the manual process, or a part drawing, by text or email. We come back with a cell concept and a plan: robot, tooling, controls and code.

Call or text
Call or text
(818) 397-4809
Email
sales@calwestmfg.com
Shop
13815 Arrow Rte, Fontana, CA 92335
Hours
Mon–Fri 7:00am – 3:45pm

FANUC Authorized System Integrator (ASI). Part of CalWest Manufacturing, founded 2012: AS9100D and ISO 9001 certified, ITAR registered.