60
List Constant:
A list is a collection of constants. The length of a list is arbitrary. The list supports
only arithmetic constant. [680.760, 185.767, 372.607, -130.145, 33.706, 154.567],
for example.
The main role of list constants in the system is to initialize the array when the array
is defined. List constants also can be arguments transfer to functions or assign
values to an array of the same length.
String Constant:
A string constant is a collection of characters. It ends with ‘\0’. The length of a
string constant is the number of characters in the constant plus one. For example,
"siasun robot", a string constant, actually contains 13 characters. String constants
can be used to define character array variables or used as arguments transfer to
functions.
Special constants:
[POSE] is a special constant. The elements of it have the same value of 0. It is used
for the pose variable initialization or parameter assignment.
8.2.3 Variables
A variable is usually represented by a unique identifier in the system.
Common Variables
a = 123;
# a is an int variable. It is initialized to 123.
b = 11.23;
# b is a float variable. It is initialized to 11.23.
c = True;
# c is an int variable. It is initialized to 1.
d = False;
# d is an int variable. It is initialized to 0.
Pose Variable
The pose type is an array with 6 float data that represent the pose of the joint of the
robot.
p = [POSE];
# p is a pose variable. It is initialized to all 0.
p = [1, 2, 3, 4, 5, 6]; # p is a pose variable. It is initialize [1,2,3,4,5,6].
p = [1, 2];
# p is a pose variable. It is initialize [1,2,0,0,0,0].
After using [ ] to define a variable, the variable is of
Pose type, its length is six and is not changed by the
length of the initial definition list. Please pay attention
while using [ ].
String Variable
s = “siasun”;
# s is a string variable and has a length of 7, including the terminating '\0’ character.
Array Variable
a1 = Array(8, INT);