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)
status = 1
sensor_num = 1
gain = [0.0001, 0.0, 0.0, 0.0, 0.0, 0.0]
adj_sign = 0
ILC_sign = 0
max_dis = 100.0
max_ang = 5.0
ft = [0.0,0.0,-10.0,0.0,0.0,0.0]
rcs = 0
dr = 0.7
fFinish = 1.0
t = 60000.0
vmax = 3.0
force_goal = 20.0
lin_v = 0.0
lin_a = 0.0
disMax = 100.0
linorn = 1
angVelRot = 2.0
forceInsertion = 1.0
angleMax = 45
orn = 1
angAccmax = 0.0
rotorn = 1
select1 = [0, 0, 1, 1, 1, 0]
robot.FT_Control(status, sensor_num, select1, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
rtn = robot.FT_SpiralSearch(rcs, dr, fFinish, t, vmax)
print(f"FT_SpiralSearch rtn is {rtn}")
robot.FT_Control(0, sensor_num, select1, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
select2 = [1, 1, 1, 0, 0, 0]
gain[0] = 0.00005
ft[2] = -30.0
robot.FT_Control(1, sensor_num, select2, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
rtn = robot.FT_LinInsertion(rcs, force_goal, lin_v, lin_a, disMax, linorn)
print(f"FT_LinInsertion rtn is {rtn}")
robot.FT_Control(0, sensor_num, select2, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
select3 = [0, 0, 1, 1, 1, 0]
ft[2] = -10.0
gain[0] = 0.0001
robot.FT_Control(1, sensor_num, select3, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
rtn = robot.FT_RotInsertion(rcs, angVelRot, forceInsertion, angleMax, orn, angAccmax, rotorn)
print(f"FT_RotInsertion rtn is {rtn}")
robot.FT_Control(0, sensor_num, select3, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
select4 = [1, 1, 1, 0, 0, 0]
ft[2] = -30.0
robot.FT_Control(1, sensor_num, select4, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
rtn = robot.FT_LinInsertion(rcs, force_goal, lin_v, lin_a, disMax, linorn)
print(f"FT_LinInsertion rtn is {rtn}")
robot.FT_Control(0, sensor_num, select4, ft, gain, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0)
robot.CloseRPC()
12.28. Surface positioning
prototype | FT_FindSurface (rcs, dir, axis, disMax, ft, lin_v=3.0, lin_a=0.0) |
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 | FT_CalCenterStart() |
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 | FT_CalCenterEnd() |
Description | End of calculation of mid-plane position |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode - pos=[x,y,z,rx,ry,rz]: mid-plane position |
12.31. Sample code for surface localization
from fairino import Robot
import time
# 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)
rcs = 0
dir = 1
axis = 1
lin_v = 3.0
lin_a = 0.0
maxdis = 50.0
ft_goal = 2.0
desc_pos = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
xcenter = [0, 0, 0, 0, 0, 0]
ycenter = [0, 0, 0, 0, 0, 0]
ft = [-2.0, 0.0, 0.0, 0.0, 0.0, 0.0]
robot.MoveCart(desc_pos, 9, 0, 100.0)
robot.FT_CalCenterStart()
robot.FT_FindSurface(rcs, dir, axis, lin_v, lin_a, maxdis, ft_goal)
robot.MoveCart(desc_pos, 9, 0)
robot.WaitMs(1000)
dir = 2
robot.FT_FindSurface(rcs, dir, axis, lin_v, lin_a, maxdis, ft_goal)
error,xcenter = robot.FT_CalCenterEnd()
print(f"xcenter:{xcenter[0]},{xcenter[1]},{xcenter[2]},{xcenter[3]},{xcenter[4]},{xcenter[5]}")
robot.MoveCart(xcenter, 9, 0, 60.0)
robot.FT_CalCenterStart()
dir = 1
axis = 2
lin_v = 6.0
maxdis = 150.0
robot.FT_FindSurface(rcs, dir, axis, lin_v, lin_a, maxdis, ft_goal)
robot.MoveCart(desc_pos, 9, 0, 100.0)
robot.WaitMs(1000)
dir = 2
robot.FT_FindSurface(rcs, dir, axis, lin_v, lin_a, maxdis, ft_goal)
error,ycenter = robot.FT_CalCenterEnd()
print(f"ycenter:{ycenter[0]},{ycenter[1]},{ycenter[2]},{ycenter[3]},{ycenter[4]},{ycenter[5]}")
robot.MoveCart(ycenter, 9, 0, 60.0)
robot.CloseRPC()
12.32. Soft control on
Prototype | FT_ComplianceStart(p, force) |
Description | Softening control on |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
12.33. Soft control off
Prototype | FT_ComplianceStop() |
Description | Softening control off |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
12.34. Soft control code example
from fairino import Robot
import time
# 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 =