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.

C#: Instantiate rokae::Robot Class

Depending on the robot configuration and number of axes, the C# 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 (xMateCR7/12, xMateSR3/4, xMateER3/7, etc.)
xMateErProRobotCollaborative 7-axis (xMateER3 Pro / xMateER7 Pro)
StandardRobotIndustrial 6-axis
xMateCr5RobotCollaborative 5-axis (XMC17_5 / XMC25_5)
PCB4RobotIndustrial 4-axis
PCB3RobotIndustrial 3-axis

Robot Basic Operations and Information Query

DescriptionInterfaceParametersReturn
Connect to RobotconnectToRobot(ec)[out] ec - Error code; address passed when constructing the instance
Connect to RobotconnectToRobot(remoteIP)remoteIP - Robot IP
Connect to RobotconnectToRobot(remoteIP, localIP)localIP - Local address. Used for real-time interaction; not supported by PCB3/4 axis models
DisconnectdisconnectFromRobot()
Set connection disconnection callback functionsetConnectionHandler(handler)handler - Callback function
Query Robot Basic InforobotInfo()Controller version, model, number of axes
Robot Power On/Off and E-Stop StatuspowerState()on/off/Estop/Gstop
Robot Power On/OffsetPowerState(on)on - true power on / false power 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 system type[X,Y,Z,Rx,Ry,Rz]
Get Current End/Flange PosturecartPosture(ct)ct - Coordinate system 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
Query Multiple StatesgetStateList()Current position, IO signals, operation mode, speed override value
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 KinematicscalcIk(posture)
calcIk(posture, toolset)
posture - CartesianPosition^, end relative to external reference frame
toolset - Optional tool/workpiece set
Joint angles [rad]
Calculate Forward KinematicscalcFk(joints)
calcFk(joints, toolset)
joints - Joint angles [rad]
toolset - Optional
CartesianPosition^
Clear Servo AlarmclearServoAlarm()
Query Controller LogsqueryControllerLog(count,level)count - Query count
level - Log level
Controller log list
Set Collision Detection (Collaborative)enableCollisionDetection(sensitivity, behaviour, fallback_compliance)sensitivity - Sensitivity 0.01~2.0
behaviour - stop1/stop2/suppleStop
fallback_compliance - fallback distance[m] or compliance[0,1]
Set Collision Detection (Industrial)enableCollisionDetection(sensitivity, fallback)Only stop1 (safety stop); fallback - fallback distance[m]
Disable Collision DetectiondisableCollisionDetection()
Frame CalibrationcalibrateFrame(type, points, is_held, base_aux)type - tool / wobj / base / rail (three-point for rail base frame)
points - Joint angle list[rad]
is_held - Robot held/external (tool, workpiece)
base_aux - Base frame calibration auxiliary point[m]
Calibration result and deviation; if successful, controller saves, takes effect after restart
Get Current Soft Limit ValuesgetSoftLimit(limits)limits - Soft limits per axisEnabled/Disabled
Set Soft LimitsetSoftLimit(enable,limits)enable - Enable/Disable
limits - Soft limits per axis
Recover StaterecoverState(item)item - Recovery option: E-stop recovery
Read Rail ParametersgetRailParameter(name, value)Overload: enable/name/baseFrame/numeric (reductionRatio, maxSpeed, encoderResolution, etc.)/softLimit and range arrays
Set Rail ParameterssetRailParameter(name, value)Overload: Frame (baseFrame), String (name), double, bool (enable), array<double> (softLimit/range), int (encoderResolution, motorSpeed)
Configure NTPconfigNtp(server_ip)server_ip - NTP server IP
Manual Sync NTP TimesyncTimeWithServer()
Query SDK VersionsdkVersion()Version number
Receive One Robot StateupdateRobotState(timeout_ms)timeout_ms - Timeout[ms]Data length of this frame; returns 0 on timeout
Read Robot State DatagetStateData(name, data)name - See startReceiveRobotState and header file description; data - array<double>, etc., type must matchSuccess 0, failure -1
Read TimestampgetStateData("ts", data)data - UInt64%, microsecond timestampSame as above
Read Elbow AnglegetStateData("psi_m", data)data - double%Same as above
Start Sending Real-time StatestartReceiveRobotState(interval, fields)interval - 1/2/4/8 ms or 1 s; fields - Field name array, total length ≤1024 bytesBlocks until first frame or timeout
Stop Real-time StatestopReceiveRobotState()
Reboot Industrial ComputerrebootSystem(ec)
Shutdown Industrial ComputershutdownSystem(ec)Controller software can only be started after powering off and on the control cabinet
Teach Pendant Hot SwapsetTeachPendantMode(enable)enable - Use/don't use teach pendant
Read DH ParametersgetRobotCfg_DHparam(get_nominal)get_nominal - false: optimized/set; true: nominal parametersAlpha[°], A[mm], D[mm], Theta[°] per axis
Calculate All Inverse Kinematics SolutionscalcAllIkSolutions(posture, confs)posture - Flange relative to base frame; confs - Output confdataInverse kinematics array; not supported for xMateSR(XMS)
Read Mechanical Unit ParametersgetMechUnit(name, info, value)name - u1~u6; info - Parameter name; value - bool/int/string array (overload)
Read External Axis ParametersgetExtAxisInfo(name, info, value)name - axis1~axis6; info - Parameter name; value - bool/int/double/String/string array (overload)

Motion Control

Non-real-time motion control related interfaces.

DescriptionInterfaceParametersReturn
Set Motion Control ModesetMotionControlMode(mode)mode - Idle / NrtCommand / NrtRLTask / RtCommand (non-real-time command, non-real-time RL, real-time)
Start/Continue MotionmoveStart()
Motion ResetmoveReset()
Pause Robot Motionstop()
Add Motion CommandmoveAppend(type, cmd, cmdId)
moveAppend(type, cmdList, cmdId)
type - MoveCommand::Type, consistent with batch commands
cmd / cmdList - Single or 1-100 commands of the same type
cmdId - Command ID for execution feedback
Set Default Motion SpeedsetDefaultSpeed(speed)speed - Maximum end linear speed
Set Default ZonesetDefaultZone(zone)zone - Zone radius
Set Whether to Use confsetDefaultConfOpt(forced) forced - Use/don't use
Set Whether to Automatically Cancel ZonesetAutoIgnoreZone(enable)enable - Auto cancel zone / don't auto cancel
Set Max Cache Command CountsetMaxCacheSize(number)number - Count
Start Jog RobotstartJog(space,rate,step,index, direction)space - Reference frame
rate - Rate
step - Step
index - XYZABC/J1-7
direction - Direction
Dynamically Adjust Robot Motion RateadjustSpeedOnline(scale)scale - Rate
Set Callback Function for Event ReceptionsetEventWatcher(eventType, callback)eventType - moveExecution / safety / rlExecution / logReporter
callback - Callback (moveExecution same thread, don't block; safety separate thread)
Query Event InfoqueryEventInfo(eventType) eventType - Event typeEvent info
Execute Motion CommandexecuteCommand(type, cmd)type - MoveCommand::Type
cmd - 1-100 commands of the same type, starts moving immediately after calling
Read Current AccelerationgetAcceleration(acc,jerk)acc - Acceleration
jerk - Jerk
Set Motion AccelerationadjustAcceleration(acc,jerk)acc - Acceleration
jerk - Jerk
Enable Singularity Avoidance (Industrial Robot)setAvoidSingularity(method, enable, limit)method - 4-axis lock/sacrifice posture/axis space interpolation (collaborative 6-axis no axis space interpolation)
enable - Enable/disable
limit - For sacrifice posture: posture error[rad]; for axis space interpolation: avoidance radius[m]
Query Whether Singularity Avoidance is EnabledgetAvoidSingularity(method)method - Singularity avoidance methodEnabled/Disabled
Check Linear Path ReachabilitycheckPath(start, start_joint, target)Supports rail; start/target are Cartesian pointsTarget joint angles
Check Multiple Linear SegmentscheckPath(start_joint, targets, target_joint_calculated)targets at least 2 points, first point is startReturns error point index when failed
Check Arc ReachabilitycheckPath(start, start_joint, aux, target)aux - Auxiliary pointTarget joint angles
Check Full Circle ReachabilitycheckPath(start, start_joint, aux1, aux2, angle, rot_type)angle - Full circle radians; rot_type - Rotation typeTarget joint angles
DescriptionInterfaceParametersReturn value
Query DI SignalgetDI(board,port)board - IO board number
port - Signal port number
on
Set DI SignalsetDI(board,port,state)board - IO board number
port - Signal port number
state - Signal value
Query DO SignalgetDO(board,port)board - IO board number
port - Signal port number
on
Set DO SignalsetDO(board,port,state)board - IO board number
port - Signal port number
state - Signal value
Query AI SignalgetAI(board,port)board - IO board number
port - Signal port number
Signal value
Set AO SignalsetAO(board,port,value)board - IO board number
port - Signal port number
value - Signal value
Set Input Simulation ModesetSimulationMode(state)state - Enable/disable
Read Register ValuereadRegister(name,index,value)name - Register name
index - Register array index
value - Read value
Write Register ValuewriteRegister(name,index,value)name - Register name
index - Register array index
value - Write value
Set xPanel External Power Supply ModesetxPanelVout(opt)opt - Mode
Get End Keypad StategetKeypadState()End keypad state
End Tool 485 Communication SwitchsetxPanelRS485(Vopt,if_rs485)Vopt - Output voltage
if_rs485 - Whether to enable 485 communication
485 Communication Read/Write RegistersXPRWModbusRTUReg(...)slave_addr; fun_cmd (0x03/04/06/10); reg_addr; data_type (int32/int16/uint32/uint16); num; array<int>^% data_array; if_crc_reverse
485 Communication Read/Write Coils or Discrete InputsXPRWModbusRTUCoil(...)fun_cmd 0x01/02/05/0F; array<bool>^% data_array; others same as registers
485 Communication Raw Data TransmissionXPRS485SendData(send_byte, rev_byte, send_data, recv_data)Send/receive length 0~16 each; recv_data is output

RL Project

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

DescriptionInterfaceParametersReturn value
Query RL Project ListprojectsInfo()Project names and task names
Load ProjectloadProject(name,tasks)name-Project name
tasks-Task list
pp-to-mainppToMain()
Start Running ProjectrunProject()
Pause Running ProjectpauseProject()
Set Running Rate and Loop ModesetProjectRunningOpt(rate,
loop)
rate-Running rate
loop-Loop/Single
Set Global Tool InfosetToolInfo(tool_info)tool_info-Tool info
Set Global Workpiece InfosetWobjInfo(wobj_info)wobj_info-Workpiece info
Query Tool InfotoolsInfo()Tool names, poses, loads, etc.
Query Workpiece InfowobjsInfo()Workpiece names, poses, loads, etc.
Import Local File to ControllerimportFile(src_file_path, dest, bool overwrite)src_file_path-Local file path
dest-Target path
overwrite-Overwrite same name file
Imported file name
Delete Files in ControllerremoveFiles(file_path_list)File path list
Import Local RL Project Zip to ControllerimportProject(file_path, bool overwrite)file_path-Local .zip path
overwrite-Whether to overwrite same name file
Project name
Delete RL Project in ControllerremoveProject(project_name, remove_all)project_name-Project name
remove_all-Whether to delete all projects

Includes drag teaching and path recording functions.

DescriptionInterfaceParametersReturn value
Enable DragenableDrag(space,type,
enable_drag_button)
space-Drag space
type-Drag type
enable_drag_button-No button drag
Disable DragdisableDrag()
Start Recording PathstartRecordPath()Duration must be within 30 minutes; non-blocking, call stopRecordPath() to end
Stop Recording PathstopRecordPath()
Cancel RecordingcancelRecordPath()
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 -Whether to 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 calibration index

xMate Five-axis (xMateCr5Robot)

DescriptionInterfaceParametersReturn value
Parallel Base ModeenableCompletePostureLerp(enable)enable - true enable / false disable

Force Control Commands

DescriptionInterfaceParametersReturn value
Force Control Command ClassforceControl()ForceControl
Get Current Torque InfogetEndTorque(ref_type, joint_torque_measured, external_torque_measured, cart_torque, cart_force)ref_type - world / flange / tool
Others are output: joint measured torque, joint external torque, Cartesian torque, Cartesian force
Force Control InitializationfcInit(frame_type)world / wobj / tool / baseFrame / flange
Start Force ControlfcStart()After fcInit; commands added with moveAppend but not moveStart will execute after force control starts
Stop Force ControlfcStop()
Set Impedance Control TypesetControlType(type)0 - Joint impedance; 1 - Cartesian impedance
Set Load Used by Force Control ModulesetLoad(load)Can be called after fcStart
Set Joint Impedance StiffnesssetJointStiffness(stiffness)Takes effect after fcInit
Set Cartesian Impedance StiffnesssetCartesianStiffness(stiffness)XYZ force stiffness [N/m] + ABC torque stiffness [Nm/rad]
Set Cartesian Nullspace Impedance StiffnesssetCartesianNullspaceStiffness(stiffness)[0,4] Nm/rad
Set Joint Desired TorquesetJointDesiredTorque(torque)[-30,30] Nm
Set Cartesian Desired Force/TorquesetCartesianDesiredForce(value)XYZ force [-60,60] N; ABC torque [-10,10] Nm
Set Sine Search MotionsetSineOverlay(line_dir, amplify, frequency, phase, bias)Must first setControlType(1); 0/1/2 for X/Y/Z axis
Set Lissajous Search MotionsetLissajousOverlay(plane, amplify_one, frequency_one, amplify_two, frequency_two, phase_diff)Must first setControlType(1); plane 0/1/2 for XY/XZ/YZ
Start Search MotionstartOverlay()After fcStart
Stop Search MotionstopOverlay()
Pause Search MotionpauseOverlay()
Restart Paused Search MotionrestartOverlay()
Set Termination Condition Related to Contact ForcesetForceCondition(range, isInside, timeout)range - Six-axis force limit[N]; isInside - true stop when exceeded, false stop when met; timeout [1,600] s
Set Termination Condition Related to Contact TorquesetTorqueCondition(range, isInside, timeout)Same as above, unit Nm
Set Termination Condition Related to Contact PositionsetPoseBoxCondition(supervising_frame, box, isInside, timeout)Reference frame relative to external workpiece; box six elements [m]; isInside same meaning as force condition
Activate Termination Condition and WaitwaitCondition()
Start/Stop Force Control Protection MonitoringfcMonitor(enable)Threshold takes effect after fcMonitor(true), restores default protection after false
Force Control Axis Maximum SpeedsetJointMaxVel(velocity)[rad/s]
End Relative to Base Maximum SpeedsetCartesianMaxVel(velocity)XYZ [m/s], ABC [rad/s]
Force Control Axis Maximum MomentumsetJointMaxMomentum(momentum)N·s
Force Control Axis Maximum Kinetic EnergysetJointMaxEnergy(energy)N·rad/s
Cartesian Impedance Force LimitsetCartesianControlMaxWrench(max_wrench)XYZ[N], ABC[Nm], [0,1000], valid from fcStart to fcStop
Cartesian Impedance Contact Speed LimitsetCartesianControlMaxVel(max_cart_vel)XYZ [0,3] m/s; ABC [0,10] rad/s
Joint Impedance Torque LimitsetJointControlMaxTorque(max_torque)Nm, [0,1000]
Joint Impedance Speed LimitsetJointControlMaxVel(max_joint_vel)rad/s, [0,10]
Force Control BandwidthsetFcGain(gain)Each axis [0,60], default 20
Friction CompensationsetFriction(fric)Each axis [0,1], default 0.9