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
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()
Set Connection Handler CallbacksetConnectionHandler(handler)handler- Callback function, parameter is bool, true-connected false-disconnected
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(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.
Reboot IPCrebootSystem()
Shutdown IPCshutdownSystem()
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
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
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 - End posture relative to external reference frame
toolset- Tool/workpiece set info
Joint angles
Calculate Forward KinematicscalcFk(joints)
calcFk(joints,toolset)
joints- Joint angles
toolset - Tool/workpiece set info
End posture relative to external reference frame
Calculate All IK Solutions for Cartesian PosturecalcAllIkSolutions(posture, confs)posture- Cartesian posture, flange relative to base frame. Other frames need conversion
confs - Corresponding confdata, valid when error code is 0
IK result, unit radians
Clear Servo AlarmclearServoAlarm()
Query Controller LogsqueryControllerLog(count,level)count - Query count
level - Log level
offset- Offset, e.g., 0 means query from latest log, 10 means from 11th
Controller log list
Set Collision Detection Parameters, Enable Collision DetectionenableCollisionDetection(sensitivity,behaviour,fallback)sensitivity - Sensitivity
behaviour- Post-collision behavior
fallback- Fallback distance/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
Set Rail ParameterssetRailParameter(name, value)name - Parameter name
value - Parameter value
Read Rail ParametersgetRailParameter(name,value)name - Parameter name
value - Parameter value
Read Mechanical Unit ParametersgetMechUnit(name,info,value)R - Parameter type
name Parameter name, u1~u6
info Parameter name, see value description
Read Axis Unit ParametersgetExtAxisInfo(name,info,value)R - Parameter type
name Parameter name, axis1~axis6
info Parameter name, see value description
Configure NTPconfigNtp(server_ip)server_ip - NTP server IP
Sync Time with NTP ServersyncTimeWithServer0
Query SDK VersionsdkVersion()Version number

Motion Control

Non-real-time motion control related interfaces.

DescriptionInterfaceParametersReturn
Set Motion Control ModesetMotionControlMode(mmode)mode - NRT/RT/RL project
Start/Continue MotionmoveStart()
Motion ResetmoveReset()
Pause Robot Motionstop()
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 Auto Ignore ZonesetAutoIgnoreZone(enable) enable- Auto ignore
Set Max Cache SizesetMaxCacheSize(number)number - Count
Start Jog RobotstartJog(space,rate,step,index, direction)space - Reference frame
rate - Speed
step - Step size
index - XYZABC/J1-7
direction - Direction
Start Jog Robot+External AxisstartJogWithExt(space, step,index, direction, fixed_name, is_ext = true) space - Reference frame
rate - Speed
step - Step size
index - XYZABC/J1-7
direction - Direction
fixed_name- Used with index
Adjust Speed OnlineadjustSpeedOnline(scale)scale - Speed ratio
Set Event WatchersetEventWatcher(eventType, callback)eventType - Event type
callback - Event callback
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 - Avoidance method
enable - Enable/Disable
threshold - Threshold
Query Singularity Avoidance StatusgetAvoidSingularity(method)method - 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
Teach Pendant Hot SwapsetTeachPendantMode(enable)enable true - Use teach pendant false - Don't use teach pendant

Real-time Motion Control

DescriptionInterfaceParametersReturn
Reconnect RT Control ServerreconnectNetwork()
DisconnectdisconnectNetwork()
Set Control LoopsetControlLoop(callback, priority,useStateDataInLoop)callback - Callback
priority - Thread priority useStateDataInLoop - Read RT state in callback
Start LoopstartLoop(blocking) blocking - Block or not
Stop LoopstopLoop ()
Start MotionstartMove(mode)mode - Control mode
Stop MotionstopMove()
Send JointPosition/CartesianPosition/Torque CommandsendCommand(cmd)cmd- 3 motion commands based on mode: joint angle/cartesian pose/torque
Start Receive Robot StatestartReceiveRobotState(timeout ,fields) timeout - Timeout
fields - Data fields
Stop Receive Robot StatestopReceiveRobotState ()
Update Robot StateupdateRobotState(timeout)timeout - Timeout
Get Robot State DatagetStateData(name,data)name - Data name
data - Data value
Enable ServoJsetServoJoint(ServoJ_T, ServoJ_Lookahead, ServoJ_Kp, )
Stop ServoJstopServoJoint()
Check Motion ErrorhasMotionError()
PTP Joint Space MotionMoveJ(speed,start,target)speed - Speed ratio
start - Start joint angles
target - Target joint angles
PTP Cartesian Linear MotionMoveL(speed,start,target)speed - Speed ratio
start - Start pose
target - Target pose
3-Point Arc MotionMoveC(speed, start,aux,target)speed - Speed ratio
start - Start pose
aux - Auxiliary pose
target - Target pose
Read DH ParametersgetRobotCfg_DHparam(get_nominal)get_nominal false - Optimized/set params true - Read nominal paramsDH params
Set Filter LimitsetFilterLimit(limit,frequency)limit - Enable limit
frequency - Cutoff frequency
Set Cartesian Motion AreasetCartesianLimit(length, frame)length - Area dimensions
frame - Area center frame
Set Joint ImpedancesetJointImpedance(factor)factor - Joint impedance factor
Set Cartesian ImpedancesetCartesianImpedance(factor)factor - Factor
Set Collision ThresholdsetCollisionBehaviour(threshol d)threshold - Joint thresholds
Set End Effector PosesetEndEffectorFrame(frame)frame - End pose relative to flange
Set LoadsetLoad(load)load - Load info
Set Filter FrequencysetFilterFrequency(joint,cart, torque)joint - Joint position cutoff
cart - Cartesian position cutoff
torque - Joint torque cutoff
Set Cartesian Impedance Desired TorquesetCartesianImpedanceDesiredTorque(torque)torque - End desired torque
Set Torque Filter CutoffsetTorqueFilterCutoffFrequenc y(frequency)frequency - Frequency
Set Force Control FramesetFcCoor(frame,type)frame - Frame
type - FC task frame type
Auto Error RecoveryautomaticErrorRecovery()
Set Network TolerancesetNetworkTolerance(percent)percent - Threshold percentage
Switch to RCI ClientuseGen1RciClient(use)use - Switch or not

Path Planning Related

DescriptionClass
S-curve Cartesian MotionCartMotionGenerator
S-curve Joint Space MotionJointMotionGenerator
Position FollowingFollowPosition
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
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 CoilsXPRWModbusRTUCoil(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 ListprojectInfo()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 Local RL ProjectimportProject(file_path,overwrite)file_path - Local .zip path, max 10M
overwrite- Overwrite same name
Project name
Delete RL ProjectremoveProject(project_name,remove_all)project_name- Project name
remove_all- Delete all, default false
Import Local FileimportFile( src_file_path, dest, overwrite)src_file_path Local file path, max 10M
dest Target path
overwrite Overwrite
Imported file name
Delete Controller FileremoveFiles(file_path_list)file_path_list File path list
Set Global Tool InfosetToolInfo(tool_info)tool_info Tool info
Set Global Workpiece InfosetWobjInfo(wobj_info)wobj_info Workpiece info

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 RecordcancelRecordPathO
Save PathsaveRecordPath(name,saveAs)name-Path name
saveAs-Rename as
Replay PathreplayPath(name,rate)name-Path name
rate-Replay rate
Delete Saved PathremovePath(name,all)name-Path name
all -Delete all
Query Path ListqueryPathLists()Path name list
Calibrate Force SensorcalibrateForceSensor(all_axes,
axis_index)
all_axes-Calibrate all axes
axis_index-Single axis index

Force Control Commands

DescriptionInterfaceParametersReturn
Get Current Torque InfogetEndTorque(ref_type,joint,
external,cart_torque,
cart_force)
ref _type -Reference frame
joint-Joint measurements
external-External forces
cart_torque-Cartesian torque
cart_force-Cartesian force
FC InitfcInit(frame_type)frame_type-FC frame
Start FCfcStart()
Stop FCfcStop0
Set Control TypesetControlType(type)type-Impedance type
Set FC LoadsetLoad(load)load-Load
Set Joint StiffnesssetJointStiffness(stiffness)stiffness-Stiffness
Set Cartesian StiffnesssetCartesianStiffness(stiffness)stiffness-Stiffness
Set Cartesian Nullspace StiffnesssetCartesianNullspaceStiffness(s tiffness)stiffness-Stiffness
Set Joint Desired TorquesetJointDesiredTorque(torque)torque-Torque value
Set Cartesian Desired Force/TorquesetCartesianDesiredForce
(value)
value-Desired force/torque
Set Sine OverlaysetSineOverlay(line_dir,
amplify,frequency,phase,bias)
line_dir-Reference axis
amplify-Amplitude
frequency-Frequency
phase-Phase
bias-Bias
Set Lissajous OverlaysetLissajousOverlay (int plane,
double amplify_one,double
frequency_one,double
amplify_two,
double
frequency_two,double
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 diff
Start OverlaystartOverlay()
Stop OverlaystopOverlayO
Pause OverlaypauseOverlay()
Restart OverlayrestartOverlay()
Set Force ConditionsetForceCondition(range,
isInside,timeout)
range-Force limit
isInside-Inside/outside limit
timeout-Timeout
Set Torque ConditionsetTorqueCondition (range,
isInside,timeout)
range-Torque limit
isInside-Inside/outside limit
timeout-Timeout
Set Pose Box ConditionsetPoseBoxCondition(supervisin g_frame,box,isInside,timeout)supervising_frame-Frame
box-Box
isInside-Inside/outside
timeout-Timeout
Wait ConditionwaitCondition ()
FC MonitorfcMonitor(enable)enable-Enable/Disable
Set Joint Max VelsetJointMax Vel(velocity)velocity-Joint velocity
Set Cartesian Max VelsetCartesianMax Vel(velocity)velocity-End velocity
Set Joint Max MomentumsetJointMaxMomentum(momen tum)momentum-Momentum
Set Joint Max EnergysetJointMaxEnergy(energy)energy-Energy