A practical guide to when FANUC Karel outperforms TP and vice versa. Covers file I/O, string handling, math operations, and real-world examples of hybrid Karel+TP programs.
FANUC robots have two native programming environments: TP (Teach Pendant) and Karel. Most integrators use TP exclusively — but Karel unlocks capabilities that TP simply cannot match. Knowing when to reach for each tool is what separates an intermediate programmer from an expert.
What Karel Can Do That TP Cannot
Karel-only capabilities:
- File I/O — read and write CSV, text, or custom data files on the controller flash drive
- String manipulation — parsing, concatenation, substring, number-to-string conversion
- Complex math — trigonometry, floating-point arithmetic beyond TP registers
- Program control — spawn TP programs, wait for completion, read their status
- Custom data structures — RECORD types, arrays, and typed variables
- PIPE communication — communicate with external devices via serial or TCP
When TP Wins
For motion, I/O, and anything an operator needs to read or modify on the teach pendant, TP is always the right choice. TP programs are visible in the pendant editor, have built-in position teaching, and are understood by every FANUC-trained technician. Karel programs are compiled binaries — operators cannot view or edit them without a PC and the Karel compiler.
A Real Example: CSV Recipe Loading
A palletizing cell uses 50 different product recipes. Each recipe defines layer patterns, product dimensions, and approach offsets. Storing this in TP registers is impractical — 50 × 10 values = 500 register writes every changeover. The solution: one Karel program reads the recipe CSV on startup and writes values to Numeric Registers, which the TP motion program then reads.
PROGRAM recipe_load
%NOLOCKGROUP
%NOPAUSE = COMMAND + TPENBL
VAR
f_id : FILE
fname : STRING[32]
val : REAL
i : INTEGER
status : INTEGER
BEGIN
fname = 'FR:RECIPE01.CSV'
OPEN FILE f_id ('RO', fname)
FOR i = 1 TO 10 DO
READ f_id (val)
SET_REG(i, val, status)
ENDFOR
CLOSE FILE f_id
END recipe_loadCalling Karel from TP
1: CALL RECIPE_LOAD ; ! Run Karel program
2: WAIT R[1]>0 ; ! Wait until R[1] populated
3: J P[1:HOME] 100% FINE ;Karel programs must be compiled with the Karel compiler (part of ROBOGUIDE or the standalone Karel Translator) and uploaded to the controller as .PC files before they can be called from TP.


