Control API
The Control API provides URScript methods for controlling the robot arm state and main program lifecycle. Use it to power the arm on and off, release brakes, unlock protective stops, restart the safety system, start, pause, and stop the main program, and query the current robot state.
Control API methods are available in the main program, the Logic Program, and in threads. The primary use case is calling Control API methods from the Logic Program to control the main program — for example, an automatic startup routine that powers on the robot, starts the main program, monitors its state, and recovers from errors.
Methods that change the robot state require the robot to be in remote control mode and return -1 if the robot is in local mode. State query methods work in both local and remote control mode.
A successful return value of 0 means the Control API accepted the command. It does not mean the physical action has completed. For example, arm_power_on() returns 0 when the command is acknowledged, but the arm may take several seconds to fully power on. Use state query methods to verify the actual state before proceeding.
control_api_factory(source="")
Creates a new Control API handle. Methods are invoked on the handle using the . operator.
Parameters
source: Optional string label identifying the control source for auditing purposes. Default is an empty string.
Return Value
A Control API handle object.
Example 1 handle = control_api_factory()
Example 2 handle = control_api_factory(source="my_logic_program")
Error codes
All action methods return an integer error code. State query methods return their respective values on success, or -100 on failure.
| Code | Meaning |
|---|---|
0
|
Success |
-1
|
Robot is not in remote control mode |
-2
|
Precondition conflict (for example, powering on when already powered, or starting a program that is already running) |
-100
|
Other error (for example, network failure or precondition not met). Check the robot log for detailed diagnostics. |