4. Movement

4.1. jog point and click

Prototype

StartJOG(ref,nb,dir,max_dis,vel=20.0,acc=100.0)

description

jog dot motion

Mandatory parameters

  • ref: 0 - joint point movement, 2 - base coordinate system point movement, 4 - tool coordinate system point movement, 8 - workpiece coordinate system point movement;

  • nb: 1-1 joint (x-axis), 2-2 joint (y-axis), 3-3 joint (z-axis), 4-4 joint (rx), 5-5 joint (ry), 6-6 joint (rz).

  • dir: 0 - negative direction, 1 - positive direction.

  • max_dis: maximum angle/distance of a single tap in ° or mm;

Default Parameters

  • vel: percentage of speed, [0 to 100] default 20;

  • acc: acceleration percentage, [0~100] default 100;

Return Value

Error Code Success-0 Failure- errcode

4.2. jog tap to decelerate and stop

Prototype

StopJOG(ref)

description

jog nudging deceleration stop

Mandatory parameters

  • ref: 1 - joint point stop, 3 - base coordinate system point stop, 5 - tool coordinate system point stop, 9 - workpiece coordinate system point stop

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

4.3. Immediate stop for jog taps

Prototype

ImmStopJOG()

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

MoveJ(joint_pos, tool, user, desc_pos = [0.0,0.0,0.0,0.0,0.0,0.0,0.0], vel = 20.0, acc = 0.0, ovl = 100.0, exaxis_pos = [0.0,0.0,0.0,0.0], blendT = -1.0, offset_flag = 0, offset_pos = [0.0,0.0,0.0,0.0,0.0,0.0])

description

joint space motion

Mandatory parameters

  • joint_pos: target joint position in [°];

  • tool: tool number, [0 to 14];

  • user: artifact number, [0 to 14];

Default parameters

  • desc_pos: target Cartesian position in [mm][°] Default initial value [0.0,0.0,0.0,0.0,0.0,0.0,0.0], default value calls positive kinematics to solve for the return value.

  • vel: percentage of speed, [0~100] default 20.0.

  • acc: percentage of acceleration, [0~100], not open yet;

  • ovl: velocity scaling factor, [0~100] default 100.0.

  • exaxis_pos: external axis 1 position ~ external axis 4 position Default [0.0,0.0,0.0,0.0].

  • blendT:[-1.0]-motion in place (blocking), [0~500.0]-smoothing time (non-blocking) in [ms] default -1.0;

  • offset_flag:[0]-no offset, [1]-offset in workpiece/base coordinate system, [2]-offset in tool coordinate system Default 0;

  • offset_pos: position offset in [mm][°] default [0.0,0.0,0.0,0.0,0.0,0.0];

Return Value

Error Code Success-0 Failure- errcode

4.6. Cartesian Space Linear Motion

New in version python: SDK-v2.1.5

Prototype

MoveL(desc_pos, tool, user, joint_pos=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], vel=20.0, acc=0.0, ovl=100.0,blendR=-1.0, blendMode = 0,exaxis_pos=[0.0, 0.0, 0.0, 0.0], search=0, offset_flag=0,offset_pos=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],oacc = 100.0,config=-1,velAccParamMode=0,overSpeedStrategy=0,speedPercent=10)

Description

Cartesian Space Linear Motion

Required Parameters

  • desc_pos: Target Cartesian pose, unit [mm][°];

  • tool: Tool number, [0~14];

  • user: Workpiece/User number, [0~14];

Default Parameters

  • joint_pos: Target joint positions, unit [°] Default initial value is [0.0,0.0,0.0,0.0,0.0,0.0], default value is the return value from inverse kinematics;

  • vel: Velocity percentage, [0~100] Default 20.0;

  • acc: Acceleration percentage, [0~100], currently unavailable Default 0.0;

  • ovl: Velocity scaling factor, [0~100] Default 100.0;

  • blendR:[-1.0]-Block until motion completes (blocking), [0~1000]-Blend radius (non-blocking), unit [mm] Default -1.0;

  • blendMode: Transition method; 0-Tangent blend; 1-Corner blend, default 0;

  • exaxis_pos: External axis 1 position ~ External axis 4 position Default [0.0,0.0,0.0,0.0];

  • search:[0]-No wire search, [1]-Wire search;

  • offset_flag:[0]-No offset, [1]-Offset in workpiece/base coordinate system, [2]-Offset in tool coordinate system Default 0;

  • offset_pos: Pose offset value, unit [mm][°] Default [0.0,0.0,0.0,0.0,0.0,0.0];

  • oacc: Acceleration scaling factor [0-100] / Physical acceleration (mm/s²) Default 100;

  • config: Inverse solution joint space configuration, [-1]-Solve with reference to current joint positions, [0~7]-Solve according to a specific joint space configuration, default -1

  • velAccParamMode: Velocity/Acceleration parameter mode; 0-Percentage; 1-Physical velocity (mm/s) and acceleration (mm/s²) Default 0

  • overSpeedStrategy: Overspeed handling strategy, 0-Strategy disabled; 1-Standard; 2-Stop with error on overspeed; 3-Adaptive speed reduction, default 0

  • speedPercent: Allowable speed reduction threshold percentage [0-100], default 10%

Return Value

Error code 0-Success Error- errcode

4.7. Cartesian Space Circular Arc Motion

New in version python: SDK-v2.1.5

Prototype

MoveC(desc_pos_p, tool_p, user_p, desc_pos_t, tool_t, user_t, joint_pos_p=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], joint_pos_t=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],vel_p=20.0, acc_p=100.0, exaxis_pos_p=[0.0, 0.0, 0.0, 0.0], offset_flag_p=0,offset_pos_p=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],vel_t=20.0, acc_t=100.0, exaxis_pos_t=[0.0, 0.0, 0.0, 0.0], offset_flag_t=0,offset_pos_t=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],ovl=100.0, blendR=-1.0,oacc=100.0,config=-1,velAccParamMode=0)

Description

Cartesian Space Circular Arc Motion

Required Parameters

  • desc_pos_p: Path point Cartesian pose, unit [mm][°];

  • tool_p: Path point tool number, [0~14];

  • user_p: Path point workpiece/user number, [0~14];

  • desc_pos_t: Target point Cartesian pose, unit [mm][°];

  • tool_t: Tool number, [0~14];

  • user_t: Workpiece/User number, [0~14];

Default Parameters

  • joint_pos_p: Path point joint positions, unit [°] Default initial value is [0.0,0.0,0.0,0.0,0.0,0.0], default value is the return value from inverse kinematics;

  • joint_pos_t: Target point joint positions, unit [°] Default initial value is [0.0,0.0,0.0,0.0,0.0,0.0], default value is the return value from inverse kinematics;

  • vel_p: Path point velocity percentage, [0~100] Default 20.0;

  • acc_p: Path point acceleration percentage, [0~100] Currently unavailable, default 0.0;

  • exaxis_pos_p: Path point external axis 1 position ~ external axis 4 position Default [0.0,0.0,0.0,0.0];

  • offset_flag_p: Whether the path point is offset [0]-No offset, [1]-Offset in workpiece/base coordinate system, [2]-Offset in tool coordinate system Default 0;

  • vel_t: Target point velocity percentage, [0~100] Default 20.0;

  • acc_t: Target point acceleration percentage, [0~100] Currently unavailable default 0.0;

  • exaxis_pos_t: Target point external axis 1 position ~ external axis 4 position Default [0.0,0.0,0.0,0.0];

  • offset_flag_t: Whether the target point is offset [0]-No offset, [1]-Offset in workpiece/base coordinate system, [2]-Offset in tool coordinate system Default 0;

  • offset_pos_t: Target point pose offset value, unit [mm][°] Default [0.0,0.0,0.0,0.0,0.0,0.0];

  • ovl:: Velocity scaling factor, [0~100] Default 100.0;

  • blendR:[-1.0]-Block until motion completes (blocking), [0~1000]-Blend radius (non-blocking), unit [mm] Default -1.0;

  • oacc: Acceleration scaling factor [0-100] / Physical acceleration (mm/s²) Default 100;

  • config: Inverse solution joint space configuration, [-1]-Solve with reference to current joint positions, [0~7]-Solve according to a specific joint space configuration, default -1;

  • velAccParamMode: Velocity/Acceleration parameter mode; 0-Percentage; 1-Physical velocity (mm/s) and acceleration (mm/s²) Default 0

Return Value

Error code 0-Success Error- errcode

4.8. Cartesian Space Full Circle Motion

New in version python: SDK-v2.1.5

Prototype

Circle(desc_pos_p, tool_p, user_p, desc_pos_t, tool_t, user_t, joint_pos_p=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],joint_pos_t=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],vel_p=20.0, acc_p=0.0, exaxis_pos_p=[0.0, 0.0, 0.0, 0.0], vel_t=20.0, acc_t=0.0,exaxis_pos_t=[0.0, 0.0, 0.0, 0.0],ovl=100.0, offset_flag=0, offset_pos=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], oacc=100.0, blendR=-1,config=-1,velAccParamMode=0)

Description

Cartesian Space Full Circle Motion

Required Parameters

  • desc_pos_p: Path point Cartesian pose, unit [mm][°];

  • tool_p: Tool number, [0~14];

  • user_p: Workpiece/User number, [0~14];

  • desc_pos_t: Target point Cartesian pose, unit [mm][°];

  • tool_t: Tool number, [0~14];

  • user_t: Workpiece/User number, [0~14];

Default Parameters

  • joint_pos_p: Path point joint positions, unit [°] Default initial value is [0.0,0.0,0.0,0.0,0.0,0.0], default value is the return value from inverse kinematics;

  • joint_pos_t: Target point joint positions, unit [°] Default initial value is [0.0,0.0,0.0,0.0,0.0,0.0], default value is the return value from inverse kinematics;

  • vel_p: Velocity percentage, [0~100] Default 20.0;

  • acc_p: Path point acceleration percentage, [0~100] Currently unavailable default 0.0;

  • exaxis_pos_p: Path point external axis 1 position ~ external axis 4 position Default [0.0,0.0,0.0,0.0];

  • vel_t: Target point velocity percentage, [0~100] Default 20.0;

  • acc_t: Target point acceleration percentage, [0~100] Currently unavailable default 0.0;

  • exaxis_pos_t: Target point external axis 1 position ~ external axis 4 position Default [0.0,0.0,0.0,0.0]

  • ovl: Velocity scaling factor, [0~100] Default 100.0;

  • offset_flag: Whether to offset [0]-No offset, [1]-Offset in workpiece/base coordinate system, [2]-Offset in tool coordinate system Default 0;

  • offset_pos: Pose offset value, unit [mm][°] Default [0.0,0.0,0.0,0.0,0.0,0.0]

  • oacc: Acceleration scaling factor [0-100] / Physical acceleration (mm/s²), default: 100;

  • blendR:-1:Blocking;0~1000:Blend radius, default: -1;

  • config: Inverse solution joint space configuration, [-1]-Solve with reference to current joint positions, [0~7]-Solve according to a specific joint space configuration, default -1;

  • velAccParamMode: Velocity/Acceleration parameter mode; 0-Percentage; 1-Physical velocity (mm/s) and acceleration (mm/s²) Default 0

Return Value

Error code 0-Success Error- errcode

4.9. Point-to-point motion in Cartesian space

Prototype

MoveCart(desc_pos, tool, user, vel = 20.0, acc = 0.0, ovl = 100.0, blendT = -1.0, config = -1)

Description

Point-to-point motion in Cartesian space

Mandatory parameters

  • desc_pos: target Cartesian position;

  • tool: tool number, [0 to 14];

  • user: artifact number, [0 to 14];

Default parameters

  • vel: velocity, range [0 to 100], default 20.0;

  • acc: acceleration, range [0-100], not available, default 0.0;

  • ovl: velocity scaling factor, [0 to 100], default 100.0.

  • blendT:[-1.0]-motion in place (blocking), [0~500]-smoothing time (non-blocking) in [ms] default -1.0;

  • config: joint configuration, [-1] - solve with reference to current joint position, [0~7] - solve based on joint configuration default is -1

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

NewSpiral(desc_pos, tool, user, param, joint_pos = [0.0,0.0,0.0,0.0,0.0,0.0,0.0], vel = 20.0, acc = 0.0, exaxis_pos = [0.0,0.0,0.0,0.0], ovl = 100.0, offset_flag = 0, offset_pos = [0.0,0.0,0.0,0.0,0.0,0.0], config = -1)

Description

Spiral motion in Cartesian space

Mandatory parameters

  • desc_pos: target Cartesian position in [mm][°];

  • tool: tool number, [0 to 14].

  • user: artifact number, [0 to 14].

  • param=[circle_num, circle_angle, rad_init, rad_add, rotaxis_add, rot_direction, velAccMode]: circle_num: number of spiral turns; circle_angle: spiral inclination; rad_init: initial radius of the spiral. rad_add: radius increment; rotaxis_add: rotational direction increment; rot_direction: rotational direction, 0-clockwise, 1-counterclockwise,velAccMode speed acceleration parameter mode: 0- constant angular velocity, 1- constant linear velocity;

Default parameters

  • joint_pos: target joint position in [°] Default initial value is [0.0,0.0,0.0,0.0,0.0,0.0,0.0], default value calls inverse kinematics to solve for the return value.

  • vel: percentage of speed, [0~100] default 20.0.

  • acc: percentage of acceleration, [0~100] default 100.0.

  • exaxis_pos: external axis 1 position ~ external axis 4 position Default [0.0,0.0,0.0,0.0].

  • ovl: velocity scaling factor, [0~100] default 100.0.

  • offset_flag:[0]-no offset, [1]-offset in workpiece/base coordinate system, [2]-offset in tool coordinate system Default 0;

  • offset_pos: position offset in [mm][°] default [0.0,0.0,0.0,0.0,0.0,0.0]

  • config: Reverse the joint space configuration, [-1]- calculate based on the current joint position, [0~7]- solve based on the specific joint space configuration, default -1

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

ServoMoveStart(cmdType=0)

Description

Start servo motion, used with ServoJ and ServoCart commands

Required Parameters

  • cmdType: Command transmission type, 0=XML-RPC, 1=UDP transparent transmission

Default Parameters

None

Return Value

Error code Success-0 Failure-errcode

4.14. Servo Motion End

Prototype

ServoMoveEnd(cmdType=0)

Description

End servo motion, used with ServoJ and ServoCart commands

Required Parameters

  • cmdType: Command transmission type, 0=XML-RPC, 1=UDP transparent transmission

Default Parameters

None

Return Value

Error code Success-0 Failure-errcode

4.15. Joint Space Servo Mode Motion

Prototype

ServoJ(joint_pos, axisPos, acc = 0.0, vel = 0.0, cmdT = 0.008, filterT = 0.0, gain = 0.0, id=0, cmdType=0)

Description

Joint space servo mode motion

Required Parameters

  • joint_pos: Target joint position, unit [°];

  • axisPos: External axis position, unit mm;

Default Parameters

  • acc: Acceleration, range [0~100], temporarily not open, default is 0.0;

  • vel: Velocity, range [0~100], temporarily not open, default is 0.0;

  • cmdT: Command sending period, unit s, recommended range [0.001~0.0016], default is 0.008;

  • filterT: Filter time, unit [s], temporarily not open, default is 0.0;

  • gain: Proportional amplifier for target position, temporarily not open, default is 0.0;

  • id: ServoJ command ID, default is 0;

  • cmdType: Command transmission type, 0=XML-RPC, 1=UDP transparent transmission;

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

ServoJTStart(cmdType=0)

Description

Start joint torque control

Required Parameters

  • cmdType: Command transmission type, 0=XML-RPC, 1=UDP transparent transmission

Default Parameters

None

Return Value

Error code Success-0 Failure-errcode

4.19. Joint Torque Control

Prototype

ServoJT(torque, interval, checkFlag=0, jPowerLimit=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],jVelLimit=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], cmdType=0)

Description

Joint torque control

Required Parameters

  • torque: j1~j6 joint torque, unit Nm
    • interval: Command period, unit s, range [0.001~0.008]

    • checkFlag: Detection strategy 0-no restriction; 1-power limitation; 2-velocity limitation; 3-both power and velocity limitation, default 0

    • jPowerLimit: Joint maximum power limit (W), default [0.0,0.0,0.0,0.0,0.0,0.0]

    • jVelLimit: Joint maximum velocity (°/s), default [0.0,0.0,0.0,0.0,0.0,0.0]

    • cmdType: Command transmission type, 0=XML-RPC, 1=UDP transparent transmission

Default Parameters

None

Return Value

Error code Success-0 Failure-errcode

4.20. Joint Torque Control End

Prototype

ServoJTEnd(cmdType=0)

Description

End joint torque control

Required Parameters

  • cmdType: Command transmission type, 0=XML-RPC, 1=UDP transparent transmission

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

ServoCart(mode, desc_pos, exaxis, pos_gain=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0], acc=0.0, vel=0.0, cmdT=0.008,filterT=0.0, gain=0.0)

Description

Cartesian space servo mode motion

Required Parameters

  • mode:[0]-Absolute motion (base coordinate system), [1]-Incremental motion (base coordinate system), [2]-Incremental motion (tool coordinate system);

  • exaxis:Extended axis position;

  • desc_pos:Target Cartesian position/Target Cartesian position increment;

Default Parameters

  • pos_gain:Pose increment proportionality coefficient, only effective in incremental motion, range [0~1], default [1.0, 1.0, 1.0, 1.0, 1.0, 1.0];

  • acc:Acceleration, range [0~100], temporarily not available, default 0.0;

  • vel:Velocity, range [0~100], temporarily not available, default 0.0;

  • cmdT:Command transmission period, unit s, recommended range [0.001~0.0016], default 0.008;

  • filterT:Filter time, unit [s], temporarily not available, default 0.0;

  • gain:Proportional amplifier for target position, temporarily not available, default 0.0;

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

SplineStart()

Description

Sample movement begins

Mandatory parameters

NULL

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

4.27. Sample motion PTP

Prototype

SplinePTP(joint_pos, tool, user, desc_pos = [0.0,0.0,0.0,0.0,0.0,0.0,0.0], vel = 20.0, acc = 100.0, ovl = 100.0)

Description

Sample Motion PTP

Mandatory parameters

  • joint_pos: target joint position in [°];

  • tool: tool number, [0 to 14];

  • user: artifact number, [0 to 14];

Default parameters

  • desc_pos: target Cartesian position in [mm][°] Default initial value [0.0,0.0,0.0,0.0,0.0,0.0,0.0], default value calls positive kinematics to solve for the return value.

  • vel: velocity, range [0-100], default 20.0.

  • acc: acceleration, range [0 to 100], default 100.0.

  • ovl: velocity scaling factor, [0 to 100], default 100.0

Return Value

Error Code Success-0 Failure- errcode

4.28. End of spline motion

Prototype

SplineEnd()

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

NewSplineStart(type,averageTime=2000)

Description

New Sample Movement Begins

Mandatory parameters

  • type: 0 - arc transition, 1 - given point path point

Default Parameters

  • averageTime: global average articulation time (ms) defaults to 2000

Return Value

Error Code Success-0 Failure- errcode

4.31. New spline command point

Prototype

NewSplinePoint(desc_pos,tool,user,lastFlag,joint_pos=[0.0,0.0,0.0,0.0,0.0,0.0], vel = 0.0, acc = 0.0, ovl = 100.0 ,blendR = 0.0 )

description

new spline command point

Mandatory parameters

  • desc_pos: target Cartesian position in [mm][°].

  • tool: tool number, [0 to 14];

  • user: artifact number, [0 to 14];

  • lastFlag: whether it is the last point, 0 - no, 1 - yes;

Default parameters

  • joint_pos: target joint position in [°] Default initial value is [0.0,0.0,0.0,0.0,0.0,0.0,0.0], default value calls inverse kinematics to solve for the return value.

  • vel: velocity, range [0~100], not open yet, default is 0.0;;

  • acc: acceleration, range [0 to 100], not open, default 0.0.

  • ovl: velocity scaling factor, [0~100] default 100.0.

  • blendR: [0~1000]-smoothing radius in [mm] default 0.0;

Return Value

Error Code Success-0 Failure- errcode

4.32. End of new spline movement

Prototype

NewSplineEnd()

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

StopMotion()

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

PauseMotion()

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

ResumeMotion()

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

PointsOffsetEnable(flag,offset_pos)

Description

Point Overall Offset Begins

Mandatory parameters

  • flag: 0 - offset in base or work coordinate system, 2 - offset in tool coordinate system;

  • offset_pos: offset in [mm][°].

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

4.39. Overall offset of points ends

Prototype

PointsOffsetDisable()

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

MoveAOStart(AONum,maxTCPSpeed=1000,maxAOPercent=100,zeroZoneCmp=20)

Description

Control Box Motion AO Start

Mandatory parameters

  • AONum: control box AO number

Default Parameters

  • maxTCPSpeed: Maximum TCP speed value [1-5000mm/s], default 1000;

  • maxAOPercent: percentage of AO corresponding to the maximum TCP speed value, default 100%;

  • zeroZoneCmp: deadzone compensation value AO percentage, shaped, default 20%, range [0-100].

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

MoveAOStop()

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

MoveToolAOStart(AONum,maxTCPSpeed=1000,maxAOPercent=100,zeroZoneCmp =20)

Description

End Motion AO Start

Mandatory parameters

  • AONum: end AO number

Default Parameters

  • maxTCPSpeed: Maximum TCP speed value [1-5000mm/s], default 1000;

  • maxAOPercent: percentage of AO corresponding to the maximum TCP speed value, default 100%;

  • zeroZoneCmp: deadzone compensation value AO percentage, shaped, default 20%, range [0-100].

Return Value

Error Code Success-0 Failure- errcode

4.44. End movement AO end

New in version python: SDK-v2.0.4

Prototype

MoveToolAOStop()

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

PtpFIRPlanningStart(maxAcc, maxJek)

Description

Start Ptp motion FIR filtering

Mandatory parameters

  • maxAcc:Maximum acceleration extremum(deg/s2)

  • maxJek:Unify the extreme values of joint urgency (deg/s3)

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

PtpFIRPlanningEnd()

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

LinArcFIRPlanningStart(maxAccLin,maxAccDeg,maxJerkLin,maxJerkDeg)

Description

LIN, ARC motion FIR filtering is started

Mandatory parameter

  • maxAccLin:Linear acceleration extremum(mm/s2)

  • maxAccDeg:Angular acceleration extremum(deg/s2)

  • maxJerkLin:Linear plus acceleration extremum(mm/s3)

  • maxJerkDeg:Angle plus acceleration extremum(deg/s3)

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

LinArcFIRPlanningEnd()

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

AccSmoothStart(saveFlag_flag)

Description

Acceleration smooth on

Mandatory parameters

  • saveFlag_flag: Power off and save

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

AccSmoothEnd(saveFlag_flag)

Description

Acceleration smooth closing

Mandatory parameters

  • saveFlag_flag: Power off and save

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

AngularSpeedStart(ratio)

Description

Specifies that attitude speed is on.

Mandatory parameters

  • ratio: percentage of attitude velocity [0-300]

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

AngularSpeedEnd()

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

SingularAvoidStart(protectMode, minShoulderPos=100, minElbowPos=50, minWristPos=10)

Description

Turn on odd-bit posture protection.

Mandatory parameters

  • protectMode: singular position protection protection mode: 0 - articulated mode; 1 - Cartesian mode

Default Parameters

  • minShoulderPos: Shoulder singularity adjustment range (mm), default 100.0

  • minElbowPos: elbow singularity adjustment range (mm), default 50.0

  • minWristPos: range of wrist singularity adjustment (°), default 10.0

Return Value

  • errcode Success-0 Failure- errcode

4.58. Odd position protection off

New in version python: SDK-v2.0.5

Prototype

SingularAvoidEnd()

Description

Turn off odd-position protection

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • errcode Success-0 Failure- errcode

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

MotionQueueClear()

Description

Clear the motor command queue

Mandatory parameters

NULL

Default parameters

NULL

Return Value

  • errcode Success-0 Failure- errcode

4.61. Clear Motion Command Queue

Prototype

MoveToIntersectLineStart(mainPoint, piecePoint, tool, wobj, vel, acc, ovl, oacc, moveType,mainExaxisPos=[[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0]],pieceExaxisPos=[[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0]],extAxisFlag=0,exaxisPos=[0.0,0.0,0.0,0.0],moveDirection=0,offset=[0.0,0.0,0.0,0.0,0.0,0.0])

Description

Clear motion command queue

Required Parameters

  • mainPoint:Cartesian poses of 6 taught points on the main pipe

  • piecePoint:Cartesian poses of 6 taught points on the branch pipe

  • tool:Tool coordinate system number

  • wobj:Workpiece coordinate system number

  • vel:Velocity percentage

  • acc:Acceleration percentage

  • ovl:Velocity scaling factor

  • oacc:Acceleration scaling factor

  • moveType:Motion type; 0-PTP; 1-LIN

  • mainExaxisPos:Extended axis positions for 6 taught points on the main pipe, default [[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0]]

  • pieceExaxisPos:Extended axis positions for 6 taught points on the branch pipe, default [[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0]]

  • extAxisFlag:Whether to enable extended axis; 0-Disable; 1-Enable

  • exaxisPos:Start point extended axis position [0.0,0.0,0.0,0.0]

  • moveDirection:Motion direction; 0-Clockwise; 1-Counterclockwise

  • offset:Offset value

Default Parameters

None

Return Value

  • Error code Success-0 Failure- errcode

4.62. Intersecting Line Motion

Prototype

MoveIntersectLine(mainPoint, piecePoint, tool, wobj, vel, acc, ovl, oacc, moveDirection,mainExaxisPos=[[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0]],pieceExaxisPos=[[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0]],extAxisFlag=0,exaxisPos=[[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0]],offset=[0.0,0.0,0.0,0.0,0.0,0.0])

Description

Intersecting line motion

Required Parameters

  • mainPoint:Cartesian poses of 6 taught points on the main pipe

  • piecePoint:Cartesian poses of 6 taught points on the branch pipe

  • tool:Tool coordinate system number

  • wobj:Workpiece coordinate system number

  • vel:Velocity percentage

  • acc:Acceleration percentage

  • ovl:Velocity scaling factor

  • oacc:Acceleration scaling factor

  • moveDirection:Motion direction; 0-Clockwise; 1-Counterclockwise

  • mainExaxisPos:Extended axis positions for 6 taught points on the main pipe, default [[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0]]

  • pieceExaxisPos:Extended axis positions for 6 taught points on the branch pipe, default [[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0],[0.0,0.0,0.0,0.0]]

  • extAxisFlag:Whether to enable extended axis; 0-Disable; 1-Enable

  • exaxisPos:Start point extended axis position [0.0,0.0,0.0,0.0]

  • offset:Offset value

Default Parameters

None

Return Value

  • Error code Success-0 Failure- errcode

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

MoveStationary()

Description

Stationary Air Motion

Required Parameters

None

Default Parameters

None

Return Value

  • Error code. Success - 0, Failure - errcode

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

OriginPointWeaveStart(weaveNum, mode, refPoint, weaveTime)

Description

Start fixed-point swing

Required Parameters

  • weaveNum: Swing number [0-7]

  • mode: 0-Tool coordinate system; 1-Reference point

  • refPoint: Reference point Cartesian coordinates [x,y,z,a,b,c]

  • weaveTime: Swing time [s]

Default Parameters

None

Return Value

Error code Success-0 Failure-errcode

4.67. Fixed-Point Swing End

Prototype

OriginPointWeaveEnd()

Description

End fixed-point swing

Required Parameters

None

Default Parameters

None

Return Value

  • Error code Success-0 Failure-errcode

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)