Numbers, Variables, and Types

In URScript arithmetic expression syntax is standard:

1+2-3

4*5/6

(1+2)*3/(4-5)

2346.44 % 10

"Hello" + ", " + "World!"

In boolean expressions, boolean operators are spelled out:

True or False and (1 == 2)    1 > 2 or 3 != 4 xor 5 < -6

not 42 >= 87 and 87 <= 42

"Hello" != "World" and "abc" == "abc"

Variable assignment is done using the equal sign =:

foo = 42

bar = False or True and  not  False baz = 87-13/3.1415

hello = "Hello, World!" l = [1,2,4]

target = p[0.4,0.4,0.0,0.0,3.14159,0.0]

The fundamental type of a variable is deduced from the first assignment of the vari- able. In the example above foo is an int and bar is a bool. target is a pose: a combination of a position and orientation.

The fundamental types are:

  • none
  • bool
  • number - either int or float
  • pose
  • string

A pose is given as p[x,y,z,ax,ay,az], where x,y,z is the position of the TCP, and ax,ay,az is the orientation of the TCP, given in axis-angle notation.

Note that strings are fundamentally byte arrays without knowledge of the encoding used for the characters it contains. Therefore some string functions that may appear to operate on characters (e.g. str_len), actually operates on bytes and the result may not correspond to the expected one in case of string containing sequences of multi-byte or variable-length characters. Refer to the description of the single function for more details.