The basic concepts, operation methods and management methods of constants and variables in KUKA robot programming, including the immutability and declaration steps of constants, the variability of variables and their naming conventions, data types, lifetime and validity, and how to display and modify variable values in the KUKA robot control system, provide basic guidance for understanding and using robot programming languages.
In KUKA robot programming, constants and variables play crucial roles. Constants are fixed values that remain unchanging throughout the program, like the acceleration limits of the robot. They provide stability and standardization. Variables, on the other hand, can store different values that may change during program execution. For example, a variable can hold the position data updated in real-time. They offer flexibility and adaptability in programming.
- Constants
A constant refers to a value whose value cannot be changed during the operation of a robot program. Constants can be divided into numeric constants, character constants and symbolic constants, among which numeric constants include integer constants and real constants. The declaration of constants can only be established in the data list, and the keyword CONST must be used.
The steps to create constants are as follows:
Step 1: Open the DAT file in the editor
Step 2: Declare and initialize
Step 3: Close and save the data list
2 Variables
A variable refers to a quantity whose value can change during the operation of a robot program. There is a specially designated address in the memory of the robot control system to store the value of the variable.
(1) Naming conventions
When selecting variable names in the KRL language, be sure to follow the following naming conventions:
① The maximum length of a variable name is 24 characters;
② The variable name can only contain letters (A – Z), numbers (0 – 9) and special characters “_” and “$”;
③ The variable name cannot start with a number;
④ The variable name cannot be a keyword in the KRL language;
⑤ The KRL language is not case-sensitive.
(2) Data types
Variables can be divided into global variables and local variables according to the storage address allocation method. Global variables are variables that are valid in all programs of the entire robot control system. Local variables are variables that are valid only in the program in which they are declared and will disappear after the program to which they belong ends.
Variables can be divided into standard data types, array types, enumeration types, and compound data types according to the type of values stored.
Standard data (simple types): integer, real number, character, Boolean
Array: one-dimensional array, two-dimensional array, three-dimensional array
Enumeration: composed of a certain number of constants
Compound structure: a data structure composed of multiple data types
(3) Lifetime and validity
① Lifetime: the period of time that a variable is in the storage space
The lifetime is the time that the storage location is reserved for the variable.
Run-time variables will vacate their storage location when exiting the program or function (local)
Variables in the data list will permanently save the current (previous) value in its storage location (global)
②Validity: global variables and local variables
Locally declared variables are only available and visible in the declared program.
Global variables are created in a central (global) data list
Global variables can also be created in a local data list, and the keyword GLOBAL (global) is used when declaring them
(4) Variable application
The use of variables requires the following steps:
Variable declaration
Variable initialization
Variable operation
3 Variable display
The KUKA robot control system can monitor all variables (including system variables and user-defined variables), and variable values can be displayed and changed in the robot teach pendant. (1) Single variable display window
(2) Steps to display and change single variable values
Step 1: Click the “Menu” key and select “Display (①) > Variable (②) > Single (③)”
Step 2: Enter the variable name in the name column of the single variable display window (①)
Step 3: Select the “Update” key (②) to display the variable value in the current value column
Step 4: Enter the set new value in the new value column (①), hold down the “Enable” key, and select the “Set Value” key (②) to change the currently displayed variable value (③).