It is often necessary to call multiple robot functions, and they must be performed by a single robot as a predetermined sequence of actions. If the required sequence of functions is called as described above, in case of robots of several classes it is likely that the specified functions will be performed by different robots. If there is a single robot of a given class available, it every time will be engaged and released for each function.

The most effective and rational is to engage a robot once and send commands to it as necessary and then release it, thus implementing a session of robot operation. This requires engaging a robot of the required class and remembering connection to a specific robot engaged. This can be done by saving the robot in a special type of variables with “@” character before the identifier. For example, we engage the robot of test class, and save connection with the specific robot in @r variable:

@r = robot_test;

Reaching such a structure, the interpreter, as in case of a robot function call, will send a request to engage the robot, but now the robot will not be released until the command to release this certain robot is reached.

Now, to call the function of this engaged robot, we need to call the function by applying to this variable, not to the robot class. For example, calling the same do_something function of this robot with the same parameters:

@r->do_something(1000);

After performing this function, the robot will remain engaged, and we can call the next function of this robot.

It is not allowed to use specific variables with @ character in the context of RCML expressions. They can not participate in operations, comparisons and be transferred as arguments to functions (except for hand_control system function). However, a robot can be assigned to another variable of the same type, i.e. communication with the engaged robot can be saved in several variables, for example:

@r = robot_test;
@r2 = @r;
@r4 = @r3 = @r2;

As a result, all variables @r, @r2, @r3 and @r4 will be attributed to the same robot.

The variable already attributed to a specific robot can be assigned with a pointer to a completely different robot, or even a different robot class:

@r = robot_test;
@r2 = @r;
@r = robot_tarakan;

Now @r is attributed to a robot of tarakan class, and @r2 is attributed to a robot of test class. Note that when you change the robot which the variable is attributed to, the robot which it was attributed to previously, will not be released.