Skip to main content

API Description

This chapter lists the interfaces and function descriptions supported by each version of xCore SDK. Different language versions have basically the same functional definitions for interfaces, but parameters, return values, and calling methods may differ.

Python: Instantiate rokae::Robot Class

Depending on the robot configuration and number of axes, the Python version of the SDK provides the following Robot classes that can be instantiated. During initialization, it checks whether the selected configuration and number of axes match the connected robot:

Class NameApplicable Models
xMateRobotCollaborative 6-axis
xMateErProRobotCollaborative 7-axis
StandardRobotIndustrial 6-axis
xMateCr5RobotCollaborative CR5-axis
PCB4RobotIndustrial 4-axis
PCB3RobotIndustrial 3-axis

Robot Basic Operations and Information Query

DescriptionInterfaceParametersReturn
Connect to RobotconnectToRobot()
Connect to RobotconnectToRobot(remoteIP,localIP)remoteIP - Robot IP address
localIP - Local address. Used for real-time mode data transmission
DisconnectdisconnectFromRobot()
Query Robot Basic InforobotInfo()Controller version, model, number of axes, MAC, etc.
Robot Power On/Off and E-Stop StatuspowerState()on/off/Estop/Gstop
Robot Power On/OffsetPowerState(state)state - on/off
Query Current Operation ModeoperateMode ()auto/manual
Switch Manual/Auto ModesetOperateMode(mode)mode - auto/manual
Query Robot Running StatusoperationState()idle/jog/RLprogram/moving etc.
Get Current End/Flange Postureposture(ct)ct - Coordinate type[X,Y,Z,Rx,Ry,Rz]
Get Current End/Flange PosturecartPosture(ct)ct - Coordinate type[X,Y,Z,Rx,Ry,Rz] and axis configuration parameters
Get Current Joint AnglesjointPos()Joint angles rad
Get Current Joint VelocityjointVel()Joint velocity rad/s
Get Joint TorquejointTorque()Joint torque Nm
Receive Real-time Status / Read by FieldupdateRobotState(timeout)
getStateData(fieldName, data, …)
In real-time mode; field names see RtSupportedFieldsStatus data
Stop Receiving Real-time StatusstopReceiveRobotState()Used to reconfigure subscription fields
Query Base FramebaseFrame()[X,Y,Z,Rx,Ry,Rz]
Set Base FramesetBaseFrame(frame)frame - Frame
Query Current Tool/Workpiece Settoolset()End frame, reference frame, load info
Set Tool/Workpiece SetsetToolset(toolset)
setToolset(toolName,wobjName)
toolset- Tool/workpiece set info
toolName- Tool name
wobjName- Workpiece name
Calculate Inverse Kinematicsrobot.model().calcIk(posture)
robot.model().calcIk(posture,toolset)
posture - End posture relative to external reference frame
toolset- Tool/workpiece set info
Joint angles
Calculate Forward Kinematicsrobot.model().calcFk(joints)
robot.model().calcFk(joints,toolset)
joints- Joint angles
toolset - Tool/workpiece set info
End posture relative to external reference frame
Calculate All Inverse Kinematics Solutionsrobot.model().calcAllIkSolutions(posture, confs, ec)posture - Flange relative to base coordinate system
confs - Configuration data sets
Multiple sets of joint angles (not supported for xMateSR/XMS)
Clear Servo AlarmclearServoAlarm()
Query Controller LogsqueryControllerLog(count, level[, offset])count - Query count
level - Log level
offset - Offset from latest, default 0
Controller log list
Set Collision Detection Parameters, Enable Collision DetectionCollaborative: enableCollisionDetection(sensitivity,behaviour,fallback)
Industrial six-axis (StandardRobot): enableCollisionDetection(sensitivity, fallback)
Collaborative: behaviour includes stop1/stop2/compliant, etc.
Industrial: only stop1, no behaviour parameter
fallback - Fallback distance or compliance
Disable Collision DetectiondisableCollisionDetection()
Frame CalibrationcalibrateFrame(type,points, is_held,base_aux)type - Frame type
points - Calibration joint angle list
is_held - Handheld/External tool
base_aux - Base frame calibration auxiliary point
Calibration result: frame and deviation
Get Current Soft Limit ValuesgetSoftLimit(limits)limits - Soft limits per axisEnabled/Disabled
Set Soft LimitssetSoftLimit(enable,limits)enable - Enable/Disable
limits - Soft limits per axis
Recover StaterecoverState(item)item - Recovery option: E-stop recovery
Reboot Industrial ComputerrebootSystem(ec)Not allowed in auto mode/power off/moving/non-idle state
Shutdown Industrial ComputershutdownSystem(ec)Controller needs to be powered on again after shutdown
Connection Status CallbacksetConnectionHandler(handler)handler(bool): true connected / false disconnected
Teach Pendant ModesetTeachPendantMode(enable)Blocks until switching is complete (about 2s order of magnitude)
Read DH ParametersgetRobotCfg_DHparam(get_nominal, ec)get_nominal: true nominal / false optimized or current settingAxes Alpha[°], A[mm], D[mm], Theta[°] in order
Mechanical Unit / External Axis InformationgetExtAxisInfo(name, info, value, ec)
getMechUnit(name, info, value, ec)
name: axis1~axis6 or u1~u6; info is field name stringWrites to value output parameter
Set Rail ParameterssetRailParameter(name, value)name - Parameter name
value - Parameter value
Read Rail ParametersgetRailParameter(name,value)name - Parameter name
value - Parameter value
Configure NTPconfigNtp(server_ip)server_ip - NTP server IP
Sync Time with NTP ServersyncTimeWithServer()
Query SDK VersionsdkVersion()Version number

Motion Control

Non-real-time motion control related interfaces.

DescriptionInterfaceParametersReturn
Set Motion Control ModesetMotionControlMode(mode)mode - Idle / NrtCommandMode / NrtRLTask / RtCommandMode
Start/Continue MotionmoveStart()
Motion ResetmoveReset()
Pause Robot Motionstop()
Pause Motion (same as stop)pause(ec)
Add Motion CommandmoveAppend(command,id)command - One or more MoveL/MoveJ/MoveAbsJ/MoveC/MoveCF/MoveSP commands
id - Command ID for execution feedback
Set Default Motion SpeedsetDefaultSpeed(speed)speed - Max end linear velocity
Set Default ZonesetDefaultZone(zone)zone - Zone radius
Set Conf UsagesetDefaultConfOpt(forced) forced - Use/Not use
Set Max Cache SizesetMaxCacheSize(number)number - Allowed range [1, 1000], default 300
Start Jog RobotstartJog(space,rate,step,index, direction)space - Reference frame
rate - Speed
step - Step size
index - XYZABC/J1-7
direction - Direction
Jog (External Axis/Mechanical Unit)startJogWithExt(space, rate, step, index, direction, fixed_name, ec[, is_ext])fixed_name配合indexis_ext指定本体轴或机械单元轴
Adjust Speed OnlineadjustSpeedOnline(scale)scale - Speed ratio
Set Event WatchersetEventWatcher(eventType, callback)eventType - Event type
callback - Event callback
Cancel Event CallbacksetNoneEventWatcher(eventType, ec)eventType - Consistent with setEventWatcher
Auto Cancel ZonesetAutoIgnoreZone(enable, ec)enable - Whether to automatically cancel zone, initially true
Query Event InfoqueryEventInfo(eventType) eventType - Event typeEvent info
Execute Motion CommandexecuteCommand(command)command - One or more MoveL/MoveJ/MoveAbsJ/MoveC/MoveCF/MoveSP commands
Get Current AccelerationgetAcceleration(acc,jerk)acc - Acceleration
jerk - Jerk
Set Motion AccelerationadjustAcceleration(acc,jerk)acc - Acceleration
jerk - Jerk
Enable Singularity AvoidancesetAvoidSingularity(method, enable,threshold)method - Singularity avoidance method
enable - Enable/Disable
threshold - Threshold parameter
Query Singularity Avoidance StatusgetAvoidSingularity(method)method - Singularity avoidance methodEnabled/Disabled
Check Cartesian Path ReachabilitycheckPath(start,start_joint, target)start - Start point
start_joint - Start joint angles
target - Target point
Calculated target joint angles
DescriptionInterfaceParametersReturn
Query DI SignalgetDI(board,port)board - IO board index
port - Signal port
on
Set DI SignalsetDI(board,port,state)board - IO board index
port - Signal port
state - Signal value
Query DO SignalgetDO(board,port)board - IO board index
port - Signal port
on
Set DO SignalsetDO(board,port,state)board - IO board index
port - Signal port
state - Signal value
Query AI SignalgetAI(board,port)board - IO board index
port - Signal port
Signal value
Set AO SignalsetAO(board,port,value)board - IO board index
port - Signal port
value - Signal value
Set Simulation ModesetSimulationMode(state)state - Enable/Disable
Read RegisterreadRegister(name,index,value)name - Register name
index - Register array index
value - Read value
Write RegisterwriteRegister(name,index,value)name - Register name
index - Register array index
value - Write value
Set xPanel Output ModesetxPanelVout(opt)opt - Mode
Get End Keypad StategetKeypadState()End keypad state
End Tool 485 Communication SwitchsetxPanelRS485(Vopt,if_rs485)Vopt - Output voltage
if_rs485 - Enable 485 communication
485 Communication Read/Write RegistersXPRWModbusRTUReg(slave_addr,fun_cmd, reg_addr data_type,num,data_array,if_crc_reverse)slave_addr - Slave address
fun_cmd - Function code
reg_addr - Register address
data_type - Data type
num - Data length
data_array - Data array
if_crc_reverse - CRC reverse
485 Communication Read/Write Coils or Discrete InputsXPRWModbusRTUCoil(slave_addr,fun_cmd, coil_addr,int num,data_array,if_crc_reverse)slave_addr - Slave address
fun_cmd - Function code
coil_addr - Coil address
num - Data length
data_array - Data array
if_crc_reverse - CRC reverse
485 Raw Data TransmissionXPRS485SendData(send_byte,rev_byte,send_data,rev_data,)send_byte - Send length
rev_byte - Receive length
send_data - Send data
rev_data - Receive data

RL Project

The controller needs to have an RL project created, supporting query of project info and execution.

DescriptionInterfaceParametersReturn
Query RL Project ListprojectsInfo()Project name and task names
Load ProjectloadProject(name,tasks)name-Project name
tasks-Task list
pp-to-mainppToMain()
Start ProjectrunProject()
Pause ProjectpauseProject()
Set Run Rate and Loop ModesetProjectRunningOpt(rate,loop)rate-Run rate
loop-Loop/Single
Query Tool InfotoolsInfo()Tool name, pose, load info
Query Workpiece InfowobjsInfo()Workpiece name, pose, load info
Import RL Project Zip PackageimportProject(file_path, overwrite, ec)file_path - Local .zip path (≤10M)
overwrite - Whether to overwrite same name
Project name (renamed name when automatically renamed)
Delete RL ProjectremoveProject(name, ec[, remove_all])name - Project name
remove_all - Whether to delete all projects, default false
Import File to ControllerimportFile(file_path, dest, overwrite, ec)file_path - Local file path
dest - Controller target path
overwrite - Whether to overwrite
Imported file name
Delete Controller FileremoveFiles(file_path_list, ec)Path list, see method description
Set Tool InformationsetToolInfo(tool_info, ec)tool_info - Tool information
Set Workpiece InformationsetWobjInfo(wobj_info, ec)wobj_info - Workpiece information

Includes drag teaching and path recording functions.

DescriptionInterfaceParametersReturn
Enable DragenableDrag(space,type,enable_drag_button)space-Drag space
type-Drag type
enable_drag_button-No button drag
Disable DragdisableDrag()
Start Record PathstartRecordPath(duration)duration-Record duration
Stop Record PathstopRecordPath()
Cancel RecordcancelRecordPath()
Save PathsaveRecordPath(name,saveAs)name-Path name
saveAs-Rename as
Path ReplayreplayPath(name,rate)name-Path name
rate-Replay rate
Delete Saved PathremovePath(name,all)name-Path name
all -Delete all paths
Query Path ListqueryPathLists()Path name list
Force Sensor CalibrationcalibrateForceSensor(all_axes,axis_index)all_axes-Calibrate all axes
axis_index-Single axis index
Real-time Command Network Packet Loss ThresholdsetRtNetworkTolerance(percent, ec)percent - 0~100, corresponding to RobotAssist-RCI "Packet Loss Threshold"; must be set before switching to RtCommandMode

Force Control Commands

DescriptionInterfaceParametersReturn
Get Current Torque InfogetEndTorque(ref_type,joint,external,cart_torque,cart_force)ref _type -Torque reference frame
joint-Joint measurements
external-External forces
cart_torque-Cartesian torque
cart_force-Cartesian force
Force Control InitfcInit(frame_type)frame_type-Force control frame
Start Force ControlfcStart()
Stop Force ControlfcStop()
Set Impedance Control TypesetControlType(type)type-Impedance type
Set Force Control LoadsetLoad(load)load-Load
Set Joint Impedance StiffnesssetJointStiffness(stiffness)stiffness-Stiffness
Set Cartesian Impedance StiffnesssetCartesianStiffness(stiffness)stiffness-Stiffness
Set Cartesian Nullspace Impedance StiffnesssetCartesianNullspaceStiffness(stiffness)stiffness-Stiffness
Set Joint Desired TorquesetJointDesiredTorque(torque)torque-Torque value
Set Cartesian Desired Force/TorquesetCartesianDesiredForce(value)value-Desired force/torque
Set Sine Search MotionsetSineOverlay(line_dir,amplify,frequency,phase,bias)line_dir-Reference axis
amplify-Amplitude
frequency-Frequency
phase-Phase
bias-Bias
Set Lissajous Search MotionsetLissajousOverlay(plane,amplify_one,frequency_one,amplify_two,frequency_two,phase_diff,error_code &ec)plane-Reference plane
amplify_one-Amplitude 1
frequency_one-Frequency 1
amplify_two-Amplitude 2
frequency_two-Frequency 2
phase_diff-Phase difference
Start Search MotionstartOverlay()
Stop Search MotionstopOverlay()
Pause Search MotionpauseOverlay()
Restart Paused Search MotionrestartOverlay()
Set Force-related Termination ConditionsetForceCondition(range,isInside,timeout)range-Force limit
isInside-Exceed/Meet limit condition
timeout-Timeout
Set Torque-related Termination ConditionsetTorqueCondition(range,isInside,timeout)range-Torque limit
isInside-Exceed/Meet limit condition
timeout-Timeout
Set Position-related Termination ConditionsetPoseBoxCondition(supervising_frame,box,isInside,timeout)supervising_frame-Reference frame of box
box-Box
isInside-Exceed/Meet limit condition
timeout-Timeout
Activate Termination Conditions and WaitwaitCondition()
Start/Stop Force Control Protection MonitorfcMonitor(enable)enable-Enable/Disable
Set Joint Max Velocity in Force Control ModesetJointMaxVel(velocity)velocity-Joint velocity
Set Cartesian Max Velocity in Force Control ModesetCartesianMaxVel(velocity)velocity-End velocity
Set Joint Max Momentum in Force Control ModesetJointMaxMomentum(momentum)momentum-Momentum
Set Joint Max Energy in Force Control ModesetJointMaxEnergy(energy)energy-Energy