FANUC - CNC Machine News and Articles

Understanding the FANUC Robot Programming Language

The Development of KAREL

KAREL (pronounced “Carl”) was initially used as an educational tool to teach the elements of programming language to students studying robotics. KAREL has since become a primary FANUC programming language used with robots and robot controllers. This powerful CNC programming language has tremendous capabilities.

Here, we’ll cast broad strokes and explain how KAREL works to help you begin to grasp the intricacies of FANUC robot programming.

How Does FANUC Programming Language Work?

The KAREL World

KAREL is built upon a simple vocabulary of commands to accomplish specific programming tasks. The world – the “space” in which KAREL works – has intersections, walls and beepers to execute its programs within a defined space, made up of X and Y coordinates known as Streets (horizontal) and Avenues (vertical). If, for example, a KAREL program was comprised of 6 Streets and 5 Avenues, it would be written as:

World 6 5


Within KAREL’s world there are also beepers, which are indicated in KAREL’s programming with the Beepers command. Beepers are small objects placed at intersections of the Streets and Avenues which the robot can sense, and they can be picked up, moved, and set down by the robot when given the proper commands. If, for example, there are 2 beepers at intersection {4, 3} in World 6 5, it would be written as:

World 6 5
Beepers 4 3 2

Robot Command

The robot which moves around in KAREL’s world is defined with the Robot command, and it can face North, East, South, or West, as indicated by the commands 1, 2, 3 and 4 respectively. If, for example, the robot in World 6 5 would have a starting position at intersection {4, 3} while facing North (1), and there would be 0 beepers at that intersection, the program would be written as:

World 6 5
Beepers 4 3 2
Robot 4 3 1 0


Wall sections can also be set up at various points in KAREL’s world, as defined by the Wall command. Walls are only one block long, and can either be north or west of an intersection (indicated by a 1 or 4 respectively). If, for example, you wanted to place a horizontal wall directly North (1) of the intersection {2, 3} within World 6 5, the program would be written as:

World 6 5
Beepers 4 3 2
Robot 4 3 1 0
Wall 2 3 1

Running a KAREL Program

These four commands define the world in which KAREL lives – running a program is a different story. After establishing KAREL’s world, every program must begin and end with the same lines in order for it to be valid:





KAREL robot programs only understand five basic instructions: move (moves by one square in the direction it is facing), turnLeft (turns 90° left), putBeeper (puts a beeper on the square it is standing at), pickBeeper (lifts a beeper off the square it is standing at), and turnoff (the program ends). The simplest KAREL program needs to have at least 5 lines in it for it to be valid.

Example program of how to turn a KAREL program off:


If you’d like to learn more details about the KAREL language, check out the Computer Science Department of MTSU for a more in-depth analysis of KAREL and how it’s used in FANUC robotics.

The Benefits of Working with KAREL in FANUC Robots

The fundamental commands explained above are the basics of KAREL programming language, and robotics engineers all over the world have utilized these commands to develop more intricate programs for FANUC robots. KAREL can be used for advanced FANUC applications involving Ethernet communications, advanced logic processing, and data file manipulation through automatic positioning and programmable acceleration.

For FANUC Parts or Repairs, Contact Tri Star CNC Services

FANUC robotics must operate with extreme precision, relying not only on clean code but on perfect operation of the physical components within the CNC controls. Tri Star CNC Services provides superior FANUC repair and maintenance here at our McHenry, IL facility—or provide free over-the-phone support.

Contact the FANUC maintenance and repair experts at Tri Star today for affordable repair and exchange services.
4/7/2017 How Do FANUC Robots Work? 4/7/2017
3/3/2016 How Does a Servo Drive Work? 3/3/2016
Did you know this?
Setting Zero Return on Fanuc machines or any CNC Machine can sometimes be difficult. Each builder has their own way to set zero return through their own side of the control.

Accepting VISA  Accepting MasterCard

Accepting Discover  Accepting American Express

Tri Star CNC Services,  LLC BBB Business Review