Jaka Python SDK
Jaka Python SDK
Search
Running environment:
Linux: Python 3.5 32 bits
Windows: Python 3.7 64 bits
Units used to parameters: mm, rad.
In non-specific code examples, the robot is turned on by default and powered on.
All code samples in the documentation default to no interference in the robot's
workspace.
The examples in the documentation are all default to the user's Python interpreter
being able to find the jkrc module.
Use under Linux
Linux needs to [Link] and [Link] under the same folder and add the current
folder path to the environment variable, export LD_LIBRARY_PATH=/xx/xx/
In Windows: Right-click the .dll file, select "Properties," and check the version
information under the "Details" tab.
In Linux: Enter the command strings [Link] | grep jakaAPI_version to query
the version information.
API
Basic Operation of Robots
Instantiated robots
Instantiate a robot
RC(ip)
Parameters
ip: The robot's IP address needs to be filled in with a string only the correct IP
address instantiated object to control the robot.
Return value
Success: Return a robot object
Failed: The created object is destroyed
Sample code
import jkrc
robot = [Link]("[Link]") # Return a robot object
Login
Connect the robot controller
login()
Return value
Success: (0,)
Failed: Others
Logout
Disconnect the controller
logout()
Return value
Success: (0,)
Failed: Others
Sample code
import jkrc
robot = [Link]("[Link]") # Return a robot object
[Link]() #Connect the robot controller
pass
[Link]() #Disconnect the robot controller
Power on
Power on the robot. There will be about 8 seconds' delay.
power_on()
Return value
Success: (0,)
Failed: Others
Sample code
import jkrc
robot = [Link]("[Link]") #Return a robot object
[Link]() #Login
robot.power_on() #Power on
[Link]() #Logout
Power off
Power off the robot
power_off()
Return value
Success: (0,)
Failed: Others
Shut down the robot controller
Shut down the robot's control cabinet
shut_down()
Return value
Success: (0,)
Failed: Others
Enable the robot
enable_robot()
Return value
Success: (0,)
Failed: Others
Sample code
import jkrc
robot = [Link]("[Link]")#Return a robot object
[Link]() #Login
robot.enable_robot()#
[Link]() #Logout
Disable the robot
disable_robot()
Return value
Success: (0,)
Failed: Others
Get SDK version
get_sdk_version()
Return value
Success: (0,version)
Failed: Others
Sample code
import jkrc
robot = [Link]("[Link]")#
[Link]() #
ret = robot.get_sdk_version()
print("SDK version is:",ret[1])
[Link]() #Logout
Get the controller IP
get_controller_ip ()
Return value
Success: (0, ip_list), ip_list: indicates the controller IP list. If the controller
name is a specific value, the IP address of the controller corresponding to the
controller name is returned. If the controller name is empty, all the IP address of
the controllers in the network segment is returned.
Failed: Others
Enable drag mode
drag_mode_enable(enable)
Parameters
enable: TRUE means to enter the drag mode, FALSE means to quit the drag mode
Return value
Success: (0,)
Failed: Others
Sample code
import jkrc
import time
#Coordinate system
COORD_BASE = 0
COORD_JOINT = 1
COORD_TOOL = 2
#Motion mode
ABS = 0
INCR= 1
robot = [Link]("[Link]")
[Link]()
robot.power_on()
robot.enable_robot()
robot.drag_mode_enable(True)
ret = robot.is_in_drag_mode()
print(ret)
a = input()
robot.drag_mode_enable(False)
ret = robot.is_in_drag_mode()
print(ret)
[Link]()
Check whether in drag mode
To check if the robot is in drag mode
is_in_drag_mode()
Return value
Success: (0,state) state is equal to 1: the robot is in drag mode. state is equal
to 0: the robot is not in drag mode.
Failed: Others
Set whether to turn on the debug mode
set_debug_mode(mode)
Parameters
mode Select TRUE to enter the debug mode. At this time, debugging information will
be output in the standard output stream. Select False, not enter.
Return value
Success: (0,)
Failed: Others
Set SDK log filepath
set_SDK_filepath(filepath)
Parameters
filepath:filepath of the log
Return value
Success: (0,)
Failed: Others
Robot Motion
JOG
To control the robot to move in manual mode.
#coordinate system
COORD_BASE = 0
COORD_JOINT = 1
COORD_TOOL = 2
#motion mode
ABS = 0
INCR= 1
#joint 1-6 is correspond to 0-5
import jkrc
import time
COORD_BASE = 0 # base coordinate system
COORD_JOINT = 1 # joint space
COORD_TOOL = 2 # tool coordinate system
ABS = 0 # absolute motion
INCR = 1 # incremental motion
cart_x = 0 #x direction
cart_y = 1 #y direction
cart_z = 2 #z direction
cart_rx = 3 #rx direction
cart_ry = 4 #ry direction
cart_rz = 5 #rz direction
robot = [Link]("[Link]")#return a robot
[Link]() #login
[Link](aj_num = cart_z,move_mode = INCR,coord_type = COORD_BASE,jog_vel =
5,pos_cmd = 10) # move 10 mm in z+ direction
robot.jog_stop()
[Link]() #logout
Note:
If the robot is approaching a singular posture or joint limit, it will not be able
to jog the robot using the above example code.
jog_stop(joint_num)
Parameters
joint_num: Robot axis number 0-5, when number is -1, stop all axes.
Return value
Success: (0,)
Failed: Others
Sample code
#Coordinate system
COORD_BASE = 0
COORD_JOINT = 1
COORD_TOOL = 2
#Motion mode
ABS = 0
INCR= 1
#Joints 1~6 are correspond to 0~5 in order
#motion mode
ABS = 0
INCR= 1
joint_pos=[PI,PI/2,0,PI//4,0,0]
robot = [Link]("[Link]")#return a robot
[Link]()#login
robot.power_on() #power on
robot.enable_robot()
print("move1")
robot.joint_move(joint_pos,ABS,True,1)
[Link](3)
[Link]()
Robot extension joint move
Robot extension joint move. Add joint move angular acceleration and endpoint error.
import time
import jkrc
#motion mode
ABS = 0
INCR= 1
tcp_pos=[0,0,-30,0,0,0]
robot = [Link]("[Link]")#return a robot
[Link]()#login
robot.power_on() #power on
robot.enable_robot()
print("move1")
#Blocking 30mm movement at 10mm/s in the negative direction of z-axis
ret=robot.linear_move(tcp_pos,INCR,True,10)
print(ret[0])
[Link](3)
[Link]()
Note:
Due to the difference on robot models, the calculation of kine inverse of the pose
value filled in the example above could fail, thus Return value being -4.
import jkrc
import math
import traceback
_ABS = 0
_BLOCK = 1
try:
rc = [Link]("[Link]")
[Link]()
rc.power_on()
rc.enable_robot()
except Exception:
traceback.print_exc()
Set robot block wait timeout
set_block_wait_timeout(seconds)
Parameters Seconds >0.5
Return value
Success: (0,)
Failed: Others
Motion abort
To terminate the robot's motion in any situation
motion_abort ()
Return value
Success: (0,)
Failed: Others
Sample code
robot.joint_move(joint_pos=[1,0,0,0,0,0],move_mode=1,is_block=False,speed=0.05)#inc
remental motion
print("wait")
[Link](2)
print("stop")
robot.motion_abort()
[Link]()#log out
Get the robot's motion status
get_motion_status()
Return value
Success: (0, data),
int motion_line; ///< the executing motion cmd id
int motion_line_sdk; ///< reserved
BOOL inpos; ///< previous motion cmd is done, should alway check queue info
together
BOOL err_add_line; ///< previous motion cmd is dropped by controller, like target
is already reached
int queue; ///< motion cmd number in buffer
int active_queue; ///< motion cmd number in blending buffer
BOOL queue_full; ///< motion buffer is full and motion cmds reveived at this moment
will be dropped
BOOL paused; ///< motion cmd is paused and able to resume
Failed: Others
To check if the robot is in position
is_in_pos()
Return value
Success: (0, state), state is 1 means location reached, 0 means not.
Failed: Others
Set and Interrogate Robot Operation Information
Get robot status(simple)
get_robot_status_simple()
Return value
Success: (0,data)
errcode: error code
errmsg: error message
powered_on: whether the robot is powered on
enabled: whether the robot is enabled
Failed: Others
Get the monitoring data of the robot status
get_robot_status ()
Return value
Success: (0, robotstatus), where the length of robotstatus data is 24, and the data
are returned in an order as shown below:
errcode the error code in case of a robot error, with 0 representing normal
operation, and others representing abnormal operation
inpos whether the robot is in position, 0 means robot still not move to position, 1
means robot has been moved to position
powered_on whether the robot is powered on, 0 means not powered on, 1 means powered
on
enabled whether the robot is enabled, 0 means not enabled, 1 means enabled
rapidrate robot speed rate
protective_stop whether the robot detects a collision, 0 means no collision
detected, 1 means the opposite
drag_status whether the robot is in drag status, 0 means not in drag status, 1
means the opposite
on_soft_limit whether the robot is on limit, 0 means not triggered limit
protection, 1 means triggered limit protection
current_user_id the current user coordinate frame ID used by the robot
current_tool_id the current tool coordinate frame ID used by the robot
dout robot control cabinet digital output signal
din robot control cabinet digital input signal
aout robot control cabinet analog output signal
ain robot control cabinet analog input signal
tio_dout robot end tool digital output signal
tio_din robot end tool digital input signal
tio_ain robot end tool analog input signal
extio robot external extension IO module signal
cart_position robot end Cartesian space position value
joint_position robot joint space position
robot_monitor_data robot status monitor data (scb major version, scb minor version,
controller temperature, robot average voltage, robot average current, monitor data
of 6 robot joints (transient current, voltage and temperature))
torq_sensor_monitor_data robot torque sensor status monitor data (torque sensor IP
addresses and port numbers, tool payload (payload mass, centroid x-axis, y-axis and
z-axis coordinates), torque sensor status and exception error code, actual contact
force values of 6 torque sensors and original reading values of 6 torque sensors)
is_socket_connect whether the connection channel of SDK and controller is normal, 0
means abnormal connection channel, 1 means normal connection channel
emergency_stop whether the robot is emergency stopped, 0 means not pressed the
emergency-stop button, 1 means the opposite
tio_key Robot end tool button [0] free; [1] point; [2] end light button
Failed: Others
提示:
If the robot has no corresponding IO, it will return such a string as "no extio".
import sys
import jkrc
import time
robot = [Link]("[Link]")
[Link]()
ret = robot.get_robot_status()
if ret[0] == 0:
print("the joint position is :",ret[1])
print(len(ret[1]))
for i in range(len(ret[1])):
print(ret[1][i])
else:
print("some things happend,the errcode is: ",ret[0])
[Link]()
Set robot status data update time interval
Set the robot status data update time interval to change the system occupied
storage, the default is to send as quick as possible to ensure the data is the
newest (4ms).
set_status_data_update_time_interval (millisecond)
Parameters
millisecond: time Parameters, unit: ms。
Return value
Success: (0,)
Failed: Others
Sample code
get_joint_position()
Return value
Success: (0, joint_pos), joint_pos is a tuple of six elements (j1, j2, j3, j4, j5,
j6), j1, j2,j3, j4, j5, j6 the Angle values from joint 1 to joint 6 respectively.
Failed: Others
Sample code
get_tcp_position()
Return value
Success: (0, cartesian_pose), cartesian_pose is a tuple of six elements. (x, y, z,
rx ,ry, rz), x, y, z, rx, ry, rz the pose value of the robot tool end.
Failed: Others
Sample code
get_user_frame_data(id)
Parameters
id id of the user coordinate system
Return value
Success: (0, id, tcp), id: The value range of the user coordinate frame number is
[1,10], where 0 represents robot basic coordinate frame. tcp: Offset value of user
coordinate frame[x,y,z,rx,ry,rz]
Failed: Others
Get user coordinate system ID
get_user_frame_id()
Return value
Success: (0, id). The value range of the id is [0,10], where 0 represents the world
coordinate system.
Failed: Others
Set user coordinate system ID
set_user_frame_id(id)
Parameters
id: user coordinate system ID
Return value
Success: (0,)
Failed: Others
Get the tool ID currently in use
get_tool_id()
Return value
Success: (0, id) where the ID values range from 0 to 10, with 0 representing the
end flange, which has been used by controller.
Failed: Others
Sample code:
set_tool_id(id)
Parameters
id: tool coordinate system ID
Return value
Success: (0,)
Failed: Others
Get target tool coordinate system ID
get_tool_data(id)
Return value
Success: (0, id, tcp), where the ID values range from 0 to 10, with 0 representing
the end flange, which has been used by [Link]: tool coordinate frame
parameter [x,y,z,rx,ry,rz]
Failed: Others
Set digital output value
robot = [Link]("[Link]")
[Link]()
ret = robot.get_digital_output(0,2)
if ret[0] == 0:
print("1the DO2 is :",ret[1])
else:
print("some things happend,the errcode is: ",ret[0])
robot.set_digital_output(IO_CABINET, 2, 1)#set the pin output value of DO2 to 1
[Link](0.1)
ret = robot.get_digital_output(0, 2)
if ret[0] == 0:
print("2the DO2 is :",ret[1])
else:
print("some things happend,the errcode is: ",ret[0])
[Link]() #logout
Set analog output value
import jkrc
IO_CABINET =0 #control cabinet panel IO
IO_TOOL = 1 #tool IO
IO_EXTEND = 2 #extension IO
robot = [Link]("[Link]")
[Link]()
robot.set_analog_output(iotype = IO_CABINET,index = 3,value = 1.55)#
[Link]() #logout
Get digital input status
get_digital_input(iotype, index)
Parameters
iotype: DI type
index: DI index
Return value
Success: (0, value), value: result of DI status
Failed: Others
Get digital output status
get_digital_output(iotype, index)
Parameters
iotype: DO type
index: DO index
Return value
Success: (0, value), value: result of DO status
Failed: Others
Get analog input status
get_analog_input(iotype, index)
Parameters
iotype:AI type
index:AI index
Return value
Success: (0, value), value: the result of AI status, expressed as a floating point
Failed: Others
Get analog output
get_analog_output(type, index)
Parameters
type:AO type
index:AO index
Return value
Success: (0, value), value: the result of AO status, expressed as a floating point
Failed: Others
Sample code:查询 AO4 的值为
import jkrc
IO_CABINET =0 #control cabinet panel IO
IO_TOOL = 1 #tool IO
IO_EXTEND = 2 #extension IO
robot = [Link]("[Link]")
[Link]()
robot.set_analog_output(iotype = IO_CABINET,index = 3,value = 1.55)
ret = robot.get_analog_output(iotype = IO_CABINET,index = 3)
print("AO value is:",ret[1])
[Link]() #logout
Whether the extension IO is running
is_extio_running()
Return value
Success: (0, status), status: 1 means running, 0 means not running
Failed: Others
Set robot payload
get_payload()
Return value
Success: (0, payload)The expression of payload is (mass, (x, y, z)). Payload is a
tuple,whose length is [Link] first element of tuple is the mass of [Link]
second element of tuple is the centroid of payload.
Failed: Others
Sample code:
import jkrc
robot = [Link]("[Link]") #return a robot
[Link]() #login
robot.set_payload(mass= 1,centroid =[0.01,0.02,0.03])
ret = robot.get_payload()
if ret[0] == 0:
print("the payload is :",ret[1])
else:
print("some things happend,the errcode is: ",ret[0])
[Link]()
Set TIO V3 voltage parameters
set_tio_vout_param(vout_enable,vout_vol)
Parameters
vout_enable 0 means off, 1 means on
vout_vol voltage volume 0:24v 1:12v
Return value
Success: (0)
Failed: Others
Get TIO V3 Voltage Parameters
get_tio_vout_param(vout_enable,vout_vol)
Parameters
vout_enable 0 means off, 1 means on
vout_vol voltage volume 0:24v 1:12v
Return value
Success: (0,(vout_enable,vout_vol))
Failed: Others
Get robot state
get_robot_state()
Return value
Success: (0,(estoped, power_on, servo_enabled))
estoped:emergency stop. 0: off, 1: on
power_on:power on. 0: off, 1: on
servo_enabled:servo enable. 0: off, 1: on
Failed: Others
Sample code:
def example_get_robot_state():
_RC_ADDRESS = "[Link]"
rc = [Link](_RC_ADDRESS)
[Link]()
ret, (estoped, power_on, servo_enabled) = rc.get_robot_state()
print('ret is {}, estop: {}, power_on {}, servo_enabled: {}'.format(ret,
estoped, power_on, servo_enabled))
Add or modify TIO signal
add_tio_rs_signal(sign_info)
Parameters
sign_info:dict signal name
Return value
Success: (0,)
Failed: Others
Sample code
def example_add_tio_rs_signal():
rc = [Link](_RC_ADDRESS)
[Link]()
ret = rc.add_tio_rs_signal({
'sig_name': 'signal_tmp', //signal name
'chn_id': 0, //RS485 chanel ID
'sig_type': 0, //semaphore type
'sig_addr': 0x1, //register address
'value': 5, //value invalid when setting
'frequency': 5 //The refresh frequency of semaphore in the controller is
not more than 10.
})
Delete TIO signal
del_tio_rs_signal(sign_name)
Parameters
sign_info: str Signal identification name
Return value
Success: (0,)
Failed: Others
Sample code
def example_del_tio_rs_signal():
rc = [Link](_RC_ADDRESS)
[Link]()
ret = rc.del_tio_rs_signal('signal_tmp')
print('ret is {}'.format(ret))
Send TIO RS485 command
send_tio_rs_command(chn_id, cmd)
Parameters
chn_id:int channel number
data:str data bit
Return value
Success: (0,)
Failed: Others
Sample code
def example_send_tio_rs_command():
rc = [Link](_RC_ADDRESS)
[Link]()
ret = rc.send_tio_rs_command(0x1, "test_cmd")
print('ret is {}'.format(ret))
Get TIO signal information
get_rs485_signal_info()
Return value
Success: (0,sign_info_list) sign_info_list: list semaphore information array
Failed: Others
Sample code
def example_get_rs485_signal_info():
rc = [Link](_RC_ADDRESS)
[Link]()
ret, sign_info_list = rc.get_rs485_signal_info()
print('ret is: {}, sign_info_list: {}'.format(ret, sign_info_list))
# [{'value': 0, 'chn_id': 0, 'sig_addr': 0, 'sig_name': '', 'sig_type': 0,
'frequency': 0}, ...] -> 4.3.26TIO add or modify semaphore
Set TIO mode
set_tio_pin_mode(pin_type, pin_mode)
Parameters
pin_type: tio type. 0 for DI Pins, 1 for DO Pins, 2 for AI Pins
pin_mode: tio mode.
DI Pins: 0:0x00 DI2 is NPN, DI1 is NPN, 1:0x01 DI2 is NPN, DI1 is PNP, 2:0x10 DI2
is PNP, DI1 is NPN, 3:0x11 DI2 is PNP, DI1 is PNP
DO Pins: The lower 8 bits of data and the upper 4 bits are configured as DO2, The
lower four bits are DO1 configuration, 0x0 DO is NPN output, 0x1 DO is PNP output,
0x2 DO is push-pull output, 0xF RS485H interface
AI Pins: Analog input function is enabled, RS485L is disabled, 1:RS485L interface
is enabled and analog input function is disabled.
Return value
Success: (0,)
Failed: Others
Get TIO mode
get_tio_pin_mode(pin_type)
Parameters pin_type: tio type. 0 for DI Pins, 1 for DO Pins, 2 for AI Pins.
Return value
Success: (0,pin_mode)
Failed: Others
Set TIO RS485 Communication Parameters
get_rs485_chn_comm(chn_id)
Return value
Success: (0, (chn_id, slave_id,baudrate, databit, stopbit, parity))
Failed: Others
Set TIO RS485 communication mode
set_rs485_chn_mode(chn_id, chn_mode)
Parameters
chn_id 0: RS485H, channel 1; 1:RS485L, channel 2
chn_mode: 0: Modbus RTU, 1: Raw RS485, 2, torque sensor
Get TIO RS485 communication mode
get_rs485_chn_mode(chn_id)
Parameters
chn_id 0: RS485H, channel 1; 1:RS485L, channel 2
Return value
Success: (0, chn_mode)
chn_mode: 0: Modbus RTU, 1: Raw RS485, 2, torque sensor
Failed: Others
Set robot mounting angle
set_installation_angle(anglex, angley)
Parameters
anglex:the mounting angle is as the x-axis direction, range [0, PI] rad
anglez:the mounting angle is as the z-axis direction, range [0, 360] rad
Return value
Success: (0)
Failed: Others
Sample code:
import jkrc
rc = [Link]("[Link]")
res = [Link]()
if res[0] != 0:
raise "rc login failed."
anglex = 3.14
angley = 0
res = rc.set_installation_angle(anglex, angley)
if res[0] != 0:
raise "set installation angle failed."
res = rc.get_installation_angle()
if res[0] != 0:
raise "get installation angle failed."
print("installation angle:")
print("quat: [{x}, {y}, {z}, {s}]".format(s=res[1][0], x=res[1][1], y=res[1][2],
z=res[1][3]))
print("rpy: [{rx}, {ry}, {rz}]".format(rx=res[1][4], ry=res[1][5], rz=res[1][6]))
[Link]()
Get robot mounting angle
get_installation_angle()
Parameters
anglex:the mounting angle is as the x-axis direction, range [0, PI] rad
anglez:the mounting angle is as the z-axis direction, range [0, 360] rad
Return value
Success: (0, [qs, qx, qy, qz, rx, ry, rz])。Quaternion representing the mounting
angle [qx, qy, qz, qs], Installation angles in Roll-Pitch-Yaw (RPY) format [rx, ry,
rz], ry is fixed to be 0.
Failed: Others。
Sample code
import jkrc
rc = [Link]("[Link]")
res = [Link]()
if res[0] != 0:
raise "rc login failed."
anglex = 3.14
angley = 0
res = rc.set_installation_angle(anglex, angley)
if res[0] != 0:
raise "set installation angle failed."
res = rc.get_installation_angle()
if res[0] != 0:
raise "get installation angle failed."
print("installation angle:")
print("quat: [{x}, {y}, {z}, {s}]".format(s=res[1][0], x=res[1][1], y=res[1][2],
z=res[1][3]))
print("rpy: [{rx}, {ry}, {rz}]".format(rx=res[1][4], ry=res[1][5], rz=res[1][6]))
[Link]()
Set user variables
get_user_var
Return value
Success: (0, data)
Failed: Others
Robot safety status settings
To inquire robot status
is_on_limit()
Return value
Success: (0, state), state 为 1 代表机器人超出限位, 0 则相反
Failed: Others
To inquire whether in collision protection mode
is_in_collision()
Return value
Success: (0, state), state: 1 means in, 0 means not.
Failed: Others
To recover from the collision protection mode
collision_recover()
Return value
Success: (0,)
Failed: Others
Sample code
robot = [Link]("[Link]")
[Link]()
robot.power_on()
robot.enable_robot()
ret = robot.get_collision_level()#get the collision protection level
print(ret)
robot.set_collision_level(1)#set collision protection level
ret = robot.get_collision_level()
print(ret)
num = 0
while(1):
ret = robot.is_in_collision() #To inquire whether in collision protection mode
collision_status = ret[1]
if collision_status == 1:
[Link](5)
robot.collision_recover() #to recover from collision protection mode if
collision happened
print(" in collision "+ str(num))
else:
print("the robot is not in collision "+ str(num))
[Link](1)
num=num+1
[Link]()
Set collision level
set_collision_level(level)
Parameters
Success: (0,)
Failed: Others
Get collision level
get_collision_level()
Return value
Success: level: the collision level.
0: close collision,
1: collision threshold 25N,
2: collision threshold 50N,
3: collision threshold 75N,
4: collision threshold 100N,
5: collision threshold 125N
Failed: Others
get_last_error()
Return value
Success: (0, error)
Failed: Others
Sample code
import jkrc
robot = [Link]("[Link]")#return a robot
[Link]() #login
robot.program_load("not_exist") #Intentionally load a non-existent program, causing
an error
ret = robot.get_last_error ()#Without setting the error code file path, you can
only get the error code, not the specific error information
print(ret[1])
robot.set_errorcode_file_path("D:\\JAKA_ERROR_CODE.csv") #The error file path
cannot contain Chinese
ret = robot.get_last_error () #Get the error code and specific error information
after setting error code file path
[Link]() #logout
Set error code file path
Set the error code file path. If you need to use the get_last_error interface, set
the error code file path. If no need to use the get_last_error interface, do not
set the interface.
Note
Note: The path can not contain any Chinese characters, otherwise it will not work.
set_errorcode_file_path (errcode_file_path)
Parameters
errcode_file_path: where the error code file is stored.
Return value
Success: (0,)
Failed: Others
Clear error status
clear_error()
Return value
Success: (0,)
Failed: Others
Set the robot automatic move termination types upon network exceptions
Set the network exception control handle to control the robot motion status upon
network exceptions.
set_network_exception_handle(millisecond,mnt)
Parameters
millisecond: time parameters, unit:ms。
mnt: the motion types the robot needs to perform upon network exceptions. 0 means
that the robot should keep its current move, 1 means that the robot should pause
its move and 2 means the robot should stop its move.
Return value
Success: (0,)
Failed: Others
Sample code
#motion mode
ABS = 0
INCR= 1
robot = [Link]("[Link]")#return a robot
[Link]()#login
robot.power_on() #power on
robot.enable_robot()
robot.set_network_exception_handle(100,2)#set 100ms, pause motion
print("move1")
num=0
while(1):
robot.joint_move([1,1,1,1,1,1],ABS,False,0.5)
robot.joint_move([-1,1,1,1,1,1],ABS,False,0.5)
num = num +1
print(num)
[Link](6)
[Link]()
Use App Script Program
Load the specified program
program_load(file_name)
Parameters
file_name:program name
Return value
Success: (0,)
Failed: Others
Get the loaded program
get_loaded_program()
Return value
Success: (0, file_name)
Failed: Others
Sample code
import jkrc
robot = [Link]("[Link]")#return a robot
[Link]() #login
ret = robot.program_load("program_test")#load the program_test script written
through the app
ret = robot.get_loaded_program()
print("the loaded program is:",ret[1])
[Link]() #logout
Get current line
get_current_line()
Return value
Success: (0, curr_line), curr_line: the current line number.
Failed: Others
Run the loaded program
program_run()
Return value
Success: (0,)
Failed: Others
Pause the running program
program_pause()
Return value
Success: (0,)
Failed: Others
Resume the program
program_resume()
Return value
Success: (0,)
Failed: Others
Abort the program
program_abort()
Return value
Success: (0,)
Failed: Others
Get the program state
get_program_state()
Return value
Success: (0, state), state:
0 stopped
1 running
2 paused
Failed: Others
Sample code
def print_state(name,robot):
while(1):
ret = robot.get_program_state() #Interrogate the program running status, 0
represents for Program terminated or no program running, 1 represents for Program
running, 2 represents for Pause
print("the robot program state is:",ret[1])
[Link](1)
set_rapidrate(rapid_rate)
Parameters
rapid_rate:set robot rapid rate
Return value
Success: (0,)
Failed: Others
Get rapid rate
get_rapidrate()
Return value
Success: (0, rapidrate), rapid rate is the speed rate, and Returned value is within
a closed interval between 0 and 1
Failed: Others
Trajectory Reproduction
Set trajectory configuration
In setting the trajectory track configuration parameters, you can set the space
position sample accuracy, pose sample accuracy, script execution running speed and
script execution running acceleration.
import jkrc
import time
#coordinate system
COORD_BASE = 0
COORD_JOINT = 1
COORD_TOOL = 2
#motion mode
ABS = 0
INCR= 1
robot = [Link]("[Link]")
[Link]()
robot.power_on()
robot.enable_robot()
robot.joint_move(joint_pos =[1,1,1,1,1,1] ,move_mode = 0 ,is_block = True ,speed =
10 )
print("joint")
robot.set_traj_config([0.1, 0.1, 25, 100]) #Set track recurrence parameters, only
the recording process is valid
[Link](0.1)
ret = robot.get_traj_config()#get trajectory recurrence parameters
print("traj_config:")
print(ret)
robot.set_traj_sample_mode(True, 'pythonTrack')#enable trajectory recurrence
capture
[Link](0.1)
robot.joint_move(joint_pos =[-1,1,1,1,1,1] ,move_mode = 0 ,is_block = True ,speed =
30*3.14/180 )#blocking motion
robot.joint_move(joint_pos =[1,1,1,1,1,1] ,move_mode = 0 ,is_block = True ,speed =
30*3.14/180 )
# [Link](2,INCR,COORD_BASE,10,-2)
# [Link](2,INCR,COORD_BASE,10,2)
robot.set_traj_sample_mode(False, 'pythonTrack')#disable trajectory recurrence
capture
[Link](1)
res = robot.generate_traj_exe_file('pythonTrack')#convert the captured trajectory
files into scripts
print(res)
robot.program_load("track/pythonTrack")#loading trajectory programs
[Link](0.1)
robot.program_run()
Get trajectory configuration
By getting the trajectory track configuration parameters, you can get the space
position sample accuracy, pose sample accuracy, script execution running speed, and
script execution running acceleration.
get_traj_config()
Return value
Success: (0 , ( xyz_interval, rpy_interval, vel, acc))
xyz_interval:Space position acquisition speed
rpy_interval:Orientation capture accuracy
vel:Script execution running speed
acc:Script execution running acceleration
Failed: Others
Set trajectory sample mode
set_traj_sample_mode(mode, filename)
Parameters
mode:Control mode, True means starting data collection, False means ending data
collection.
filename:The name of the file where data are stored.
Return value
Success: (0,)
Failed: Others
Get trajectory sample state
Tip:
It is not allowed to turn on the data collection switch again during the data
collection process.
get_traj_sample_status()
Return value
Success: (0, sample_status), sample_status:Data status, True means data are being
collected, False means data collection has been finished.
Failed: Others
Get exist trajectory file name
get_exist_traj_file_name ()
Return value
Success: (0,)
Failed: Others
Rename exist trajectory file name
remove_traj_file(filename)
Parameters
filename:The name of the file to be deleted
Return value
Success: (0, )
Failed: Others
Sample code
generate_traj_exe_file(filename)
Parameters
filename:The filename of data
Return value
Success: (0, )
Failed: Others
Robot Kinematics
Convert Rpy to rotation matrix
rpy_to_rot_matrix(rpy = [rx,ry,rz])
Parameters
rpy:rpy parameters to be converted[rx,ry,rz]
Return value
Success: (0, rot_matrix), rot_matrix is a 3X3 rotation matirx
Failed: Others
Convert rotation matrix to rpy
rot_matrix_to_rpy(rot_matrix)
Parameters
rot_matrix: Rot matrix data to be converted
Return value
Success: (0, rpy), rpy is a tuple, whose length is 3. The expression of rpy is (rx,
ry, rz).
Failed: Others
Convert quaternion to rotation matrix
kine_forward(joint_pos)
Parameters
joint_pos:Joint space position.
Return value
Success: (0, cartesian_pose), Cartesian_pose is a tuple containing 6 elements
(x,y,z,rx,ry,rz), with x,y,z,rx,ry,rz representing the pose value of robot tool
end.
Failed: Others
Sample code
import jkrc
robot = [Link]("[Link]") #return a robot
[Link]() #login
ret = robot.get_joint_position()
if ret[0] == 0:
print("the joint position is :",ret[1])
else:
print("some things happend,the errcode is: ",ret[0])
joint_pos = ret[1]
robot.kine_forward(joint_pos) #forward kinematics
[Link]() #logout
Convert rotation matrix to quaternion
rot_matrix_to_quaternion(rot_matrix)
Parameters
rot_matrix:3x3 rot matrix to be converted
Return value
Success: (0, quaternion), quaternion is a tuple, whose length is 4. The expression
of quaternion is (w, x, y, z).
Failed: Others
Sample code
import jkrc
robot = [Link]("[Link]")
[Link]()
ret = robot.get_tcp_position()
print(ret)
rpy = [ret[1][3], ret[1][4], ret[1][5]]#get rpy
ret = robot.rpy_to_rot_matrix(rpy)#convert rpy to rot matrix
print(ret)
rot_matrix = ret[1]#get rot matrix
ret = robot.rot_matrix_to_rpy(rot_matrix)#convert rot matrix to rpy
print(ret)
ret = robot.rot_matrix_to_quaternion(rot_matrix)#convert rot matrix to quaternion
print(ret)
quaternion = ret[1]
ret = robot.quaternion_to_rot_matrix(quaternion)#convert rot matrix to quaternion
print(ret)
[Link]()
Robot Servo Mode
Enable robot servo move
servo_move_enable(enable)
Parameters
enable: TRUE means to enter the servo move control mode, FALSE means to quit the
mode.
Return value
Success: (0,)
Failed: Others
Robot servo MoveJ
servo_j(joint_pos, move_mode)
Tips:
Before using this interface the user needs to call servo_move_enable(True) first to
enter the position control mode.
This command is generally used in trajectory planning in university research.
When users use this mode to control the robot motion, the controller planner will
not be involved in the motion interpolation, and the position command will be sent
to the servo directly. Therefore users need to do the trajectory planning by
themselves. Otherwise the robot motion effectiveness can be poor, like violent
shaking, which can not meet the user's expectation.
Since the control cycle time of the controller is 8ms, it is recommended that the
user should send the command with a period of 8ms too, and continuously. There will
be no effect if the command is sent only once. In case of a poor network, the
command can be sent with a period less than 8ms.
The upper limit on the Jaka robot joint speed is 180 radrees per second. If the
joint speed exceeds this limit due to the joint angle that is sent, this command
will then fail. For example, if the joint angle that is sent is
[1.5,0.5,0.5,0.5,0.5,0.5] (here the unit is radree) and the sending period is 8ms,
thus 1.5/0.008 = 187.5 radrees per second, which exceeds the upper limit on the
joint speed. Then the command will be invalid.
After using this command, the user needs to use servo_move_enable(False) to exit
the position control mode.
There is a big difference between this command and the aforementioned joint_move(),
which interpolation is processed by controller, and the user does not need to care
about it. When using servo_j command, users need to make trajectory planning in
advance. Otherwise the effect will be poor and can not meet the expectation. If
there is no special requirement, it is recommended to use joint_move instead of
servo_j on robot joint move control.
Parameters
joint_pos: target robot joint move position.
move_mode: specified move mode: 0 for absolute move, 1 for incremental move
Return value
Success: (0,)
Failed: Others
Sample code
Before using this interface the user needs to call servo_move_enable(True) first to
enter the position control mode.
This command is generally used in trajectory planning in university research.
When users use this mode to control the robot motion, the controller planner will
not be involved in the motion interpolation, and the position command will be sent
to the servo directly. Therefore users need to do the trajectory planning by
themselves. Otherwise the robot motion effectiveness can be poor, like violent
shaking, which can not meet the user's expectation.
Since the control cycle time of the controller is 8ms, it is recommended that the
user should send the command with a period of 8ms too, and continuously. There will
be no effect if the command is sent only once. In case of a poor network, the
command can be sent with a period less than 8ms.
The upper limit on the Jaka robot joint speed is 180 radrees per second. If the
joint speed exceeds this limit due to the joint angle that is sent, this command
will then fail. For example, if the joint angle that is sent is
[1.5,0.5,0.5,0.5,0.5,0.5] (here the unit is radree) and the sending period is 8ms,
thus 1.5/0.008 = 187.5 radrees per second, which exceeds the upper limit on the
joint speed. Then the command will be invalid.
After using this command, the user needs to use servo_move_enable(False) to exit
the position control mode.
There is a big difference between this command and the aforementioned joint_move(),
which interpolation is processed by controller, and the user does not need to care
about it. When using servo_j command, users need to make trajectory planning in
advance. Otherwise the effect will be poor and can not meet the expectation. If
there is no special requirement, it is recommended to use joint_move instead of
servo_j on robot joint move control.
Parameters
joint_pos: target robot joint move position
move_mode: specified move mode: 0 for incremental move, 1 for absolute move
step_num: multiplying period, servo_j move period is step_num*8ms, where
step_num>=1
Return value
Success: (0,)
Failed: Others
Robot Cartesian space servo move
Tips:
Before using this interface the user needs to call servo_move_enable(True) first to
enter the position control mode.
This command is generally used in trajectory planning in university research.
When users use this mode to control the robot motion, the controller planner will
not be involved in the motion interpolation, and after the controller kine inverse
is calculated, the position command will be sent to the servo directly. Therefore
users need to do the trajectory planning himself. Otherwise the robot motion
effectiveness can be poor, like violent shaking, which cannot meet users'
expectation.
Since the control cycle time of the controller is 8ms, it is recommended that the
user should send the command with a period of 8ms too, and continuously. There will
be no effect if the command is sent only once. In case of a poor network, the
command can be sent with a period less than 8ms.
The upper limit on the JAKA robot joint speed is 180 radrees per second. If the
joint speed exceeds this limit due to the position that is sent, this command will
become invalid.
After using this command, the user needs to use servo_move_enable(False) to exit
the position control mode.
There is a big difference between this command and the aforementioned
linear_move(), which interpolation is processed by controller, and the user does
not need to care about it. When using servo_p command, users need to make
trajectory planning in advance. Otherwise the effect will be poor and can not meet
the expectation. If there is no special requirement, it is recommended to use
linear_move instead of servo_p on robot Cartesian space move control.
Parameters
cartesian_pose:Target robot Cartesian space move position.
move_mode:Specified move mode, 0 for absolute move, 1 for incremental move.
Return value
Success: (0,)
Failed: Others
Sample code
PI = 3.14
ABS = 0 # absolute motion
INCR = 1 # incremental motion
Enable = True
Disable = False
Before using this interface the user needs to call servo_move_enable(True) first to
enter the position control mode.
This command is generally used in trajectory planning in university research.
When users use this mode to control the robot motion, the controller planner will
not be involved in the motion interpolation, and after the controller kine inverse
is calculated, the position command will be sent to the servo directly. Therefore
users need to do the trajectory planning himself. Otherwise the robot motion
effectiveness can be poor, like violent shaking, which cannot meet users'
expectation.
Since the control cycle time of the controller is 8ms, it is recommended that the
user should send the command with a period of 8ms too, and continuously. There will
be no effect if the command is sent only once. In case of a poor network, the
command can be sent with a period less than 8ms.
The upper limit on the JAKA robot joint speed is 180 radrees per second. If the
joint speed exceeds this limit due to the position that is sent, this command will
become invalid.
(g) After using this command, the user needs to use servo_move_enable(False) to
exit the position control mode.
(h) There is a big difference between this command and the aforementioned
linear_move(), which interpolation is processed by controller, and the user does
not need to care about it. When using servo_p command, users need to make
trajectory planning in advance. Otherwise the effect will be poor and can not meet
the expectation. If there is no special requirement, it is recommended to use
linear_move instead of servo_p on robot Cartesian space move control.
servo_move_use_none_filter()
Return value
Success: (0,)
Failed: Others
Sample code
servo_move_use_joint_LPF(cutoffFreq)
Parameters
cutoffFreq: First-order low-pass filter cut-off frequency.
Return value
Success: (0,)
Failed: Others
Sample code
set_torsensor_brand(sensor_brand)
Parameters
sensor_brand:The number corresponding to the sensor brand.
Return value
Success: (0,)
Failed: Others
Sample code
set_torque_sensor_mode(sensor_mode)
Parameters
sensor_mode:The sensor working mode, 0 means turning off the F/T sensor, 1 means
turning on the F/T sensor.
Return value
Success: (0,)
Failed: Others
Set compliance control parameters
Parameters
axis: represents the axis number of Cartesian space, with a value range of 0 to 5,
representing the corresponding directions of fx, fy, fz, mx, my and mz,
respectively.
opt: The compliance direction, 0 for turning off, 1 for turning on.
ftUser:The damping force, indicating that how much force the user needs to apply to
make the robot move along a certain direction at the maximum speed.
ftReboundFK: The rebound force, indicating the ability of the robot to return to
its initial state.
ftConstant: The constant force, all of which are set to 0 when manual operation.
ftNormalTrack: The normal tracking, all of which are set to 0 when manual
operation.
Return value
Success: (0,)
Failed: Others
Start to identify the tool end payload
Start to identify the tool end payload, and input a tuple of 6 elements,
representing the 6 joint angles of end position.
start_torq_sensor_payload_identify(joint_pos)
Parameters
joint_pos:the end position for the F/T sensor to do automatic payload
identification, corresponding to 6 joint angles.
Return value
Success: (0,)
Failed: Others
Sample code
get_torq_sensor_identify_status()
Parameters
identify_status:The identification status, 0 means identification completed, 1
means identification uncompleted, 2 means identification failed.
Return value
Success: (0,identify_status)
Failed: Others
Get end payload identification result
Get the end load identification result, and input load quality and centroid
coordinates.
get_torq_sensor_payload_identify_result()
Parameters
mass:payload mass, unit: kg
centroid:load centroid coordinates [x,y,z], unit: mm
Return value
Success: (0,)
Failed: Others
Set sensor end payload
Set the sensor end load, and input load quality and centroid coordinates.
get_torq_sensor_tool_payload ()
Return value
Success: (0,(mass, centroid))
mass:payload mass, unit: kg
centroid:load centroid coordinates [x,y,z], unit: mm
Failed: Others
Force-control admittance enable control
enable_admittance_ctrl (enable_flag)
Parameters
enable_flag:The flag, 0 means turning off force-control drag enable, 1 means
turning on force-control admittance enable.
Return value
Success: (0,)
Failed: Others
Sample code
set_compliant_type(sensor_compensation, compliance_type)
Parameters
sensor_compensation:Turn on sensor compensation enable flag. 1 means on, 0 means
not.
compliance_type:The force control type. 0 means not using any kind of compliance
control method, 1 means using constant compliance control, and 2 means using speed
compliance control.
Return value
Success: (0,)
Failed: Others
Sample code
get_compliant_type()
Return value
Success: (0, sensor_compensation, compliance_type)
sensor_compensation: Turn on sensor compensation enable flag. 1 means turning on
initialization, and 0 means no initialization
compliance_type: The force control type. 0 means not using any kind of compliance
control method, 1 means using constant compliance control, and 2 means using speed
compliance control
Failed: Others
Get the force-control compliance control parameters
By getting the force-control compliance control parameters, you can get the
compliance direction, damping force, rebound force, constant force and normal
tracking which are corresponding to the 6 joints.
get_admit_ctrl_config()
Return value
Success: (0, [[opt, ftUser, ftReboundFK, ftConstant, ftNormanlTrack], ……])
opt: The compliance direction, with an optional value range of 1 to 6,
corresponding to the directions of fx, fy fz, mx, my and mz, respectively, and 0
means no check.
ftUser:The damping force, indicating that how much force the user needs to apply to
make the robot move along a certain direction at the maximum speed.
ftReboundFK: The rebound force, indicating the ability of the robot to return to
its initial state.
ftConstant: The constant force, all of which are set to 0 when manual operation.
ftNormalTrack:The normal tracking, all of which are set to 0 when manual operation.
Failed: Others
Set the F/T sensor IP address
get_torque_sensor_comm()
Return value
Success: (0, ip_addr), ip_addr: the sensor IP address.
Failed: Others
Disable force control
disable_force_control ()
Return value
Success: (0,)
Failed: Others
Set speed compliance control parameters
Set the speed compliance control parameters. There are 3 speed compliance control
levels and 4 rate levels.
When level = 1, only the values of rate1 and rate 2 can be set, and the values of
rate 3 and rates 4 are all zero.
When level =2, only the values of rate1, rate 2 and rate 3 can be set, and the
value of rate 4 is zero.
When level = 3, all the values of rate 1, rate 2, rate 3 and rate 4 can be set.
Return value
Success: (0,)
Failed: Others
Set the compliance control torque conditions
Success: (0,)
Failed: Others
Set the low-pass filter parameters of the force control
Set condition of compliance control torque.
set_torque_sensor_filter(HZ)
Parameters
HZ: low-pass filter parameters, unit:HZ
Return value
Success: (0,)
Failed: Others
Get the low-pass filter parameters of the force control
Set condition of compliance control torque.
get_torque_sensor_filter()
Parameters
HZ: low-pass filter parameters, unit:HZ
Return value
Success: (0,HZ)
Failed: Others
Set the sensor limit parameter configuration of the sensor
Set condition of compliance control torque.
Success: (0,)
Failed: Others
Get the sensor limit parameter configuration of the sensor
Set condition of compliance control torque.
get_torque_sensor_soft_limit()
Return value
Success: (0,(fx,fy,fz,tx,ty,tz))
fx: force along x-axis, unit: N
fy: force along the y-axis, unit: N
fz: force along the z-axis, unit: N
tx: torque around the x-axis, unit: Nm
ty: torque around y-axis, unit: Nm
tz: torque around z-axis, unit: Nm
Failed: Others
Zero calibration of sensor
zero_end_sensor()
Return value
Success: (0,)
Failed: Others
Get tool drive state
get_tool_drive_state()
Return value
Success: (0,enable_flag, drive_state)
enable_flag: 0 is to turn off force control dragging, 1 is to turn it on
drive_state: whether the current state of dragging triggers singularity point,
speed, joint limit warning
Failed: Others
Get the force sensor's coordinate system in drag mode
get_tool_drive_frame()
Return value
Success: (0,ftFrame)
ftFrame: 0 Tool; 1 World
Failed: Others
Set the force sensor's coordinate system in drag mode
set_tool_drive_frame(ftFrame)
Parameters
ftFrame: 0 Tool; 1 World
Return value
Success: (0,)
Failed: Others
Get fusion drive sensitivity
get_fusion_drive_sensitivity_level()
Return value
Success: (0,level)
level: sensitivity level. value: 0-5, 0 means not turned on
Failed: Others
Set fusion drive sensitivity
set_fusion_drive_sensitivity_level(level)
Parameters
level: sensitivity level. value: 0-5, 0 means not turned on
Return value
Success: (0,)
Failed: Others
Get motion limit (singularity and joint limit) warning range
get_motion_limit_warning_range(warningRange)
Return value
Success: (0,warningRange) warningRange: range that will trigger warnings
Failed: Others
Set motion limit (singularity and joint limit) warning range
set_motion_limit_warning_range(warningRange)
Parameters
warningRange: range that will trigger warnings
Return value
Success: (0,)
Failed: Others
Get compliant speed limit
get_compliant_speed_limit(vel, angularvel)
Return value
Success: (0,vel,angularvel)
vel: linear velocity limit, mm/s
angularvel: angular velocity limit, rad/s
Failed: Others
Set compliant speed limit
set_compliant_speed_limit(vel, angularvel)
Parameters
vel: linear velocity limit, mm/s
angularvel: angular velocity limit, rad/s
Return value
Success: (0,)
Failed: Others
Get torque reference center
get_torque_ref_point()
Return value
Success: (0,refpoint)
refpoint: 0 torque sensor center, 1 TCP center
Failed: Others
Set torque reference center
set_torque_ref_point(refpoint)
Parameters
refpoint: 0 torque sensor center, 1 TCP center
Return value
Success: (0,)
Failed: Others
Get end sensor sensitivity
get_end_sensor_sensitivity_threshold ()
Return value
Success: (0,data)
Fx: force on x axis, unit: N
Fy: force on y axis, unit: N
Fz: force on z axis, unit: N
Tx: torque around x axis, unit: Nm
Ty: torque around y axis, unit: Nm
Tz: torque around z axis, unit: Nm
Failed: Others
Set end sensor sensitivity
init_ftp_client()
Return value
Success: (0,)
Failed: Others
Close FTP
close_ftp_client()
Return value
Success: (0,)
Failed: Others
Interrogate the directory of controller FTP
get_ftp_dir(remotedir, type)
Parameters
remotedir:The controller internal folder name
type:0 for file and folder, 1 for file, 2 for folder
Return value
Success: (0,ret) ret is a string
Failed: Others
Sample code
import jkrc
robot = [Link]("[Link]")
[Link]()
dir= "/program/"
#log in the controller and replace [Link] with the IP address of your
controller
robot.init_ftp_client()
result = robot.get_ftp_dir("/program/", 0)
print(result)
robot.close_ftp_client()
[Link]()
Download FTP File
Download the file or folder from Robot control cabinet FTP to your local directory,
and Interrogate track "/track/" and script program "/program/"
import jkrc
robot = [Link]("[Link]")#VMmodel
[Link]()
remote = "/program/"
local= "C:\\Users\\Administrator\\Desktop\\program\\track\\"
robot.init_ftp_client()
result = robot.download_file(local, remote, 2)
print(result)
robot.close_ftp_client()
[Link]()
Upload files to FTP
Upload files with specified types and names from your local directory to
controller.
remote: the absolute filename path to upload the file to controller. Whether a
folder name should be ended with a "" or "/" should depend on the system
local: the local filename absolute path
opt: 1 for single file, 2 for folder
Return value
Success: (0,)
Failed: Others
Sample code:Upload all files and folders from the lxxpro folder on the desktop to
the program/folder of the ftp
import jkrc
robot = [Link]("[Link]")#VMmodel
[Link]()
remote = "/program/"
local= "C:\\Users\\Administrator\\Desktop\\lxxpro\\"
robot.init_ftp_client()
result = robot.upload_file(local, remote, 2)
print(result)
robot.close_ftp_client()
[Link]()
Rename FTP files
Rename controller files with specified types and names.
import jkrc
robot = [Link]("[Link]")#VMmodel
[Link]()
remote = "/lxxpro/"
des = "lxx"
robot.init_ftp_client()
result = robot.rename_ftp_file(remote, des, 2)
print(result)
robot.close_ftp_client()
[Link]()
Delte FTP files
Delte the files of specified types and names in the controller.
del_ftp_file(remote, opt)
Parameters
remote the controller internal filename absolute path. Whether the folder name
should be ended with a "" or "/" should depend on the system.
opt 1 for single file, 2 for folder
Return value
Success: (0,)
Failed: Others
Sample code (Attention: this sample code would delete all programs. Please use it
with caution)
import jkrc
robot = [Link]("[Link]")#VMmodel
[Link]()
dir= "/program/"
robot.init_ftp_client()
result = robot.del_ftp_file("/program/", 2)
print(result)
robot.close_ftp_client()
[Link]()
Feedback## List of Interface Call Return Values and Troubleshooting
Error Code Description Suggested Action
0 success No action needed.
2 Interface error or controller not supported Verify controller and SDK
versions; consider upgrading or using another interface.
-1 Invalid handler Ensure you call the login interface before using it.
-2 Invalid parameter Check if the parameters are correct.
-3 Fail to connect Verify network status or ensure the robot IP is correct.
-4 Kinematic inverse error Check the current coordinate system or reference
joint angles for validity.
-5 Emergency stop E-stop status; reserved state.
-6 Not powered on Power the robot.
-7 Not enabled Enable the robot.
-8 Not in servo mode Ensure servo mode is enabled before calling servoJP.
-9 Must turn off enable before power off Disable before powering off.
-10 Cannot operate, program is running Stop the running program first.
-11 Cannot open file, or file doesn't exist Check if the file exists or can be
accessed.
-12 Motion abnormal Check for singularities or movements exceeding robot
limits.
-14 FTP error Investigate FTP connection issues.
-15 Socket message or value oversize Ensure parameters are within acceptable
limits.
-16 Kinematic forward error Verify inputs for forward kinematics.
-17 Not support empty folder Avoid using empty folders.
-20 Protective stop Investigate and address protective stop conditions.
-21 Emergency stop Check and reset the emergency stop.
-22 On soft limit Use the teaching feature in the robot app to exit soft
limits.
-30 Fail to encode command string Likely an error in parsing controller messages.
-31 Fail to decode command string Check for errors in controller message parsing.
-32 Fail to uncompress port 10004 string Possible network fluctuation or
data overflow.
-40 Move linear error Verify the path avoids singularity regions.
-41 Move joint error Ensure joint angles are valid.
-42 Move circular error Check the circular motion parameters.
-50 Block wait timeout Verify and increase wait timeout if needed.
-51 Power on timeout Check the power-on process.
-52 Power off timeout Check the power-off process.
-53 Enable timeout Review the enabling process.
-54 Disable timeout Review the disabling process.
-55 Set user frame timeout Check the user frame settings.
-56 Set tool timeout Verify the tool coordinate settings.
-60 Set IO timeout Ensure IO configurations are correct.
Let me know if you'd like additional details or assistance!