12. Force Control
12.1. Force Sensor Configuration
Prototype |
|
|---|---|
Description |
Force Sensor Configuration |
Required Parameters |
|
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
12.2. Get Force Sensor Configuration
Prototype |
|
|---|---|
Description |
Get Force Sensor Configuration |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
12.3. Force sensor activation
Prototype |
|
|---|---|
Description |
Force sensor activation |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.4. Force Sensor Zeroing
Prototype |
|
|---|---|
Description |
Force Transducer Zeroing |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.5. Setting the force transducer reference coordinate system
Changed in version python: SDK-v2.0.5
prototype |
|
|---|---|
Description |
Setting the force transducer reference coordinate system |
Mandatory parameters |
|
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
12.6. Setting the load weight under the force transducer
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Set the load weight under the force transducer |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.7. Setting the load center of mass under the force transducer
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Setting the center of mass of the load under the force transducer |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.8. Getting the load weight under the force transducer
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Get the weight of the load under the force transducer. |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
12.9. Obtaining the center of mass of the load under the force transducer
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Getting the center of mass of the load under the force transducer |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
12.10. Automatic zeroing of force sensors
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Automatic zeroing of force sensors |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
12.11. Obtaining force/torque data in the reference coordinate system
Prototype |
|
|---|---|
Description |
Get force/torque data in reference coordinate system |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
12.12. Obtaining Force Sensor Raw Force/Torque Data
Prototype |
|
|---|---|
Description |
Get force sensor raw force/torque data |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
12.13. Force sensor configuration and automatic zero correction code example
1from fairino import Robot
2# Establish a connection with the robot controller and return a robot object if the connection is successful
3robot = Robot.RPC('192.168.58.2')
4company = 24
5device = 0
6softversion = 0
7bus = 1
8index = 1
9robot.FT_SetConfig(company, device, softversion, bus)
10time.sleep(1)
11error,[company, device, softversion, bus] = robot.FT_GetConfig()
12print(f"FT config:{company},{device},{softversion},{bus}")
13time.sleep(1)
14robot.FT_Activate(0)
15time.sleep(1)
16robot.FT_Activate(1)
17time.sleep(1)
18time.sleep(1)
19robot.FT_SetZero(0)
20time.sleep(1)
21error,ft = robot.FT_GetForceTorqueOrigin()
22print(f"ft origin:{ft[0]},{ft[1]},{ft[2]},{ft[3]},{ft[4]},{ft[5]}")
23robot.FT_SetZero(1)
24time.sleep(1)
25ftCoord = [0, 0, 0, 0, 0, 0]
26robot.FT_SetRCS(0, ftCoord)
27robot.SetForceSensorPayload(0.824)
28robot.SetForceSensorPayloadCog(0.778, 2.554, 48.765)
29error,weight = robot.GetForceSensorPayload()
30error,x, y, z = robot.GetForceSensorPayloadCog()
31print(f"the FT load is {weight}, {x} {y} {z}")
32robot.SetForceSensorPayload(0)
33robot.SetForceSensorPayloadCog(0, 0, 0)
34error,computeWeight, tran = robot.ForceSensorAutoComputeLoad()
35print(f"the result is weight {computeWeight} pos is {tran[0]} {tran[1]} {tran[2]}")
36robot.CloseRPC()
12.14. Load weight identification records
Prototype |
|
|---|---|
Description |
Load weight identification record |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.15. Load weight identification calculation
Prototype |
|
|---|---|
Description |
Load weight identification calculation |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
12.16. Load center of mass identification records
prototype |
|
|---|---|
Description |
Load center of mass identification record |
Mandatory parameter |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.17. Load center of mass identification calculation
Prototype |
|
|---|---|
Description |
Load center of mass identification calculation |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
12.18. Force sensor load identification code example
1from fairino import Robot
2# Establish a connection with the robot controller and return a robot object if the connection is successful
3robot = Robot.RPC('192.168.58.2')
4company = 24
5device = 0
6softversion = 0
7bus = 1
8index = 1
9robot.FT_SetConfig(company, device, softversion, bus)
10time.sleep(1)
11error,[company, device, softversion, bus] = robot.FT_GetConfig()
12print(f"FT config:{company},{device},{softversion},{bus}")
13time.sleep(1)
14robot.FT_Activate(0)
15time.sleep(1)
16robot.FT_Activate(1)
17time.sleep(1)
18robot.FT_SetZero(0)
19time.sleep(1)
20error,ft = robot.FT_GetForceTorqueOrigin()
21print(f"ft origin:{ft[0]},{ft[1]},{ft[2]},{ft[3]},{ft[4]},{ft[5]}")
22robot.FT_SetZero(1)
23time.sleep(1)
24tcoord = [0, 0, 35.0, 0, 0, 0]
25robot.SetToolCoord(10, tcoord, 1, 0, 0, 0)
26robot.FT_PdIdenRecord(10)
27time.sleep(1)
28error,weight = robot.FT_PdIdenCompute()
29print(f"payload weight:{weight}")
30desc_p1 = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
31desc_p2 = [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869]
32desc_p3 = [-327.622, 402.230, 320.402, -178.067, 2.127, -46.207]
33robot.MoveCart(desc_p1, 0, 0, 100.0)
34time.sleep(1)
35robot.FT_PdCogIdenRecord(10, 1)
36robot.MoveCart(desc_p2, 0, 0, 100.0)
37time.sleep(1)
38robot.FT_PdCogIdenRecord(10, 2)
39robot.MoveCart(desc_p3, 0, 0, 100.0)
40time.sleep(1)
41robot.FT_PdCogIdenRecord(10, 3)
42time.sleep(1)
43error,cog = robot.FT_PdCogIdenCompute()
44print(f"FT_PdCogIdenCompute return {error}")
45print(f"cog:{cog[0]},{cog[1]},{cog[2]}")
46robot.CloseRPC()
12.19. Collision Guard
Prototype |
|
|---|---|
description |
collision guarding |
Required Parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.20. Collision guard code example
1from fairino import Robot
2# Establish a connection with the robot controller and return a robot object if the connection is successful
3robot = Robot.RPC('192.168.58.2')
4company = 24
5device = 0
6softversion = 0
7bus = 1
8index = 1
9robot.FT_SetConfig(company, device, softversion, bus)
10time.sleep(1)
11error,[company, device, softversion, bus] = robot.FT_GetConfig()
12print(f"FT config:{company},{device},{softversion},{bus}")
13time.sleep(1)
14robot.FT_Activate(0)
15time.sleep(1)
16robot.FT_Activate(1)
17time.sleep(1)
18robot.FT_SetZero(0)
19time.sleep(1)
20sensor_id = 1
21select = [1, 1, 1, 1, 1, 1]
22max_threshold = [10.0, 10.0, 10.0, 10.0, 10.0, 10.0]
23min_threshold = [5.0, 5.0, 5.0, 5.0, 5.0, 5.0]
24ft = None
25desc_p1 = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
26desc_p2 = [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869]
27desc_p3 = [-327.622, 402.230, 320.402, -178.067, 2.127, -46.207]
28error = robot.FT_Guard(1, sensor_id, select,[0.0,0.0,0.0,0.0,0.0,0.0], max_threshold, min_threshold)
29robot.MoveCart(desc_p1, 0, 0, 100.0)
30robot.MoveCart(desc_p2, 0, 0, 100.0)
31robot.MoveCart(desc_p3, 0, 0, 100.0)
32robot.FT_Guard(0, sensor_id, select,[0.0,0.0,0.0,0.0,0.0,0.0], max_threshold, min_threshold)
33robot.CloseRPC()
12.21. constant force control
prototype |
|
|---|---|
Description |
Constant force control |
Mandatory parameter |
|
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
12.22. A code example of constant force control with damping
1from fairino import Robot
2import time
3robot = Robot.RPC('192.168.58.2')
4sensor_id = 10
5select = [0, 0, 1, 0, 0, 0]
6ft_pid = [0.0008, 0.0, 0.0, 0.0, 0.0, 0.0]
7adj_sign = 0
8ILC_sign = 0
9max_dis = 1000.0
10max_ang = 20.0
11ft = [0.0] * 6
12epos = [0.0] * 4
13j1 = [80.765, -98.795, 106.548, -97.734, -89.999, 94.842]
14j2 = [43.067, -84.429, 92.620, -98.175, -90.011, 57.144]
15desc_p1 = [5.009, -547.463, 262.053, -179.999, -0.019, 75.923]
16desc_p2 = [-347.966, -547.463, 262.048, -180.000, -0.019, 75.923]
17offset_pos = [0.0] * 6
18M = [2.0, 2.0]
19B = [15.0, 15.0]
20threshold = [1.0, 1.0]
21adjustCoeff = [1.0, 0.8]
22polishRadio = 0.0
23filter_Sign = 0
24posAdapt_sign = 1
25isNoBlock = 0
26ft[2] = -10.0
27while True:
28 rtn = robot.FT_Control(1, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang, M, B, threshold,adjustCoeff, 0, 0, 1, 0)
29 print(f"FT_Control start rtn is {rtn}")
30 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)
31 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)
32 rtn = robot.FT_Control(0, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang, M, B, threshold,adjustCoeff, 0, 0, 1, 0)
33 print(f"FT_Control end rtn is {rtn}")
34robot.CloseRPC()
35return 0
12.23. Helix Exploration
Prototype |
|
|---|---|
Description |
Helix Explorations |
Mandatory parameters |
|
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
12.24. Rotational Insertion
Prototype |
|
|---|---|
Description |
Rotational Insertion |
Required Parameters |
|
Default Parameters |
|
Return Value |
Error code. Success - 0, Failure - errcode |
12.25. Code Example for Spiral Search, Linear Insertion, and Other Commands
1from fairino import Robot
2import time
3robot = Robot.RPC('192.168.58.2')
4j1=[-11.904,-99.669,117.473,-108.616,-91.726,74.256]
5j2=[-45.615,-106.172,124.296,-107.151,-91.282,74.255]
6j3=[-29.777,-84.536,109.275,-114.075,-86.655,74.257]
7j4=[-31.154,-95.317,94.276,-88.079,-89.740,74.256]
8desc_pos1=[-419.524,-13.000,351.569,-178.118,0.314,3.833]
9desc_pos2=[-321.222,185.189,335.520,-179.030,-1.284,-29.869]
10desc_pos3=[-487.434,154.362,308.576,176.600,0.268,-14.061]
11desc_pos4=[-443.165,147.881,480.951,179.511,-0.775,-15.409]
12offset_pos=[0.0]*6
13epos=[0.0]*4
14tool=0
15user=0
16vel=100.0
17acc=100.0
18ovl=100.0
19oacc=100.0
20blendT=0.0
21blendR=0.0
22flag=0
23search=0
24blendMode=0
25velAccMode=0
26robot.SetSpeed(20)
27rtn=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)
28print(f"movejerrcode:{rtn}")
29rtn=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)
30print(f"movelerrcode:{rtn}")
31rtn=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)
32print(f"movecerrcode:{rtn}")
33rtn=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)
34print(f"movejerrcode:{rtn}")
35rtn=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)
36print(f"circleerrcode:{rtn}")
37rtn=robot.MoveCart(desc_pos=desc_pos4,tool=tool,user=user,vel=vel,acc=acc,ovl=ovl,blendT=blendT,config=-1)
38print(f"MoveCarterrcode:{rtn}")
39rtn=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)
40print(f"movejerrcode:{rtn}")
41rtn=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)
42print(f"movelerrcode:{rtn}")
43rtn=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)
44print(f"movecerrcode:{rtn}")
45rtn=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)
46print(f"movejerrcode:{rtn}")
47rtn=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)
48print(f"circleerrcode:{rtn}")
49robot.CloseRPC()
50return 0
12.26. Linear insertion
prototype |
|
|---|---|
Description |
Linear Insertion |
Mandatory parameters |
|
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
12.27. Examples of instruction code for spiral exploration, straight line insertion, etc
1from fairino import Robot
2# Establish a connection with the robot controller and return a robot object if the connection is successful
3robot = Robot.RPC('192.168.58.2')
4company = 24
5device = 0
6softversion = 0
7bus = 1
8index = 1
9robot.FT_SetConfig(company, device, softversion, bus)
10time.sleep(1)
11error,[company, device, softversion, bus] = robot.FT_GetConfig()
12print(f"FT config:{company},{device},{softversion},{bus}")
13time.sleep(1)
14robot.FT_Activate(0)
15time.sleep(1)
16robot.FT_Activate(1)
17time.sleep(1)
18robot.FT_SetZero(0)
19time.sleep(1)
20status = 1
21sensor_num = 1
22gain = [0.0001, 0.0, 0.0, 0.0, 0.0, 0.0]
23adj_sign = 0
24ILC_sign = 0
25max_dis = 100.0
26max_ang = 5.0
27ft = [0.0,0.0,-10.0,0.0,0.0,0.0]
28rcs = 0
29dr = 0.7
30fFinish = 1.0
31t = 60000.0
32vmax = 3.0
33force_goal = 20.0
34lin_v = 0.0
35lin_a = 0.0
36disMax = 100.0
37linorn = 1
38angVelRot = 2.0
39forceInsertion = 1.0
40angleMax = 45
41orn = 1
42angAccmax = 0.0
43rotorn = 1
44select1 = [0, 0, 1, 1, 1, 0]
45robot.FT_Control(status, sensor_num, select1, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
46rtn = robot.FT_SpiralSearch(rcs, dr, fFinish, t, vmax)
47print(f"FT_SpiralSearch rtn is {rtn}")
48robot.FT_Control(0, sensor_num, select1, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
49select2 = [1, 1, 1, 0, 0, 0]
50gain[0] = 0.00005
51ft[2] = -30.0
52robot.FT_Control(1, sensor_num, select2, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
53rtn = robot.FT_LinInsertion(rcs, force_goal, lin_v, lin_a, disMax, linorn)
54print(f"FT_LinInsertion rtn is {rtn}")
55robot.FT_Control(0, sensor_num, select2, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
56select3 = [0, 0, 1, 1, 1, 0]
57ft[2] = -10.0
58gain[0] = 0.0001
59robot.FT_Control(1, sensor_num, select3, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
60rtn = robot.FT_RotInsertion(rcs, angVelRot, forceInsertion, angleMax, orn, angAccmax, rotorn)
61print(f"FT_RotInsertion rtn is {rtn}")
62robot.FT_Control(0, sensor_num, select3, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
63select4 = [1, 1, 1, 0, 0, 0]
64ft[2] = -30.0
65robot.FT_Control(1, sensor_num, select4, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
66rtn = robot.FT_LinInsertion(rcs, force_goal, lin_v, lin_a, disMax, linorn)
67print(f"FT_LinInsertion rtn is {rtn}")
68robot.FT_Control(0, sensor_num, select4, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
69robot.CloseRPC()
12.28. Surface positioning
prototype |
|
|---|---|
Description |
Surface Positioning |
Mandatory parameters |
|
Default Parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
12.29. Calculation of the center plane position begins
Prototype |
|
|---|---|
Description |
Calculation of mid-plane position begins |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.30. Calculate end of mid-plane position
Prototype |
|
|---|---|
Description |
End of calculation of mid-plane position |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode
- |
12.31. Sample code for surface localization
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5company = 24
6device = 0
7softversion = 0
8bus = 1
9index = 1
10robot.FT_SetConfig(company, device, softversion, bus)
11time.sleep(1)
12error,[company, device, softversion, bus] = robot.FT_GetConfig()
13print(f"FT config:{company},{device},{softversion},{bus}")
14time.sleep(1)
15robot.FT_Activate(0)
16time.sleep(1)
17robot.FT_Activate(1)
18time.sleep(1)
19robot.FT_SetZero(0)
20time.sleep(1)
21rcs = 0
22dir = 1
23axis = 1
24lin_v = 3.0
25lin_a = 0.0
26maxdis = 50.0
27ft_goal = 2.0
28desc_pos = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
29xcenter = [0, 0, 0, 0, 0, 0]
30ycenter = [0, 0, 0, 0, 0, 0]
31ft = [-2.0, 0.0, 0.0, 0.0, 0.0, 0.0]
32robot.MoveCart(desc_pos, 9, 0, 100.0)
33robot.FT_CalCenterStart()
34robot.FT_FindSurface(rcs, dir, axis, lin_v, lin_a, maxdis, ft_goal)
35robot.MoveCart(desc_pos, 9, 0)
36robot.WaitMs(1000)
37dir = 2
38robot.FT_FindSurface(rcs, dir, axis, lin_v, lin_a, maxdis, ft_goal)
39error,xcenter = robot.FT_CalCenterEnd()
40print(f"xcenter:{xcenter[0]},{xcenter[1]},{xcenter[2]},{xcenter[3]},{xcenter[4]},{xcenter[5]}")
41robot.MoveCart(xcenter, 9, 0, 60.0)
42robot.FT_CalCenterStart()
43dir = 1
44axis = 2
45lin_v = 6.0
46maxdis = 150.0
47robot.FT_FindSurface(rcs, dir, axis, lin_v, lin_a, maxdis, ft_goal)
48robot.MoveCart(desc_pos, 9, 0, 100.0)
49robot.WaitMs(1000)
50dir = 2
51robot.FT_FindSurface(rcs, dir, axis, lin_v, lin_a, maxdis, ft_goal)
52error,ycenter = robot.FT_CalCenterEnd()
53print(f"ycenter:{ycenter[0]},{ycenter[1]},{ycenter[2]},{ycenter[3]},{ycenter[4]},{ycenter[5]}")
54robot.MoveCart(ycenter, 9, 0, 60.0)
55robot.CloseRPC()
12.32. Soft control on
Prototype |
|
|---|---|
Description |
Softening control on |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.33. Soft control off
Prototype |
|
|---|---|
Description |
Softening control off |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.34. Soft control code example
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5company = 24
6device = 0
7softversion = 0
8bus = 1
9index = 1
10robot.FT_SetConfig(company, device, softversion, bus)
11time.sleep(1)
12error,[company, device, softversion, bus] = robot.FT_GetConfig()
13print(f"FT config:{company},{device},{softversion},{bus}")
14time.sleep(1)
15robot.FT_Activate(0)
16time.sleep(1)
17robot.FT_Activate(1)
18time.sleep(1)
19robot.FT_SetZero(0)
20time.sleep(1)
21flag = 1
22sensor_id = 1
23select = [1, 1, 1, 0, 0, 0]
24ft_pid = [0.0005, 0.0, 0.0, 0.0, 0.0, 0.0]
25adj_sign = 0
26ILC_sign = 0
27max_dis = 100.0
28max_ang = 0.0
29ft = [-10.0, -10.0, -10.0, 0.0, 0.0, 0.0]
30offset_pos = [0.0,0.0,0.0,0.0,0.0,0.0] # 替代 DescPose(0, 0, 0, 0, 0, 0)
31epos = [0.0,0.0,0.0,0.0] # 替代 ExaxisPos(0, 0, 0, 0)
32j1 = [-11.904, -99.669, 117.473, -108.616, -91.726, 74.256] # JointPos
33j2 = [-45.615, -106.172, 124.296, -107.151, -91.282, 74.255]
34desc_p1 = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833] # DescPose
35desc_p2 = [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869]
36robot.FT_Control(flag, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
37p = 0.00005
38force = 30.0
39rtn = robot.FT_ComplianceStart(p, force)
40print(f"FT_ComplianceStart rtn is {rtn}")
41count = 3
42while count > 0:
43 robot.MoveL(desc_pos=desc_p1,tool= 0,user= 0,vel= 100.0)
44 robot.MoveL(desc_pos=desc_p2,tool= 0,user= 0,vel= 100.0)
45 count -= 1
46robot.FT_ComplianceStop()
47print(f"FT_ComplianceStop rtn is {rtn}")
48flag = 0
49robot.FT_Control(flag, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
50robot.CloseRPC()
12.35. Load recognition filter initialization
New in version python: SDK-v2.0.1
Prototype |
|
|---|---|
Description |
Load Recognition Filter Initialization |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.36. Initialization of load recognition variables
New in version python: SDK-v2.0.1
Prototype |
|
|---|---|
Description |
Load Identification Variable Initialization |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.37. Load Recognition Main Program
New in version python: SDK-v2.0.1
Prototype |
|
|---|---|
Description |
Load Recognition Master Program |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.38. Getting Load Recognition Results
New in version python: SDK-v2.0.1
Prototype |
|
|---|---|
Description |
Get load identification results |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
12.39. Robot load identification code example
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5retval = robot.LoadIdentifyDynFilterInit()
6print(f"LoadIdentifyDynFilterInit retval is: {retval}")
7retval = robot.LoadIdentifyDynVarInit()
8print(f"LoadIdentifyDynVarInit retval is: {retval}")
9error, posJ = robot.GetActualJointPosDegree(0)
10posJ[1] += 10 # Modify joint 2
11error, joint_toq = robot.GetJointTorques(0)
12joint_toq[1] += 2 # Modify torque on joint 2
13tmpTorque = joint_toq.copy()
14retval = robot.LoadIdentifyMain(tmpTorque, posJ, 1)
15print(f"LoadIdentifyMain retval is: {retval}")
16gain = [0, 0.05, 0, 0, 0, 0, 0, 0.02, 0, 0, 0, 0]
17weight = [0.0]
18load_pos = [0.0, 0.0, 0.0]
19retval, weight, load_pos = robot.LoadIdentifyGetResult(gain)
20print(f"LoadIdentifyGetResult retval is: {retval} ; weight is {weight} cog is {load_pos[0]} {load_pos[1]} {load_pos[2]}")
21robot.CloseRPC()
12.40. Force Sensor Assisted Drag
New in version python: SDK-v2.1.3
Prototype |
|
|---|---|
Description |
Force Sensor Assisted Drag |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.41. Get force sensor drag switch status
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Get force sensor drag switch status |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
12.42. The force sensor turns on automatically after the error is cleared.
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
The force sensor turns on automatically after an error is cleared. |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.43. Force sensor assisted drag code example
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5robot.SetForceSensorDragAutoFlag(1)
6M = [15.0, 15.0, 15.0, 0.5, 0.5, 0.1]
7B = [150.0, 150.0, 150.0, 5.0, 5.0, 1.0]
8K = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9F = [10.0, 10.0, 10.0, 1.0, 1.0, 1.0]
10robot.EndForceDragControl(1, 0, 0, 0, M, B, K, F, 50, 100)
11time.sleep(5)
12drag_state = 0
13six_dimensional_drag_state = 0
14error,drag_state, six_dimensional_drag_state = robot.GetForceAndTorqueDragState()
15print(f"the drag state is {drag_state} {six_dimensional_drag_state}")
16robot.EndForceDragControl(0, 0, 0, 0, M, B, K, F, 50, 100)
17robot.CloseRPC()
12.44. Setting up hybrid drag switches and parameters for six-dimensional force and joint impedance
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Setting up the six-dimensional force and joint impedance hybrid drag switch and parameters |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.45. Six dimensional force and joint impedance mixed drag code example
1from fairino import Robot
2import time
3# Establish a connection with the robot controller and return a robot object if the connection is successful
4robot = Robot.RPC('192.168.58.2')
5robot.DragTeachSwitch(1)
6lamde_dain = [3.0, 2.0, 2.0, 2.0, 2.0, 3.0]
7k_gain = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
8b_gain = [150.0, 150.0, 150.0, 5.0, 5.0, 1.0]
9rtn = robot.ForceAndJointImpedanceStartStop(1, 0, lamde_dain, k_gain, b_gain, 1000, 180)
10print(f"ForceAndJointImpedanceStartStop rtn is {rtn}")
11time.sleep(5)
12robot.DragTeachSwitch(0)
13rtn = robot.ForceAndJointImpedanceStartStop(0, 0, lamde_dain, k_gain, b_gain, 1000, 180)
14print(f"ForceAndJointImpedanceStartStop rtn is {rtn}")
15robot.CloseRPC()
12.46. Impedance start and stop control
New in version python: SDK-v2.1.6
Prototype |
|
|---|---|
Description |
Impedance start and stop control |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
12.47. Example code for impedance start and stop control
1from fairino import Robot
2# Establish a connection with the robot controller and return a robot object if the connection is successful
3robot = Robot.RPC('192.168.58.2')
4j1 = [102.622, -135.990, 120.769, -73.950, -90.848, 35.507]
5j2 = [93.674, -80.062, 82.947, -92.199, -90.967, 26.559]
6desc_pos1 = [136.552, -149.799, 449.532, 179.817, -1.172, 157.123]
7desc_pos2 = [136.540, -561.048, 449.542, 179.819, -1.172, 157.122]
8offset_pos = [0.0] * 6
9epos = [0.0] * 4
10tool = 0
11user = 0
12vel = 100.0
13acc = 200.0
14ovl = 100.0
15blendT = -1.0
16blendR = -1.0
17flag = 0
18search = 0
19robot.SetSpeed(20)
20company = 17
21device = 0
22softversion = 0
23bus = 1
24robot.FT_SetConfig(company, device, softversion, bus)
25time.sleep(1)
26rnt,[company, device, softversion, bus] = robot.FT_GetConfig()
27print(f"FT config:{company},{device},{softversion},{bus}")
28time.sleep(1)
29robot.FT_Activate(0)
30time.sleep(1)
31robot.FT_Activate(1)
32time.sleep(1)
33time.sleep(1)
34robot.FT_SetZero(0)
35time.sleep(1)
36robot.FT_SetZero(1)
37time.sleep(1)
38forceThreshold = [30.0, 30.0, 30.0, 5.0, 5.0, 5.0]
39m = [0.1, 0.1, 0.1, 0.02, 0.02, 0.02]
40b = [1.0, 1.0, 1.0, 0.08, 0.08, 0.08]
41k = [0.0] * 6
42rtn = robot.ImpedanceControlStartStop(1, 1, forceThreshold, m, b, k, 1000, 500, 100, 100)
43print(f"ImpedanceControlStartStop errcode:{rtn}")
44rtn = robot.MoveL(desc_pos=desc_pos1,tool= tool,user= user,vel= vel,speedPercent=1)
45rtn = robot.MoveL(desc_pos=desc_pos2,tool= tool,user= user,vel= vel,speedPercent=1)
46rtn = robot.MoveL(desc_pos=desc_pos1,tool= tool,user= user,vel= vel,speedPercent=1)
47rtn = robot.MoveL(desc_pos=desc_pos2,tool= tool,user= user,vel= vel,speedPercent=1)
48rtn = robot.MoveL(desc_pos=desc_pos1,tool= tool,user= user,vel= vel,speedPercent=1)
49rtn = robot.MoveL(desc_pos=desc_pos2,tool= tool,user= user,vel= vel,speedPercent=1)
50print(f"movel errcode:{rtn}")
51robot.ImpedanceControlStartStop(0, 1, forceThreshold, m, b, k, 1000, 500, 100, 100)
52robot.CloseRPC()
12.48. Enable Torque Compensation Function and Compensation Coefficients
Prototype |
|
|---|---|
Description |
Enable Torque Compensation Function and Compensation Coefficients |
Required Parameters |
|
Default Parameters |
None |
Return Value |
Error code 0-Success Error- errcode |