Skip to content

External Script Control API

1. Concept

The cooperative robot RB series can be operated for various environments and purposes. It can be used in conjunction with multiple RB series or other systems.
In conjunction with the vision system, movement coordinates can be changed in real time, or used as part of a user's existing system.

Users can control the robot with teaching pendant (tablet UI), but it provides a way to control the robot from any external controller for user’s convenience or operation.

The RB series receives script commands by default and executes those commands.
The task of writing a motion using the teaching pendant (tablet UI) and executing the script of the file in order is a general operation method. The following method described in this document is an alternative method of receiving a command script from another external device to control a robot of the RB series.

The control syntax provided in the teaching pendant/tablet UI can be implemented by the user directly from the external control device, and the robot operation commands/IO control commands are sent according to the user’s use case.

The following document describes an example of driving a robot with the above concepts.

2. External Control Script API

The description of the scripts provided in this document looks similar to the scripts in the “.wsl” work document, which is written using a tablet as a dedicated script for external control.
Work documents contain statements that control flows such as “repeat”, “if-else”, and “break”, so that the completion of a statement is not directly related to the action, and the parent sentence of that statement must be completed.

For example, suppose there are Point Functions in the Move command Function.

1 :

move joint {
    point ( ) absolute 0.4, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
    point ( ) absolute 0.4, 0.1, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0
}

2 :

move joint {
    point ( ) absolute 0.4, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
        point ( ) absolute 0.4, 0.1, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0

The difference between 1 and 2 is the presence or absence of “}” at the end.
In both cases, the point statement is complete. However, unlike 1, 2 is a syntax that cannot operate because the move statement, which is the parent of point, is not completed, and the parser will wait for the statement to complete.

3 :

folder( ) {
    move joint {
    point ( ) absolute 0.4, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
        point ( ) absolute 0.4, 0.1, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0
    }

In the same logic as above, the parser does not run because it waits for the folder statement to complete.

However, the above method is not suitable for external control method. The user expects the robot to operate by parsing the command the moment it sends it through external control. It does not send multiple commands and complete those lines of text like example 3.

So external control must be organized so that each command is sent separately as a string.
External control does cannot access any features that control the flow.
Commands such as "repeat", "if-else", "break" or "wait" in the work document will not be available externally and must be replaced by the same structure and logic within the external control.

First of all, the script I will explain is initialization, termination, and operation mode change.

  1. mc :
Scriptmc jall init
Descript.This command starts initialization process
Example“mc jall init”
  1. shutdonw :
Scriptshutdown
Descript.This command terminates the robot operation and turns off the power.
Example“shutdown”
  1. pgmode :
Scriptpgmode mode_type
Descript.This command changes the mode between real and simulation modes.

The operation mode is selected through mode_type.
There are two operation modes: 'real' and 'simulation'.
In 'real', the robot physically moves when a motion command is issued.
In 'simulation', when a motion command is issued,
only the internal reference is changed, and the command does not move the robot.

When the robot is first initialized, the default mode is 'simulation' mode.
Example “pgmode real”
“pgmode simulation”

The last command explained is the task script.

task

Scripttask load work_file_name
Descript.This command loads a work file previously programmed.

The work_file_name uses the name of the '.wsl' file.
At this time, the '.wsl' extension should be omitted,
and only the relative path and name of the file should be entered.

This file is not one that exists on the pendant,
but rather a file that has been loaded or saved to the control panel at least once through the pendant.
Therefore, it is possible to load the file even if the pendant is not connected.
Example “task load test_file”
Scripttask play option
Descript.This command runs the work file loaded.

The input value for option is blank or “once”.
When option leaves empty, it runs the work file repeatably until the number of repeatation is met.
When “once” is set, it runs the work file once.
Example “task play”
“task play once”
Scripttask repeat num
Descript.This command sets the number of repeatation for the work file.

The input value for num is the number of repeatation. The number should be an integer.
-1 can be used to run the work file unlimitedly.

The number of repeatation set by this command is maintained until power off.
After rebooting the robot, this value is set by a number in the pendent.
Example “task repeat 5”
“task repeat -1”
Scripttask pause
Descript.This command pauses the robot operation that is currently in progress.

It can be used for all work files that are running due to external control commands and the "task play" command.

In a paused state, the operation can be resumed using the "task resume_a" command.

When the robot is in a paused state, it is not considered as finished,
so any other operation commands from external control will be ignored.
Example “task pause”
Scripttask stop
Descript.This command stops the robot operation that is currently in progress.

It can be used for all work files that are running due to external control commands and the "task play" command.

Once the operation is stopped, it will not resume with "task resume_a."
The operation is completely terminated.

When the stop command is issued, the robot may abruptly halt if it was moving quickly.
It is recommended to perform the "task stop" command after "task pause."
Example “task pause”
Scripttask resume_a
Descript.This command resumes the operation of the robot that was paused by the "task pause" command or by an alarm or debug command in the work file.
Example “task resume_a”
Scripttask resume_b
Descript.This command resumes the operation of the robot that was paused due to external collision detection.
Example “task resume_b”

In order to use external control, the external computer must be connected to the control box.

The connection uses TCP / IP communication and the corresponding IP address can be set in the pendant. The result is displayed on the screen on control panel.

Ports 5000 and 5001 open for external control.
Port 5000 is a port for receiving commands, and port 5001 is a port for requesting and sending data indicating robot status.
For convenience, port 5000 is called the command port and port 5001 is called the data port.

Users can send the script command described above to the command port.
The command port has a filter for the first command, so if it does not start with a previously described script command like "mc" or "pgmode," it will respond with the message "The command is not allowed." When a valid command is properly formatted and passed to the parser, the response will be "The command was executed."

Additionally, for more diverse script commands, please refer to Technical Docs > RB/Ui Script.

For the data port, sending the command "reqdata" will return information about the current robot status through the data port. Please refer to the Technical Docs > Request Data Structure manual for more details.