API. MOTION

The API.MOTION class provides a comprehensive set of interfaces for controlling and monitoring robot motion. It includes methods for jogging, aligning, and moving the robot to specific positions, as well as retrieving and setting tools, work objects, and coordinate systems. This class simplifies motion control operations, enabling developers to efficiently interact with and manage the robot's movement and positioning.

Members

(readonly) COORDS :string

Type:
  • string
Properties
NameTypeDescription
Wobjenum

The work object coordinate system

Baseenum

The Base coordinate system

Toolenum

The Tool coordinate system

Worldenum

The World coordinate system

Currentenum

The active coordinate system

Wobjstring
Basestring
Toolstring
Worldstring
Currentstring

(readonly) JOGMODE :string

Type:
  • string
Properties
NameTypeDescription
Alignstring
GoToPosstring
ConfigurationJogstring
Cartesianstring
AxisGroup1string
AxisGroup2string
Currentstring

(readonly) POSITIONTYPES :number

Type:
  • number
Properties
NameTypeDescription
robtargetnumber
jointtargetnumber

Methods

align(speedRatio, tool, wobj, coord) → {undefined|Promise.<{}>}

Performs align task Non-SPOC systems (e.g., RobotWare 7): The interface shall work when the two conditions are met:

  1. Operation mode is manual reduce mode
  2. User logins as local client SPOC systems (e.g., RobotWare 8): The interface shall work when the two conditions are met:
  3. Operation mode is manual reduce mode
  4. Write access is held
Parameters:
NameTypeDescription
speedRationumber

Align speed ratio, whose value range is 1 to 100.

toolAPI.MechUnits

If empty, use active tool as align tool

wobjAPI.MechUnits

If empty, use active wobj as align wobj

coordAPI.MechUnits

If empty, use active coord as align coord

Returns:
  • Resolves if aligning succeeds, rejects if fails
Type: 
undefined | Promise.<{}>
Example
await API.MOTION.align(10)

executeJogging(jogMode, optionsopt) → {Promise.<(object|void)>}

Jogs the robot Non-SPOC systems (e.g., RobotWare 7): The interface shall work when the two conditions are met:

  1. Operation mode is manual reduce mode
  2. User logins as local client SPOC systems (e.g., RobotWare 8): The interface shall work when the two conditions are met:
  3. Operation mode is manual reduce mode
  4. Write access is held
Parameters:
NameTypeAttributesDescription
jogModeJOGMODE

Jogging mode

optionsObject<optional>

Optional jogging options

Properties
NameTypeAttributesDefaultDescription
jogDataJogData<optional>
[500,500,500,500,500,500]

Jog speed/axis data

targetPositionRobTarget | JointTarget | null<optional>
null

Target position

toolstring<optional>
''

Tool identifier

wobjstring<optional>
''

Work object identifier

coordsCOORDS | string<optional>
''

Coordinate system

Returns:
  • Resolves if jogging succeeds, rejects if failure
Type: 
Promise.<(object|void)>
Example
// Perform aligning
await API.MOTION.executeJogging(API.MOTION.JOGMODE.Align)

getAxisNumber() → {Promise.<number>}

Gets the axis number of the robot.

Returns:

Axis number of the robot.

Type: 
Promise.<number>
Example
let axisNum = await API.MOTION.getAxisNumber()

getCoord() → {Promise.<string>}

Gets the current coordinate system

Returns:

A string describing the current coordinate system of the robot.

Type: 
Promise.<string>
Example
await API.MOTION.getCoord()

getRobotPosition() → {Promise.<object>}

Gets the current position of the robot

Returns:
  • An object containing current position of the robot
Type: 
Promise.<object>
Example
await API.MOTION.getRobotPosition()

getTool() → {Promise.<object>}

Gets the current tool

Returns:
  • Object containing current position of the robot
Type: 
Promise.<object>
Example
await API.MOTION.getTool()

getWobj() → {Promise.<object>}

Gets the active work object

Returns:
  • An object containing current position of the robot
Type: 
Promise.<object>
Example
await API.MOTION.getWobj()

goToPosition(speedRatio, targetPosition, tool, wobj, coord) → {undefined|Promise.<{}>}

Executes the GOTO task. Non-SPOC systems (e.g., RobotWare 7): The interface shall work when the two conditions are met:

  1. Operation mode is manual reduce mode
  2. User logins as local client SPOC systems (e.g., RobotWare 8): The interface shall work when the two conditions are met:
  3. Operation mode is manual reduce mode
  4. Write access is held
Parameters:
NameTypeDescription
speedRationumber

GOTO movement speed ratio, whose value range is 1 to 100.

targetPositionRobTarget | JointTarget

The target location of the GOTO task

toolAPI.MechUnits

If empty, use active tool as align tool

wobjAPI.MechUnits

If empty, use active wobj as align wobj

coordAPI.MechUnits

If empty, use active coord as align coord

Returns:
  • Resolves if the motion task is executed, rejects if failed
Type: 
undefined | Promise.<{}>
Example
let variableValue = await API.RAPID.getVariableValue("MainModule","pos1");
await API.MOTION.goToPosition(10, variableValue)

setTool(tool) → {Promise.<object>}

Sets the active tool to the specified value

Parameters:
NameTypeDescription
toolstring

Name of the tool

Returns:

Resolves if setting correctly, rejects if failed.

Type: 
Promise.<object>
Example
await API.MOTION.setTool("tool0")

setWobj(value) → {Promise.<object>}

Sets the active work object to the specified value.

Parameters:
NameTypeDescription
valuestring

Name of the work object.

Returns:

Resolves if setting correctly, rejects if failed.

Type: 
Promise.<object>
Example
await API.MOTION.setWobj("wobj0")

stopJogging() → {undefined|Promise.<{}>}

Stops any running jog

Returns:

Resolves if stopped correctly, rejects if failed.

Type: 
undefined | Promise.<{}>
Example
await API.MOTION.stopJogging()

teachPosition(type, tool, wobj, coords, mechunit) → {undefined|Promise.<{RobTarget}>|Promise.<{JointTarget}>}

Teaches a robot position.

Parameters:
NameTypeDescription
typeAPI.MOTION.POSITIONTYPES

Position type

toolstring

The tool used to teach position

wobjstring

The wobj used to teach position

coordsstring

The coordinate system used to teach position

mechunitstring

The mechanical unit used to teach position

Returns:
  • The teached position
Type: 
undefined | Promise.<{RobTarget}> | Promise.<{JointTarget}>
Example
let position = await API.MOTION.teachPosition(API.MOTION.POSITIONTYPES.robtarget);

Type Definitions

ExtAx

Properties
NameTypeDescription
eax_anumber
eax_bnumber
eax_cnumber
eax_dnumber
eax_enumber
eax_fnumber

JointTarget

Properties
NameTypeDescription
robaxRobAx
extaxExtAx

RobAx

Properties
NameTypeDescription
rax_1number
rax_2number
rax_3number
rax_4number
rax_5number
rax_6number

RobConf

Properties
NameTypeDescription
cf1number
cf4number
cf6number
cfxnumber

RobTarget

Properties
NameTypeDescription
transTrans
rotRot
robconfRobConf
extaxExtAx

Rot

Properties
NameTypeDescription
q1number
q2number
q3number
q4number

Trans

Properties
NameTypeDescription
xnumber
ynumber
znumber

executeJoggingProps

Properties
NameTypeAttributesDescription
toolstring<optional>
wobjstring<optional>
coordsCOORDS<optional>
jogModeJOGMODE<optional>
jogDataJogData<optional>
robTargetRobTarget<optional>
jointTargetJointTarget<optional>
doJointboolean<optional>