API. CONTROLLER

The API.CONTROLLER class provides a set of interfaces for managing and monitoring the robot controller's motor status, operation modes,and other. It includes methods for subscribing to motor status, retrieving the current state or operation mode, and performing actions such as setting motor states or restarting the controller. This class serves as a high-level abstraction for interacting with the robot controller.

Members

(readonly) OPMODE :string

Type:
  • string
Properties
NameTypeDescription
Autoenum

Auto mode

Manualenum

Manual mode

ManualRenum

Manual reduce speed mode

ManualFullenum

Manual full speed mode

Autostring
Manualstring
ManualRstring
ManualFullstring

(readonly) STATE :string

Type:
  • string
Properties
NameTypeDescription
Initenum

The controller is starting up.

MotorsOnenum

Motor on state.

MotorsOffenum

Motor off state.

GuardStopSenum

Stopped due to safety reasons.

EStopenum

Emergency stop state.

EStopRenum

Emergency stop state resetting.

SysFailureenum

System failure.

Initstring
MotorsOnstring
MotorsOffstring
GuardStopstring
EStopstring
EStopRstring
SysFailurestring

(readonly) STATE :string

Type:
  • string
Properties
NameTypeDescription
IRB14050string
IRB1100string
IRB910string
CRB1100string
CRB15000string
IRB1300string
CRB1300string

ctrlState

Properties
NameTypeDescription
ctrlStatestring

The current state of the controller. This property is available only after calling API.CONTROLLER.monitorController().

isAuto

Properties
NameTypeDescription
isAutoboolean

Value "true" indicates that the operation mode is Auto mode. In other cases, the value is "false". This property is available only after calling API.CONTROLLER.monitorController()

isManual

Properties
NameTypeDescription
isManualboolean

true if operation mode is manual reduced speed mode, false otherwiseValue "true" indicates that the operation mode is manual reduce. In other cases, the value is "false". This property is available only after calling API.CONTROLLER.monitorController()

isMotOn

Properties
NameTypeDescription
isMotOnboolean

Value "true" indicates that motors are on. In other cases, the value is "false". This property is available only after calling API.CONTROLLER.monitorController().

opMode

Properties
NameTypeDescription
opModeboolean

Stores the operation mode. This property is available only after calling API.CONTROLLER.monitorController()

Methods

checkIfMotorIsOn() → {Promise.<boolean>}

Check whether motor is on

Returns:

A promise with a boolean containing if motor is in on status.

Type: 
Promise.<boolean>
Example
let motorStatus = await API.CONTROLLER.checkIfMotorIsOn()

getControllerState() → {Promise.<RWS.Controller.ControllerStates>}

Gets the controller state. Possible states are:
 'initializing' the controller is starting up
 'motors_on' motors on state
 'motors_off' motors off state
 'guard_stop' stopped due to safety
 'emergency_stop' emergency stop state
 'emergency_stop_resetting' emergency stop state resetting
 'system_failure' system failure state

Returns:

A promise with a string containing the controller state.

Type: 
Promise.<RWS.Controller.ControllerStates>
Example
let controllerState = await API.CONTROLLER.getControllerState()

getLanguage() → {Promise.<string>}

Gets the current language

Returns:
Type: 
Promise.<string>
Example
await API.CONTROLLER.getLanguage()

getOperationMode() → {Promise.<RWS.Controller.OperationModes>}

Gets the operation mode. Possible modes are:
 'initializing' controller is starting up, but not yet ready
 'automatic_changing' automatic mode requested
 'manual_full_changing' manual full speed mode requested
 'manual_reduced' manual reduced speed mode
 'manual_full' manual full speed mode
 'automatic' automatic mode
 'undefined' undefined

Returns:

A promise with a string containing the operation mode.

Type: 
Promise.<RWS.Controller.OperationModes>
Example
let opMode = await API.CONTROLLER.getOperationMode()

getRobotType() → {Promise.<string>}

Gets the robot type. For example, CRB 15000-5/0.95.

Returns:

A promise object with a string presenting the robot type.

Type: 
Promise.<string>
Example
let robotType = await API.CONTROLLER.getRobotType()

isSAY() → {Promise.<boolean>}

Check whether the connected robot is IRB 14050

Returns:

A promise object with a boolean value indicating whether the robot is IRB 14050.

Type: 
Promise.<boolean>
Example
let isSAY = await API.CONTROLLER.isSAY()

monitorControllerState(callbackopt)

Subscribes to 'controller-state' and 'operation-mode'. Current state is stored in ctrlState. Additionally, isMotOn is updated with the corresponding value.

Parameters:
NameTypeAttributesDescription
callbackfunction<optional>

Callback function is called when controller state changes

Example
// The callback will be executed when motor status is changed
const motorStatus = (value)=>{console.log("motor status is:",value);}
await API.CONTROLLER.monitorControllerState(motorStatus);

monitorOperationMode(callbackopt)

Subscribes to 'operation-mode'. Current state is stored in opMode. Additionally, isManReduced is updated with the corresponding value.

Parameters:
NameTypeAttributesDescription
callbackfunction<optional>

Callback function is called when operation mode changes

Example
// The callback will be executed when operation mode is changed
const opMode = (value)=>{console.log("operation mode is:",value);}
await API.CONTROLLER.monitorOperationMode(opMode);

restart(modeopt) → {Promise.<{}>}

Restarts the controller. Possible modes are:
 'restart' normal warm start
 'shutdown' shut down the controller
 'boot_application' start boot application
 'reset_system' reset system
 'reset_rapid' reset Rapid
 'revert_to_auto' revert to last auto-save
 NOTE! An enum ‘RWS.Controller.RestartModes’ with the valid values is provided for ease of use.

Parameters:
NameTypeAttributesDescription
mode<optional>

The parameter 'mode" indicates the type of the restart that is requested.

Returns:
Type: 
Promise.<{}>
Example
await API.CONTROLLER.restart()

setMotorsState(state)

Sets motor status to on/off This interface is not valid for SPOC system, e.g., RobotWare 8. With SPOC system, Manual mode: press enable device to set motor on Auto mode: long press physical thumb button on FlexPendant, or trigger specific Safety input.

Parameters:
NameTypeDescription
stateAPI.CONTROLLER.STATE

The motor status to be set

Example
// Set motor on
await API.CONTROLLER.setMotorsState(API.CONTROLLER.STATE.MotorsOn)

setOpMode(mode)

Set operation mode to a specific mode.

Parameters:
NameTypeDescription
modeAPI.CONTROLLER.OPMODE

The operation mode to be set

Example
// Set the operation mode to Auto mode
await API.CONTROLLER.setOpMode(API.CONTROLLER.OPMODE.Auto)

setOpModeAutomatic()

Sets the operation mode to Auto mode

Example
await API.CONTROLLER.setOpModeAutomatic()

setOpModeManual()

Sets the operation mode to Manual mode

Example
await API.CONTROLLER.setOpModeManual()