4. Movement
4.1. jog point and click
Prototype |
|
|---|---|
description |
jog dot motion |
Mandatory parameters |
|
Default Parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
4.2. jog tap to decelerate and stop
Prototype |
|
|---|---|
description |
jog nudging deceleration stop |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.3. Immediate stop for jog taps
Prototype |
|
|---|---|
Description |
jog nudging stops immediately |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.4. Robot point 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')
5for i in range(6):
6 robot.StartJOG(0, i + 1, 0, 20.0, 20.0, 30.0)
7 time.sleep(1)
8 robot.ImmStopJOG()
9 time.sleep(1)
10for i in range(6):
11 robot.StartJOG(2, i + 1, 0, 20.0, 20.0, 30.0)
12 time.sleep(1)
13 robot.ImmStopJOG()
14 time.sleep(1)
15for i in range(6):
16 robot.StartJOG(4, i + 1, 0, 20.0, 20.0, 30.0)
17 time.sleep(1)
18 robot.StopJOG(5)
19 time.sleep(1)
20for i in range(6):
21 robot.StartJOG(8, i + 1, 0, 20.0, 20.0, 30.0)
22 time.sleep(1)
23 robot.StopJOG(9)
24 time.sleep(1)
25robot.CloseRPC()
4.5. Joint space motion
prototype |
|
|---|---|
description |
joint space motion |
Mandatory parameters |
|
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
4.6. Cartesian Space Linear Motion
New in version python: SDK-v2.1.5
Prototype |
|
|---|---|
Description |
Cartesian Space Linear Motion |
Required Parameters |
|
Default Parameters |
|
Return Value |
Error code 0-Success Error- errcode |
4.7. Cartesian Space Circular Arc Motion
New in version python: SDK-v2.1.5
Prototype |
|
|---|---|
Description |
Cartesian Space Circular Arc Motion |
Required Parameters |
|
Default Parameters |
|
Return Value |
Error code 0-Success Error- errcode |
4.8. Cartesian Space Full Circle Motion
New in version python: SDK-v2.1.5
Prototype |
|
|---|---|
Description |
Cartesian Space Full Circle Motion |
Required Parameters |
|
Default Parameters |
|
Return Value |
Error code 0-Success Error- errcode |
4.9. Point-to-point motion in Cartesian space
Prototype |
|
|---|---|
Description |
Point-to-point motion in Cartesian space |
Mandatory parameters |
|
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
4.10. Sample robot basic motion commands code
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"movej errcode:{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"movel errcode:{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"movec errcode:{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"movej errcode:{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"circle errcode:{rtn}")
37rtn = robot.MoveCart(desc_pos=desc_pos4, tool=tool, user=user, vel=vel, acc=acc,ovl=ovl, blendT=blendT, config=-1)
38print(f"MoveCart errcode:{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"movej errcode:{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"movel errcode:{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"movec errcode:{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"movej errcode:{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"circle errcode:{rtn}")
49robot.CloseRPC()
50return 0
4.11. Spiral motion in Cartesian space
New in version python: SDK-v2.1.7
Prototype |
|
|---|---|
Description |
Spiral motion in Cartesian space |
Mandatory parameters |
|
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
4.12. 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')
4j = [67.957, -81.482, 87.595, -95.691, -94.899, -9.727]
5desc_pos = [-123.142, -551.735, 430.549, 178.753, -4.757, 167.754]
6offset_pos1 = [50.0, 0.0, 0.0, -30.0, 0.0, 0.0]
7offset_pos2 = [50.0, 0.0, 0.0, -30.0, 0.0, 0.0]
8epos = [0.0] * 4
9sp = [2, 30.0, 50.0, 10.0, 10.0, 0, 1] # [circle_num, circle_angle, rad_init, rad_add, rotaxis_add, rot_direction, velAccMode]
10tool = 0
11user = 0
12vel = 30.0
13acc = 60.0
14ovl = 100.0
15blendT = -1.0
16flag = 2
17robot.SetSpeed(20)
18rtn = robot.MoveJ(joint_pos=j, tool=tool, user=user, vel=vel, acc=acc, ovl=ovl, exaxis_pos=epos, blendT=blendT, offset_flag=flag, offset_pos=offset_pos1)
19print(f"movej errcode:{rtn}")
20rtn = robot.NewSpiral(desc_pos=desc_pos, tool=tool, user=user, vel=vel, acc=acc, exaxis_pos=epos, ovl=ovl, offset_flag=flag, offset_pos=offset_pos2, param=sp)
21print(f"newspiral errcode:{rtn}")
22robot.CloseRPC()
23return 0
4.13. Servo Motion Start
Prototype |
|
|---|---|
Description |
Start servo motion, used with ServoJ and ServoCart commands |
Required Parameters |
|
Default Parameters |
None |
Return Value |
Error code Success-0 Failure-errcode |
4.14. Servo Motion End
Prototype |
|
|---|---|
Description |
End servo motion, used with ServoJ and ServoCart commands |
Required Parameters |
|
Default Parameters |
None |
Return Value |
Error code Success-0 Failure-errcode |
4.15. Joint Space Servo Mode Motion
Prototype |
|
|---|---|
Description |
Joint space servo mode motion |
Required Parameters |
|
Default Parameters |
|
Return Value |
Error code Success-0 Failure-errcode |
4.16. UDP Communication-Based ServoJ, ServoMoveStart, ServoMoveEnd SDK Code Example
1from time import sleep
2import time
3from fairino import Robot
4
5# Establish connection with robot controller
6robot = Robot.RPC('192.168.58.2')
7
8def TestServoJUDP(self):
9 # Set callback
10 def callback(src_type, count, cmd_id, data_len, content):
11 print("Callback function: cmd_id={} count={} data_len={} content={}".format(cmd_id, count, data_len, content))
12 return 0
13
14 robot.SetUDPCmdRpyCallback(callback)
15 # # Initialize joint position and external axis position
16 j= [105, -108, 74, -66, -88.893, -1.621]
17 offset_pos = [0, 0, 0, 0, 0, 0]
18 epos = [0, 0, 0, 0]
19 # # Move to initial position
20 result=robot.MoveJ(joint_pos=j, tool=0, user=0, vel=100, acc=100, ovl=100,exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
21 print("MoveJ return result: {}".format(result))
22 vel = 0.0
23 acc = 0.0
24 cmdT = 0.016
25 filterT = 0.0
26 gain = 0.0
27 flag = 0
28 dt = 0.1
29 cmdID = 0
30
31 # Get current joint position
32 ret, j = robot.GetActualJointPosDegree(flag)
33 if ret != 0:
34 print(f"GetActualJointPosDegree errcode:{ret}")
35 while 1:
36 count = 300
37 result = robot.ServoMoveStart(cmdType=1)
38 print("ServoMoveStart return result: {}".format(result))
39 while count > 0:
40 result = robot.ServoJ(joint_pos=j, axisPos=epos, acc=acc, vel=vel, cmdT=cmdT,filterT=filterT, gain=gain, id=cmdID, cmdType=1)
41 j[0] += dt
42 j[1] += dt
43 j[2] += dt
44 j[3] += dt
45 j[4] += dt
46 j[5] += dt
47 count -= 1
48 time.sleep(0.01)
49 result = robot.ServoMoveEnd(cmdType=1)
50 print("ServoMoveEnd return result: {}".format(result))
51
52 count = 300
53 result = robot.ServoMoveStart(cmdType=1)
54 print("ServoMoveStart return result: {}".format(result))
55 while count > 0:
56 result = robot.ServoJ(joint_pos=j, axisPos=epos, acc=acc, vel=vel, cmdT=cmdT,filterT=filterT, gain=gain, id=cmdID, cmdType=1)
57 j[0] -= dt
58 j[1] -= dt
59 j[2] -= dt
60 j[3] -= dt
61 j[4] -= dt
62 j[5] -= dt
63 count -= 1
64 time.sleep(0.01)
65 result = robot.ServoMoveEnd(cmdType=1)
66 print("ServoMoveEnd return result: {}".format(result))
67 robot.CloseRPC()
68 return 0
69TestServoJUDP(robot)
4.17. Example of joint space servo mode motion code
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')
4j = [0.0] * 6
5epos = [0.0] * 4
6vel = 0.0
7acc = 0.0
8cmdT = 0.008
9filterT = 0.0
10gain = 0.0
11flag = 0
12count = 500
13dt = 0.1
14cmdID = 0
15ret, j = robot.GetActualJointPosDegree(flag)
16if ret == 0:
17 cmdID += 1
18 robot.ServoMoveStart()
19 while count:
20 robot.ServoJ(joint_pos=j,axisPos= epos,acc= acc,vel= vel, cmdT=cmdT, filterT=filterT, gain=gain, id=cmdID)
21 j[4] += dt
22 count -= 1
23 time.sleep(cmdT)
24 rtn,pkg = robot.GetRobotRealTimeState()
25 print(f"Servoj Count {pkg.servoJCmdNum}; last pos is {pkg.lastServoTarget[0]},{pkg.lastServoTarget[1]},{pkg.lastServoTarget[2]},{pkg.lastServoTarget[3]},{pkg.lastServoTarget[4]},{pkg.lastServoTarget[5]}")
26
27 if count < 50:
28 robot.MotionQueueClear()
29 print(f"After queue clear, Servoj Count {pkg.servoJCmdNum}; last pos is {pkg.lastServoTarget[0]},{pkg.lastServoTarget[1]},{pkg.lastServoTarget[2]},{pkg.lastServoTarget[3]},{pkg.lastServoTarget[4]},{pkg.lastServoTarget[5]}")
30 break
31 robot.ServoMoveEnd()
32else:
33 print(f"GetActualJointPosDegree errcode:{ret}")
34robot.CloseRPC()
4.18. Joint Torque Control Start
Prototype |
|
|---|---|
Description |
Start joint torque control |
Required Parameters |
|
Default Parameters |
None |
Return Value |
Error code Success-0 Failure-errcode |
4.19. Joint Torque Control
Prototype |
|
|---|---|
Description |
Joint torque control |
Required Parameters |
|
Default Parameters |
None |
Return Value |
Error code Success-0 Failure-errcode |
4.20. Joint Torque Control End
Prototype |
|
|---|---|
Description |
End joint torque control |
Required Parameters |
|
Default Parameters |
None |
Return Value |
Error code Success-0 Failure-errcode |
4.21. UDP Communication-Based ServoJT, ServoJTStart, ServoJTEnd SDK Code Example
1from time import sleep
2import time
3from fairino import Robot
4
5# Establish connection with robot controller
6robot = Robot.RPC('192.168.58.2')
7
8def TestServoJTUDP(self):
9 # Set callback
10 def callback(src_type, count, cmd_id, data_len, content):
11 print("Callback function: cmd_id={} count={} data_len={} content={}".format(cmd_id, count, data_len, content))
12 return 0
13
14 robot.SetUDPCmdRpyCallback(callback)
15 while True:
16 # Initialize joint position and external axis position
17 j = [0, -90, 90, 0, 0, 0]
18 epos = [0, 0, 0, 0]
19 offset_pos = [0, 0, 0, 0, 0, 0]
20
21 # Move to initial position
22 robot.MoveJ(joint_pos=j, tool=0, user=0, vel=100, acc=100, ovl=100,
23 exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
24 time.sleep(3)
25 # Enable drag teaching
26 result=robot.DragTeachSwitch(1)
27 print("DragTeachSwitch return result: {}".format(result))
28 torques = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
29
30 # Get joint torques
31 ret, torques = robot.GetJointTorques(flag=1)
32 if ret != 0:
33 print(f"GetJointTorques errcode:{ret}")
34
35 count = 100
36 result = robot.ServoJTStart(cmdType=1)
37 print("ServoJTStart return result: {}".format(result))
38 # Forward torque control
39 while True:
40 torques[0] = 0.03
41 result = robot.ServoJT(
42 torque=torques,
43 interval=0.001,
44 checkFlag=0,
45 jPowerLimit=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
46 jVelLimit=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
47 cmdType=1
48 )
49 print("Return result: {}".format(result))
50 time.sleep(1)
51
52 ret, pkg = robot.GetRobotRealTimeState()
53 if pkg.jt_cur_pos[0] > 30:
54 break
55
56 # Reverse torque control
57 while True:
58 torques[0] = -0.03
59 result = robot.ServoJT(
60 torque=torques,
61 interval=0.001,
62 checkFlag=0,
63 jPowerLimit=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
64 jVelLimit=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
65 cmdType=1
66 )
67 print("Return result: {}".format(result))
68 time.sleep(1)
69
70 ret, pkg = robot.GetRobotRealTimeState()
71 if pkg.jt_cur_pos[0] < 0:
72 break
73
74 # End torque control and disable drag teaching
75 result = robot.ServoJTEnd(cmdType=1)
76 print("ServoJTEnd return result: {}".format(result))
77 result = robot.DragTeachSwitch(0)
78 print("DragTeachSwitch return result: {}".format(result))
79
80 robot.CloseRPC()
81 return 0
82TestServoJTUDP(robot)
4.22. Sample code for joint torque 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')
4robot.DragTeachSwitch(1)
5# torques = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
6error,torques = robot.GetJointTorques(1)
7robot.ServoJTStart()
8count = 100
9while count > 0:
10 error = robot.ServoJT(torques, 0.001)
11 count -= 1
12 time.sleep(0.001)
13error = robot.ServoJTEnd()
14robot.DragTeachSwitch(0)
15robot.CloseRPC()
4.23. Joint Torque Control Code Example with Overspeed Protection
1from fairino import Robot
2import time
3robot = Robot.RPC('192.168.58.2')
4robot.ResetAllError()
5time.sleep(0.5)
6torques = [0.0] * 6
7rtn, torques = robot.GetJointTorques(1)
8robot.ServoJTStart()
9robot.DragTeachSwitch(1)
10checkFlag = 3
11jPowerLimit = [10.0, 10.0, 10.0, 10.0, 10.0, 10.0]
12jVelLimit = [181,80,80,80,80,80]
13count = 800000
14error = 0
15while count > 0:
16 torques[2] = torques[2] + 0.01
17 error = robot.ServoJT(torques, 0.008, checkFlag, jPowerLimit, jVelLimit)
18 print(f"ServoJT rtn is {error}")
19 count = count - 1
20 time.sleep(0.001)
21 rtn,pkg = robot.GetRobotRealTimeState()
22 print(f"maincode {pkg.main_code},subcode {pkg.sub_code}")
23robot.DragTeachSwitch(0)
24error = robot.ServoJTEnd()
4.24. Cartesian Space Servo Mode Motion
Prototype |
|
|---|---|
Description |
Cartesian space servo mode motion |
Required Parameters |
|
Default Parameters |
|
Return Value |
Error code Success-0 Failure- errcode |
4.25. Cartesian Space Servo Mode Motion Code Example
1from fairino import Robot
2import time
3robot = Robot.RPC('192.168.58.2')
4desc_pos_dt = [83.00800, 50.525000, 29.246, 179.629, -7.138, -166.975]
5exaxis = [100.0, 0.0, 0.0, 0.0]
6pos_gain = [0.0] * 6
7mode = 0
8vel = 0.0
9acc = 0.0
10cmdT = 0.001
11filterT = 0.0
12gain = 0.0
13flag = 0
14count = 5000
15robot.SetSpeed(20)
16while count:
17 rtn = robot.ServoCart(mode, desc_pos_dt, exaxis, pos_gain, acc, vel, cmdT, filterT, gain)
18 print(f"ServoCart rtn is {rtn}")
19 count -= 1
20 desc_pos_dt[0] += 0.01
21 exaxis[0] += 0.01
22robot.CloseRPC()
23return 0
4.26. Start of spline motion
Prototype |
|
|---|---|
Description |
Sample movement begins |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.27. Sample motion PTP
Prototype |
|
|---|---|
Description |
Sample Motion PTP |
Mandatory parameters |
|
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
4.28. End of spline motion
Prototype |
|
|---|---|
Description |
End of spline motion |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.29. Spline motion 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')
4joint_points = [
5 [-11.904, -99.669, 117.473, -108.616, -91.726, 74.256], # j1
6 [-45.615, -106.172, 124.296, -107.151, -91.282, 74.255], # j2
7 [-61.954, -84.409, 108.153, -116.316, -91.283, 74.260], # j3
8 [-89.575, -80.276, 102.713, -116.302, -91.284, 74.267] # j4
9]
10cart_points = [
11 [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833], # desc_pos1
12 [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869], # desc_pos2
13 [-327.622, 402.230, 320.402, -178.067, 2.127, -46.207], # desc_pos3
14 [-104.066, 544.321, 327.023, -177.715, 3.371, -73.818] # desc_pos4
15]
16offset_pos = [0] * 6
17epos = [0] * 4
18tool = user = 0
19vel = acc = ovl = 100.0
20blendT = -1.0
21flag = 0
22robot.SetSpeed(20)
23err1 = robot.MoveJ(joint_pos=joint_points[0],tool=tool, user=user,vel=vel)
24print(f"MoveJ 错误码: {err1}")
25robot.SplineStart()
26robot.SplinePTP(joint_pos=joint_points[0],tool=tool, user=user)
27robot.SplinePTP(joint_pos=joint_points[1],tool=tool, user=user)
28robot.SplinePTP(joint_pos=joint_points[2],tool=tool, user=user)
29robot.SplinePTP(joint_pos=joint_points[3],tool=tool, user=user)
30robot.SplineEnd()
31robot.CloseRPC()
4.30. New spline movement begins
Changed in version python: SDK-v2.0.3
prototype |
|
|---|---|
Description |
New Sample Movement Begins |
Mandatory parameters |
|
Default Parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
4.31. New spline command point
Prototype |
|
|---|---|
description |
new spline command point |
Mandatory parameters |
|
Default parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
4.32. End of new spline movement
Prototype |
|
|---|---|
Description |
End of New Sample Campaign |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.33. Example of new spline motion code
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 = [-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 = [-61.954, -84.409, 108.153, -116.316, -91.283, 74.260]
7j4 = [-89.575, -80.276, 102.713, -116.302, -91.284, 74.267]
8j5 = [-95.228, -54.621, 73.691, -112.245, -91.280, 74.268]
9desc_pos1 = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
10desc_pos2 = [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869]
11desc_pos3 = [-327.622, 402.230, 320.402, -178.067, 2.127, -46.207]
12desc_pos4 = [-104.066, 544.321, 327.023, -177.715, 3.371, -73.818]
13desc_pos5 = [-33.421, 732.572, 275.103, -177.907, 2.709, -79.482]
14offset_pos = [0, 0, 0, 0, 0, 0]
15epos = [0, 0, 0, 0]
16tool = 0
17user = 0
18vel = 100.0
19acc = 100.0
20ovl = 100.0
21blendT = -1.0
22flag = 0
23robot.SetSpeed(20)
24err1 = robot.MoveJ(joint_pos=j1, tool=tool, user=user, vel=vel)
25print(f"movej errcode:{err1}")
26robot.NewSplineStart(1, 2000)
27robot.NewSplinePoint(desc_pos=desc_pos1, tool=tool, user=user, vel=vel, lastFlag=-1, blendR=0)
28robot.NewSplinePoint(desc_pos=desc_pos2, tool=tool, user=user, vel=vel, lastFlag=-1, blendR=0)
29robot.NewSplinePoint(desc_pos=desc_pos3, tool=tool, user=user, vel=vel, lastFlag=-1, blendR=0)
30robot.NewSplinePoint(desc_pos=desc_pos4, tool=tool, user=user, vel=vel, lastFlag=-1, blendR=0)
31robot.NewSplinePoint(desc_pos=desc_pos5, tool=tool, user=user, vel=vel, lastFlag=-1, blendR=0)
32robot.NewSplineEnd()
33robot.CloseRPC()
4.34. Robot termination motion
Prototype |
|
|---|---|
Description |
Terminate motion, use of terminate motion requires motion instruction to be non-blocking |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.35. Robot pause
Prototype |
|
|---|---|
Description |
Pause motion. Using pause motion requires the motion instruction to be in a non-blocking state |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.36. Robot resume motion
Prototype |
|
|---|---|
Description |
Resume motion, using resume motion requires the motion instruction to be in a non-blocking state |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.37. Motion pause, resume, and stop code examples
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 =[-11.904, -99.669, 117.473, -108.616, -91.726, 74.256]
5j5 =[-95.228, -54.621, 73.691, -112.245, -91.280, 74.268]
6desc_pos1 = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
7desc_pos5 = [-33.421, 732.572, 275.103, -177.907, 2.709, -79.482]
8offset_pos = [0, 0, 0, 0, 0, 0]
9epos = [0, 0, 0, 0]
10tool = 0
11user = 0
12vel = 100.0
13acc = 100.0
14ovl = 100.0
15blendT = -1.0
16flag = 0
17robot.SetSpeed(20)
18rtn = robot.MoveJ(joint_pos=j1, tool=tool, user=user, vel=vel)
19rtn = robot.MoveJ(joint_pos=j5, tool=tool, user=user, vel=vel, blendT=1)
20time.sleep(1)
21robot.PauseMotion()
22time.sleep(1)
23robot.ResumeMotion()
24time.sleep(1)
25robot.StopMotion()
26time.sleep(1)
27robot.CloseRPC()
4.38. Overall shift in points begins
Prototype |
|
|---|---|
Description |
Point Overall Offset Begins |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.39. Overall offset of points ends
Prototype |
|
|---|---|
Description |
End of overall point offset |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.40. Point offset 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')
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]
6desc_pos1 = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
7desc_pos2 = [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869]
8offset_pos = [0, 0, 0, 0, 0, 0]
9offset_pos1 = [0, 0, 50, 0, 0, 0]
10epos = [0, 0, 0, 0]
11tool = 0
12user = 0
13vel = 100.0
14acc = 100.0
15ovl = 100.0
16blendT = -1.0
17flag = 0
18robot.SetSpeed(20)
19robot.MoveJ(joint_pos=j1,tool=tool, user=user, vel=vel)
20robot.MoveJ(joint_pos=j2, tool=tool, user=user, vel=vel)
21time.sleep(1)
22robot.PointsOffsetEnable(flag=0, offset_pos=offset_pos1)
23robot.MoveJ(joint_pos=j1,tool=tool, user=user, vel=vel)
24robot.MoveJ(joint_pos=j2, tool=tool, user=user, vel=vel)
25robot.PointsOffsetDisable()
26robot.CloseRPC()
4.41. Control box motion AO start
New in version python: SDK-v2.0.4
Prototype |
|
|---|---|
Description |
Control Box Motion AO Start |
Mandatory parameters |
|
Default Parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
4.42. End of control box movement AO
New in version python: SDK-v2.0.4
Prototype |
|
|---|---|
Description |
End of control box motion AO |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.43. End Motion AO Start
New in version python: SDK-v2.0.4
Prototype |
|
|---|---|
Description |
End Motion AO Start |
Mandatory parameters |
|
Default Parameters |
|
Return Value |
Error Code Success-0 Failure- errcode |
4.44. End movement AO end
New in version python: SDK-v2.0.4
Prototype |
|
|---|---|
Description |
end movement AO end |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.45. AO flyshot 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')
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]
6desc_pos1 = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
7desc_pos2 = [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869]
8offset_pos = [0, 0, 0, 0, 0, 0]
9offset_pos1 = [0, 0, 50, 0, 0, 0]
10epos = [0, 0, 0, 0]
11tool = 0
12user = 0
13vel = 20.0
14acc = 20.0
15ovl = 100.0
16blendT = -1.0
17flag = 0
18robot.SetSpeed(20)
19robot.MoveAOStart(0, 100, 100, 20)
20robot.MoveJ(joint_pos=j1,tool=tool, user=user, vel=vel)
21robot.MoveJ(joint_pos=j2, tool=tool, user=user, vel=vel)
22robot.MoveAOStop()
23time.sleep(1)
24robot.MoveToolAOStart(0, 100, 100, 20)
25robot.MoveJ(joint_pos=j1,tool=tool, user=user, vel=vel)
26robot.MoveJ(joint_pos=j2, tool=tool, user=user, vel=vel)
27robot.MoveToolAOStop()
28robot.CloseRPC()
4.46. Start Ptp motion FIR filtering
New in version python: SDK-v2.1.2
Prototype |
|
|---|---|
Description |
Start Ptp motion FIR filtering |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.47. Disable Ptp motion FIR filtering
New in version python: SDK-v2.0.7
Prototype |
|
|---|---|
Description |
Disable Ptp motion FIR filtering |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.48. LIN, ARC motion FIR filtering is started
New in version python: SDK-v2.0.7
Prototype |
|
|---|---|
Description |
LIN, ARC motion FIR filtering is started |
Mandatory parameter |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.49. Turn off LIN and ARC motion FIR filtering
New in version python: SDK-v2.0.7
Prototype |
|
|---|---|
Description |
Turn off LIN and ARC motion FIR filtering |
Mandatory parameter |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.50. FIR filtering 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')
4startjointPos = [-11.904, -99.669, 117.473, -108.616, -91.726, 74.256]
5startjointPos = [-11.904, -99.669, 117.473, -108.616, -91.726, 74.256]
6midjointPos = [-45.615, -106.172, 124.296, -107.151, -91.282, 74.255]
7endjointPos = [-29.777, -84.536, 109.275, -114.075, -86.655, 74.257]
8startdescPose = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
9middescPose = [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869]
10enddescPose = [-487.434, 154.362, 308.576, 176.600, 0.268, -14.061]
11exaxisPos = [0.0, 0.0, 0.0, 0.0]
12offdese = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
13rtn = robot.PtpFIRPlanningStart(1000.0, 1000.0)
14print(f"PtpFIRPlanningStart rtn is {rtn}")
15error = robot.MoveJ(joint_pos=startjointPos,tool= 0,user= 0,desc_pos=startdescPose,vel= 100,acc=100,ovl=100, blendT=-1.0, offset_flag=0)
16print(f"MoveJ rtn is {rtn}")
17error = robot.MoveJ(joint_pos=endjointPos,tool= 0,user= 0,desc_pos=enddescPose,vel= 100,acc=100,ovl=100, blendT=-1.0, offset_flag=0)
18print(f"MoveJ rtn is {rtn}")
19robot.PtpFIRPlanningEnd()
20print(f"PtpFIRPlanningEnd rtn is {rtn}")
21rtn = robot.LinArcFIRPlanningStart(1000, 1000, 1000, 1000)
22print(f"LinArcFIRPlanningStart rtn is {rtn}")
23error = robot.MoveL(desc_pos=startdescPose,tool= 0,user= 0, joint_pos=startjointPos,vel= 100,overSpeedStrategy=1,speedPercent=1)
24print(f"MoveL rtn is {rtn}")
25error = robot.MoveC(desc_pos_p=middescPose,tool_p= 0,user_p= 0, joint_pos_p=midjointPos,vel_p= 100,desc_pos_t=enddescPose,tool_t= 0,user_t= 0,joint_pos_t=endjointPos,vel_t= 100)
26print(f"MoveC rtn is {rtn}")
27robot.LinArcFIRPlanningEnd()
28print(f"LinArcFIRPlanningEnd rtn is {rtn}")
29robot.CloseRPC()
4.51. Acceleration smooth on
New in version python: SDK-v2.1.1
Prototype |
|
|---|---|
Description |
Acceleration smooth on |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.52. Acceleration smooth closing
New in version python: SDK-v2.1.1
Prototype |
|
|---|---|
Description |
Acceleration smooth closing |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.53. Acceleration smoothing 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')
4startjointPos = [-11.904, -99.669, 117.473, -108.616, -91.726, 74.256]
5endjointPos = [-45.615, -106.172, 124.296, -107.151, -91.282, 74.255]
6startdescPose = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
7enddescPose = [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869]
8exaxisPos = [0.0, 0.0, 0.0, 0.0]
9offdese = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
10rtn = robot.AccSmoothStart(0)
11print(f"AccSmoothStart rtn is {rtn}")
12robot.MoveJ(joint_pos=startjointPos,tool= 0,user= 0,vel= 100)
13robot.MoveJ(joint_pos=endjointPos,tool= 0,user= 0,vel= 100)
14rtn = robot.AccSmoothEnd(0)
15print(f"AccSmoothEnd rtn is {rtn}")
4.54. Setting the machine’s specified attitude speed on
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Specifies that attitude speed is on. |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.55. Specify Attitude Velocity Off
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Specify Attitude Velocity Off |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
Error Code Success-0 Failure- errcode |
4.56. Robot specified pose velocity 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')
4startjointPos = [-11.904, -99.669, 117.473, -108.616, -91.726, 74.256]
5endjointPos = [-45.615, -106.172, 124.296, -107.151, -91.282, 74.255]
6startdescPose = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
7enddescPose = [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869]
8exaxisPos = [0.0, 0.0, 0.0, 0.0]
9offdese = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
10rtn = robot.AngularSpeedStart(50)
11print(f"AngularSpeedStart rtn is {rtn}")
12robot.MoveJ(joint_pos=startjointPos, tool=0,user= 0,vel= 100)
13robot.MoveJ(joint_pos=endjointPos, tool=0,user= 0,vel= 100)
14rtn = robot.AngularSpeedEnd()
15print(f"AngularSpeedEnd rtn is {rtn}")
16robot.CloseRPC()
4.57. Odd-position protection on.
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Turn on odd-bit posture protection. |
Mandatory parameters |
|
Default Parameters |
|
Return Value |
|
4.58. Odd position protection off
New in version python: SDK-v2.0.5
Prototype |
|
|---|---|
Description |
Turn off odd-position protection |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
4.59. Example of robot singular pose protection code
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')
5startjointPos = [-11.904, -99.669, 117.473, -108.616, -91.726, 74.256]
6endjointPos = [-45.615, -106.172, 124.296, -107.151, -91.282, 74.255]
7startdescPose = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
8enddescPose = [-321.222, 185.189, 335.520, -179.030, -1.284, -29.869]
9exaxisPos = [0.0, 0.0, 0.0, 0.0]
10offdese = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
11rtn = robot.SingularAvoidStart(2, 10, 5, 5)
12print(f"SingularAvoidStart rtn is {rtn}")
13robot.MoveJ(joint_pos=startjointPos, tool=0,user= 0,vel= 100)
14robot.MoveJ(joint_pos=endjointPos, tool=0,user= 0,vel= 100)
15rtn = robot.SingularAvoidEnd()
16print(f"SingularAvoidEnd rtn is {rtn}")
17robot.CloseRPC()
4.60. Clear the motor command queue
New in version python: SDK-v2.1.7
Prototype |
|
|---|---|
Description |
Clear the motor command queue |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
4.61. Clear Motion Command Queue
Prototype |
|
|---|---|
Description |
Clear motion command queue |
Required Parameters |
|
Default Parameters |
None |
Return Value |
|
4.62. Intersecting Line Motion
Prototype |
|
|---|---|
Description |
Intersecting line motion |
Required Parameters |
|
Default Parameters |
None |
Return Value |
|
4.63. Robot Intersecting Line Motion Code Example
1from fairino import Robot
2import time
3robot = Robot.RPC('192.168.58.2')
4mainPoint = [[0.0] * 6 for _ in range(6)]
5piecePoint = [[0.0] * 6 for _ in range(6)]
6mainExaxisPos = [[0.0] * 4 for _ in range(6)]
7pieceExaxisPos = [[0.0] * 4 for _ in range(6)]
8extAxisFlag = 1
9exaxisPos = [[0.0] * 4 for _ in range(4)]
10offset = [0.0, 2.0, 30.0, -2.0, 0.0, 0.0]
11mainPoint[0] = [490.004, -383.194, 402.735, -9.332, -1.528, 69.594]
12mainPoint[1] = [444.950, -407.117, 389.011, -5.546, -2.196, 65.279]
13mainPoint[2] = [445.168, -463.605, 355.759, -1.544, -10.886, 57.104]
14mainPoint[3] = [507.529, -485.385, 343.013, -0.786, -4.834, 61.799]
15mainPoint[4] = [554.390, -442.647, 367.701, -4.761, -10.181, 64.925]
16mainPoint[5] = [532.552, -394.003, 396.467, -13.732, -13.592, 67.411]
17mainExaxisPos[0] = [-29.996, 0.000, 0.000, 0.000]
18mainExaxisPos[1] = [-29.996, 0.000, 0.000, 0.000]
19mainExaxisPos[2] = [-29.996, 0.000, 0.000, 0.000]
20mainExaxisPos[3] = [-29.996, 0.000, 0.000, 0.000]
21mainExaxisPos[4] = [-29.996, 0.000, 0.000, 0.000]
22mainExaxisPos[5] = [-29.996, 0.000, 0.000, 0.000]
23piecePoint[0] = [505.571, -192.408, 316.759, 38.098, 37.051, 139.447]
24piecePoint[1] = [533.837, -201.558, 332.340, 34.644, 42.339, 137.748]
25piecePoint[2] = [530.386, -225.085, 373.808, 35.431, 45.111, 137.560]
26piecePoint[3] = [485.646, -229.195, 383.778, 33.870, 45.173, 137.064]
27piecePoint[4] = [460.551, -212.161, 354.256, 28.856, 45.602, 135.930]
28piecePoint[5] = [474.217, -197.124, 324.611, 42.469, 41.133, 148.167]
29pieceExaxisPos[0] = [-29.996, -0.000, 0.000, 0.000]
30pieceExaxisPos[1] = [-29.996, -0.000, 0.000, 0.000]
31pieceExaxisPos[2] = [-29.996, -0.000, 0.000, 0.000]
32pieceExaxisPos[3] = [-29.996, -0.000, 0.000, 0.000]
33pieceExaxisPos[4] = [-29.996, -0.000, 0.000, 0.000]
34pieceExaxisPos[5] = [-29.996, -0.000, 0.000, 0.000]
35exaxisPos[0] = [-29.996, -0.000, 0.000, 0.000]
36exaxisPos[1] = [-44.994, 90.000, 0.000, 0.000]
37exaxisPos[2] = [-59.992, 0.002, 0.000, 0.000]
38exaxisPos[3] = [-44.994, -89.997, 0.000, 0.000]
39tool = 2
40wobj = 0
41vel = 100.0
42acc = 100.0
43ovl = 12.0
44oacc = 12.0
45moveType = 1
46moveDirection = 1
47rtn = robot.MoveToIntersectLineStart(mainPoint=mainPoint, mainExaxisPos=mainExaxisPos, piecePoint=piecePoint, pieceExaxisPos=pieceExaxisPos, extAxisFlag=extAxisFlag,exaxisPos=exaxisPos[0], tool=tool, wobj=wobj, vel=vel, acc=acc, ovl=ovl, oacc=oacc, moveType=moveType, moveDirection=moveDirection, offset=offset)
48print(f"MoveToIntersectLineStart rtn is {rtn}")
49rtn = robot.MoveIntersectLine(mainPoint=mainPoint, mainExaxisPos=mainExaxisPos, piecePoint=piecePoint, pieceExaxisPos=pieceExaxisPos, extAxisFlag=extAxisFlag, exaxisPos=exaxisPos, tool=tool,wobj=wobj, vel=vel, acc=acc, ovl=5.0, oacc=5.0, moveDirection=moveDirection, offset=offset)
50print(f"MoveIntersectLine rtn is {rtn}")
51robot.CloseRPC()
4.64. Stationary Air Motion
Prototype |
|
|---|---|
Description |
Stationary Air Motion |
Required Parameters |
None |
Default Parameters |
None |
Return Value |
|
4.65. Stationary Air Motion Code Example
1from fairino import Robot
2import time
3robot = Robot.RPC('192.168.58.2')
4rtn = robot.LaserSensorRecordandReplay(0, 10, 1, 0, 0.1, 1, 0, 10, 100)
5print(f"LaserSensorRecordandReplay rtn is {rtn}")
6rtn = robot.MoveStationary()
7print(f"MoveStationary rtn is {rtn}")
8rtn = robot.LaserSensorRecord1(0, 10)
9print(f"LaserSensorRecordandReplay rtn is {rtn}")
10robot.CloseRPC()
11return 0
4.66. Fixed-Point Swing Start
Prototype |
|
|---|---|
Description |
Start fixed-point swing |
Required Parameters |
|
Default Parameters |
None |
Return Value |
Error code Success-0 Failure-errcode |
4.67. Fixed-Point Swing End
Prototype |
|
|---|---|
Description |
End fixed-point swing |
Required Parameters |
None |
Default Parameters |
None |
Return Value |
|
4.68. Fixed-Point Swing SDK Code Example
1from time import sleep
2import time
3from fairino import Robot
4
5# Establish connection with robot controller
6robot = Robot.RPC('192.168.58.2')
7
8def TestOriginPointWeave(self):
9 time.sleep(2)
10 # Initialize joint position, external axis and offset
11 j = [39.886, -98.580, -124.032, -47.393, 90.000, 40.842]
12 epos = [0, 0, 0, 0]
13 offset_pos = [0, 0, 0, 0, 0, 0]
14
15 # Reference point position [x, y, z, rx, ry, rz]
16 refPoint = [400.021, 300.022, 299.996, 179.997, -0.003, -90.956]
17
18 # Move to starting position
19 robot.MoveJ(joint_pos=j, tool=1, user=0, vel=100, acc=100, ovl=100,
20 exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
21
22 # First swing: absolute coordinate system (tool=0), mode 0
23 robot.OriginPointWeaveStart(0, 0, refPoint, 3)
24 robot.MoveStationary()
25 robot.OriginPointWeaveEnd()
26
27 time.sleep(2)
28
29 # Move to starting position again
30 robot.MoveJ(joint_pos=j, tool=1, user=0, vel=100, acc=100, ovl=100,
31 exaxis_pos=epos, blendT=-1, offset_flag=0, offset_pos=offset_pos)
32
33 # Second swing: absolute coordinate system (tool=0), mode 1
34 robot.OriginPointWeaveStart(0, 1, refPoint, 3)
35 robot.MoveStationary()
36 robot.OriginPointWeaveEnd()
37
38 # Close connection
39 robot.CloseRPC()
40 time.sleep(1)
41
42TestOriginPointWeave(robot)
4.69. Fixed-Point Swing (Including Laser and Extension Axis) SDK Code Example
1from time import sleep
2import time
3from fairino import Robot
4
5# Establish connection with robot controller
6robot = Robot.RPC('192.168.58.2')
7
8def TestOriginPointWeave(self):
9 time.sleep(2)
10 # Initialize joint position, external axis and offset
11 j = [39.886, -98.580, -124.032, -47.393, 90.000, 40.842]
12 epos1 = [0, 0, 0, 0]
13 offset_pos = [0, 0, 0, 0, 0, 0]
14 epos2 = [5, 0.000, 0.000, 0.000]
15 # Reference point position [x, y, z, rx, ry, rz]
16 refPoint = [400.021, 300.022, 299.996, 179.997, -0.003, -90.956]
17
18 rtn = 0
19 robot.LaserTrackingSensorConfig("192.168.58.20", 5020)
20 robot.LaserTrackingSensorSamplePeriod(20)
21 robot.LoadPosSensorDriver(101)
22
23 # Load UDP driver
24 robot.ExtDevLoadUDPDriver()
25
26 # Set extension axis command completion time
27 rtn = robot.SetExAxisCmdDoneTime(5000.0)
28 print(f"SetExAxisCmdDoneTime rtn is {rtn}")
29
30 # Enable extension axes 1 and 2
31 rtn = robot.ExtAxisServoOn(1, 1)
32 print(f"ExtAxisServoOn axis id 1 rtn is {rtn}")
33 rtn = robot.ExtAxisServoOn(2, 1)
34 print(f"ExtAxisServoOn axis id 2 rtn is {rtn}")
35 time.sleep(2)
36
37 # Set extension axis homing
38 robot.ExtAxisSetHoming(1, 0, 10, 2)
39 robot.LaserTrackingLaserOnOff(1)
40
41 # 1---Without extension axis
42 robot.LaserTrackingTrackOnOff(1, 4)
43 time.sleep(0.2)
44 # Start fixed-point swing
45 robot.OriginPointWeaveStart(0, 0, refPoint, 10)
46 robot.MoveStationary() # Execute stationary motion (assuming this method exists)
47 robot.OriginPointWeaveEnd()
48 robot.LaserTrackingTrackOnOff(0, 4)
49
50 time.sleep(2) # Wait 2 seconds
51
52 # 2----With extension axis
53 robot.ExtAxisMove(epos1, 100, -1)
54 robot.LaserTrackingTrackOnOff(1, 4)
55 # Start fixed-point swing
56 robot.OriginPointWeaveStart(0, 0, refPoint, 20)
57 robot.ExtAxisMove(epos2, 100, -1)
58 robot.OriginPointWeaveEnd()
59 robot.LaserTrackingTrackOnOff(0, 4)
60
61 # Close connection
62 robot.CloseRPC()
63 time.sleep(1)
64
65TestOriginPointWeave(robot)