A practical introduction to ABB RAPID programming. Learn the MODULE structure, PROC and FUNC, MoveJ/MoveL/MoveC motion types, data types, and how to write a complete pick-and-place routine.
RAPID is ABB's robot programming language, and it is more expressive than FANUC TP. Where TP is a line-numbered instruction list, RAPID is a structured language with modules, procedures, functions, typed variables, and control flow. If you have programmed in Pascal or C, RAPID will feel immediately familiar.
RAPID Program Structure
A RAPID program consists of MODULEs. Each module contains data declarations (VAR, CONST, PERS) and routines (PROC, FUNC, TRAP). The entry point is always a PROC named `main`.
MODULE MainModule
! Persistent variable — survives power cycle
PERS num partCount := 0;
PROC main()
! Main entry point
MoveAbsJ homePos, v100, fine, tool0;
WHILE TRUE DO
PickPart;
PlacePart;
partCount := partCount + 1;
ENDWHILE
ENDPROC
PROC PickPart()
MoveJ approachPick, v500, z50, gripper;
MoveL pickPos, v100, fine, gripper;
SetDO DO_GripperClose, 1;
WaitTime 0.5;
MoveL approachPick, v200, z50, gripper;
ENDPROC
PROC PlacePart()
MoveJ approachPlace, v500, z50, gripper;
MoveL placePos, v100, fine, gripper;
SetDO DO_GripperClose, 0;
WaitTime 0.3;
MoveL approachPlace, v200, z50, gripper;
ENDPROC
ENDMODULEMotion Instructions
The three core motion types:
- MoveJ — joint motion, fastest, non-linear path. Use for repositioning between operations
- MoveL — linear TCP motion. Use for approach and departure moves near fixtures
- MoveC — circular arc through a midpoint. Use for arc welding, dispensing, sealing
Zone Data: z0, z5, z50, fine
Zone data controls path blending — how closely the TCP passes through a point before moving toward the next. `fine` means the robot stops exactly at the point. `z50` means the robot starts moving toward the next point when the TCP is within 50mm of this point. Use `fine` for picks, places, and contact. Use `z50` or larger for intermediate waypoints.
RAPID is compiled and checked by RobotStudio or the FlexPendant editor. Syntax errors are caught before execution. Always compile and simulate in RobotStudio before uploading to a real robot.


