top of page

Python 12.18. Force sensor load identification code example

from fairino import Robot
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
company = 24
device = 0
softversion = 0
bus = 1
index = 1
robot.FT_SetConfig(company, device, softversion, bus)
time.sleep(1)
error,[company, device, softversion, bus] = robot.FT_GetConfig()
print(f"FT config:{company},{device},{softversion},{bus}")
time.sleep(1)
robot.FT_Activate(0)
time.sleep(1)
robot.FT_Activate(1)
time.sleep(1)
robot.FT_SetZero(0)
time.sleep(1)
error,ft = robot.FT_GetForceTorqueOrigin()
print(f"ft origin:{ft[0]},{ft[1]},{ft[2]},{ft[3]},{ft[4]},{ft[5]}")
robot.FT_SetZero(1)
time.sleep(1)
tcoord = [0035.0000]
robot.SetToolCoord(10, tcoord, 1000)
robot.FT_PdIdenRecord(10)
time.sleep(1)
error,weight = robot.FT_PdIdenCompute()
print(f"payload weight:{weight}")
desc_p1 = [-419.524-13.000351.569-178.1180.3143.833]
desc_p2 = [-321.222185.189335.520-179.030-1.284-29.869]
desc_p3 = [-327.622402.230320.402-178.0672.127-46.207]
robot.MoveCart(desc_p1, 00100.0)
time.sleep(1)
robot.FT_PdCogIdenRecord(101)
robot.MoveCart(desc_p2, 00100.0)
time.sleep(1)
robot.FT_PdCogIdenRecord(102)
robot.MoveCart(desc_p3, 00100.0)
time.sleep(1)
robot.FT_PdCogIdenRecord(103)
time.sleep(1)
error,cog = robot.FT_PdCogIdenCompute()
print(f"FT_PdCogIdenCompute return {error}")
print(f"cog:{cog[0]},{cog[1]},{cog[2]}")
robot.CloseRPC()

12.19. Collision Guard

Prototype

FT_Guard(flag,sensor_num,select,force_torque,max_threshold,min_threshold)

description

collision guarding

Required Parameters

  • flag: 0 - turn off collision guarding, 1 - turn on collision guarding;

  • sensor_num: force sensor number;

  • select: whether or not the six degrees of freedom detect collisions [fx,fy,fz,mx,my,mz], 0 - not valid, 1 - valid;

  • force_torque: collision detection force/torque in N or Nm;

  • max_threshold: maximum threshold;

  • min_threshold: minimum threshold;

  • Force/torque detection range: (force_torque-min_threshold,force_torque+max_threshold)

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

12.20. Collision guard code example

from fairino import Robot
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
company = 24
device = 0
softversion = 0
bus = 1
index = 1
robot.FT_SetConfig(company, device, softversion, bus)
time.sleep(1)
error,[company, device, softversion, bus] = robot.FT_GetConfig()
print(f"FT config:{company},{device},{softversion},{bus}")
time.sleep(1)
robot.FT_Activate(0)
time.sleep(1)
robot.FT_Activate(1)
time.sleep(1)
robot.FT_SetZero(0)
time.sleep(1)
sensor_id = 1
select = [111111]
max_threshold = [10.010.010.010.010.010.0]
min_threshold = [5.05.05.05.05.05.0]
ft = None
desc_p1 = [-419.524-13.000351.569-178.1180.3143.833]
desc_p2 = [-321.222185.189335.520-179.030-1.284-29.869]
desc_p3 = [-327.622402.230320.402-178.0672.127-46.207]
error = robot.FT_Guard(1, sensor_id, select,[0.0,0.0,0.0,0.0,0.0,0.0], max_threshold, min_threshold)
robot.MoveCart(desc_p1, 00100.0)
robot.MoveCart(desc_p2, 00100.0)
robot.MoveCart(desc_p3, 00100.0)
robot.FT_Guard(0, sensor_id, select,[0.0,0.0,0.0,0.0,0.0,0.0], max_threshold, min_threshold)
robot.CloseRPC()

12.21. constant force control

prototype

FT_Control(flag, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang, M=None, B=None, threshold=[0.2,0.2], adjustCoeff=[1.0,1.0], polishRadio=0, filter_Sign=0, posAdapt_sign=0, isNoBlock=0)

Description

Constant force control

Mandatory parameter

  • flag: constant force control on flag, 0-off, 1-on;

  • sensor_id: force sensor number;

  • select: whether the six degrees of freedom are detected [fx,fy,fz,mx,my,mz], 0 - not valid, 1 - valid;

  • ft: detection of force/torque in N or Nm;

  • ft_pid: [f_p,f_i,f_d,m_p,m_i,m_d], force PID parameter, moment PID parameter;

  • adj_sign: adaptive start/stop state, 0-off, 1-on;

  • ILC_sign: ILC control start/stop status, 0-stop, 1-training, 2-practical;

  • max_dis: maximum adjustment distance;

  • max_ang: maximum angle of adjustment;

Default parameters

  • M:Quality parameters;

  • B:Damping parameter;

  • threshold:Activation threshold for rx, ry [0-10], default 0.2;

  • adjustCoeff:Torque adjustment coefficient for rx, ry [0-1], default 1;

  • polishRadio:Grinding disc radius, unit: mm;

  • filter_Sign:Filter on indicator 0- off; 1- On, default 0- off;

  • posAdapt_sign:The posture conforms to the opening mark 0-off. 1- On, default 0- off;

  • isNoBlock:Block flag, 0- block; 1- Non-blocking default 0- blocking;

Return Value

Error Code Success-0 Failure- errcode

12.22. A code example of constant force control with damping

from fairino import Robot
import time
robot = Robot.RPC('192.168.58.2')
sensor_id = 10
select = [001000]
ft_pid = [0.00080.00.00.00.00.0]
adj_sign = 0
ILC_sign = 0
max_dis = 1000.0
max_ang = 20.0
ft = [0.0* 6
epos = [0.0* 4
j1 = [80.765-98.795106.548-97.734-89.99994.842]
j2 = [43.067-84.42992.620-98.175-90.01157.144]
desc_p1 = [5.009-547.463262.053-179.999-0.01975.923]
desc_p2 = [-347.966-547.463262.048-180.000-0.01975.923]
offset_pos = [0.0* 6= [2.02.0]
B = [15.015.0]
threshold = [1.01.0]
adjustCoeff = [1.00.8]
polishRadio = 0.0
filter_Sign = 0
posAdapt_sign = 1
isNoBlock = 0
ft[2= -10.0
while True:
    rtn = robot.FT_Control(1, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang, M, B, threshold,adjustCoeff, 0010)
    print(f"FT_Control start rtn is {rtn}")
    rtn = robot.MoveL(desc_pos=desc_p1, tool=1, user=0, vel=100, acc=100, ovl=100, blendR=-1, blendMode = 0, exaxis_pos=epos, search=0, offset_flag=0, offset_pos=offset_pos)
    rtn = robot.MoveL(desc_pos=desc_p2, tool=1, user=0, vel=100, acc=100, ovl=100, blendR=-1, blendMode = 0, exaxis_pos=epos, search=0, offset_flag=0, offset_pos=offset_pos)
    rtn = robot.FT_Control(0, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang, M, B, threshold,adjustCoeff, 0010)
    print(f"FT_Control end rtn is {rtn}")
robot.CloseRPC()
return 0

12.23. Helix Exploration

Prototype

FT_SpiralSearch(rcs, ft, dr=0.7, max_t_ms=60000, max_vel=5)

Description

Helix Explorations

Mandatory parameters

  • rcs: reference coordinate system, 0 - tool coordinate system, 1 - base coordinate system

  • ft: force or moment threshold (0 to 100) in N or Nm;

Default parameters

  • dr: radius feed per revolution in mm Default 0.7.

  • max_t_ms: maximum time to explore, in ms default 60000.

  • max_vel: maximum value of linear velocity in mm/s Default 5

Return Value

Error Code Success-0 Failure- errcode

12.24. Rotational Insertion

Prototype

FT_RotInsertion(rcs, ft, orn, angVelRot=3, angleMax=45, angAccmax=0, rotorn=1, strategy=0)

Description

Rotational Insertion

Required Parameters

  • rcs: Reference coordinate system, 0 - Tool coordinate system, 1 - Base coordinate system;

  • ft: Force or torque threshold (0~100), unit N or Nm;

  • orn: Force/torque direction, 1 - Along Z-axis direction, 2 - Around Z-axis direction;

Default Parameters

  • angVelRot: Rotational angular velocity, unit °/s, default 3;

  • angleMax: Maximum rotation angle, unit °, default 45;

  • angAccmax: Maximum rotational acceleration, unit °/s^2, currently unused, default 0;

  • rotorn: Rotation direction, 1 - Clockwise, 2 - Counterclockwise, default 1;

  • strategy: Processing strategy for undetected force/torque, 0 - Error; 1 - Warning, continue motion

Return Value

Error code. Success - 0, Failure - errcode

12.25. Code Example for Spiral Search, Linear Insertion, and Other Commands

from fairino import Robot
import time
robot = Robot.RPC('192.168.58.2')
j1=[-11.904,-99.669,117.473,-108.616,-91.726,74.256]
j2=[-45.615,-106.172,124.296,-107.151,-91.282,74.255]
j3=[-29.777,-84.536,109.275,-114.075,-86.655,74.257]
j4=[-31.154,-95.317,94.276,-88.079,-89.740,74.256]
desc_pos1=[-419.524,-13.000,351.569,-178.118,0.314,3.833]
desc_pos2=[-321.222,185.189,335.520,-179.030,-1.284,-29.869]
desc_pos3=[-487.434,154.362,308.576,176.600,0.268,-14.061]
desc_pos4=[-443.165,147.881,480.951,179.511,-0.775,-15.409]
offset_pos=[0.0]*6
epos=[0.0]*4
tool=0
user=0
vel=100.0
acc=100.0
ovl=100.0
oacc=100.0
blendT=0.0
blendR=0.0
flag=0
search=0
blendMode=0
velAccMode=0
robot.SetSpeed(20)
rtn=robot.MoveJ(joint_pos=j1,tool=tool,user=user,vel=vel,acc=acc,ovl=ovl,exaxis_pos=epos,blendT=blendT,offset_flag=flag,offset_pos=offset_pos)
print(f"movejerrcode:{rtn}")
rtn=robot.MoveL(desc_pos=desc_pos2,tool=tool,user=user,vel=vel,acc=acc,ovl=ovl,blendR=blendR,blendMode=blendMode,exaxis_pos=epos,search=search,offset_flag=flag,offset_pos=offset_pos,oacc=oacc,velAccParamMode=velAccMode)
print(f"movelerrcode:{rtn}")
rtn=robot.MoveC(desc_pos_p=desc_pos3,tool_p=tool,user_p=user,vel_p=vel,acc_p=acc,exaxis_pos_p=epos,offset_flag_p=flag,offset_pos_p=offset_pos,desc_pos_t=desc_pos4,tool_t=tool,user_t=user,vel_t=vel,acc_t=acc,exaxis_pos_t=epos,offset_flag_t=flag,offset_pos_t=offset_pos,ovl=ovl,blendR=blendR,oacc=oacc,velAccParamMode=velAccMode)
print(f"movecerrcode:{rtn}")
rtn=robot.MoveJ(joint_pos=j2,tool=tool,user=user,vel=vel,acc=acc,ovl=ovl,exaxis_pos=epos,blendT=blendT,offset_flag=flag,offset_pos=offset_pos)
print(f"movejerrcode:{rtn}")
rtn=robot.Circle(desc_pos_p=desc_pos3,tool_p=tool,user_p=user,vel_p=vel,acc_p=acc,exaxis_pos_p=epos,desc_pos_t=desc_pos1,tool_t=tool,user_t=user,vel_t=vel,acc_t=acc,exaxis_pos_t=epos,ovl=ovl,offset_flag=flag,offset_pos=offset_pos,oacc=oacc,blendR=-1,velAccParamMode=velAccMode)
print(f"circleerrcode:{rtn}")
rtn=robot.MoveCart(desc_pos=desc_pos4,tool=tool,user=user,vel=vel,acc=acc,ovl=ovl,blendT=blendT,config=-1)
print(f"MoveCarterrcode:{rtn}")
rtn=robot.MoveJ(joint_pos=j1,tool=tool,user=user,vel=vel,acc=acc,ovl=ovl,exaxis_pos=epos,blendT=blendT,offset_flag=flag,offset_pos=offset_pos)
print(f"movejerrcode:{rtn}")
rtn=robot.MoveL(desc_pos=desc_pos2,tool=tool,user=user,vel=vel,acc=acc,ovl=ovl,blendR=blendR,blendMode=blendMode,exaxis_pos=epos,search=search,offset_flag=flag,offset_pos=offset_pos,config=-1,velAccParamMode=velAccMode)
print(f"movelerrcode:{rtn}")
rtn=robot.MoveC(desc_pos_p=desc_pos3,tool_p=tool,user_p=user,vel_p=vel,acc_p=acc,exaxis_pos_p=epos,offset_flag_p=flag,offset_pos_p=offset_pos,desc_pos_t=desc_pos4,tool_t=tool,user_t=user,vel_t=vel,acc_t=acc,exaxis_pos_t=epos,offset_flag_t=flag,offset_pos_t=offset_pos,ovl=ovl,blendR=blendR,config=-1,velAccParamMode=velAccMode)
print(f"movecerrcode:{rtn}")
rtn=robot.MoveJ(joint_pos=j2,tool=tool,user=user,vel=vel,acc=acc,ovl=ovl,exaxis_pos=epos,blendT=blendT,offset_flag=flag,offset_pos=offset_pos)
print(f"movejerrcode:{rtn}")
rtn=robot.Circle(desc_pos_p=desc_pos3,tool_p=tool,user_p=user,vel_p=vel,acc_p=acc,exaxis_pos_p=epos,desc_pos_t=desc_pos1,tool_t=tool,user_t=user,vel_t=vel,acc_t=acc,exaxis_pos_t=epos,ovl=ovl,offset_flag=flag,offset_pos=offset_pos,oacc=oacc,blendR=-1,velAccParamMode=velAccMode)
print(f"circleerrcode:{rtn}")
robot.CloseRPC()
return 0

12.26. Linear insertion

prototype

FT_LinInsertion(rcs, ft, disMax, linorn, lin_v=1.0, lin_a=1.0)

Description

Linear Insertion

Mandatory parameters

  • rcs: reference coordinate system, 0 - tool coordinate system, 1 - base coordinate system;

  • ft: force or moment threshold (0 to 100) in N or Nm.

  • disMax: maximum insertion distance in mm.

  • linorn: insertion direction: 0-negative direction, 1-positive direction

Default parameters

  • lin_v: linear velocity in mm/s Default 1.

  • lin_a: linear acceleration in mm/s^2, not used yet Default 1

Return Value

Error Code Success-0 Failure- errcode


robotic arm
FAIRINO ROBOTIC ARMS

Contact

Location: 10637 Scripps Summit Court,

San Diego, CA. 92131
Phone: (619) 333-FAIR
Email: hello@fairino.us

© 2023 Fairino US official site Proudly created By G2T

bottom of page