top of page

Python 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

from fairino import Robot
import time
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
for i in range(6):
    robot.StartJOG(0, i + 1020.020.030.0)
    time.sleep(1)
    robot.ImmStopJOG()
    time.sleep(1)
for i in range(6):
    robot.StartJOG(2, i + 1020.020.030.0)
    time.sleep(1)
    robot.ImmStopJOG()
    time.sleep(1)
for i in range(6):
    robot.StartJOG(4, i + 1020.020.030.0)
    time.sleep(1)
    robot.StopJOG(5)
    time.sleep(1)
for i in range(6):
    robot.StartJOG(8, i + 1020.020.030.0)
    time.sleep(1)
    robot.StopJOG(9)
    time.sleep(1)
robot.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

from fairino import Robot
import time
robot = Robot.RPC('192.168.58.2')
j1 = [-11.904-99.669117.473-108.616-91.72674.256]
j2 = [-45.615-106.172124.296-107.151-91.28274.255]
j3 = [-29.777-84.536109.275-114.075-86.65574.257]
j4 = [-31.154-95.31794.276-88.079-89.74074.256]
desc_pos1 = [-419.524-13.000351.569-178.1180.3143.833]
desc_pos2 = [-321.222185.189335.520-179.030-1.284-29.869]
desc_pos3 = [-487.434154.362308.576176.6000.268-14.061]
desc_pos4 = [-443.165147.881480.951179.511-0.775-15.409]
offset_pos = [0.0* 6
epos = [0.0* 4
tool = 0
user = 0
vel = 100.0
acc = 100.0
ovl = 100.0
oacc = 100.0
blendT = 0.0
blendR = 0.0
flag = 0
search = 0
blendMode = 0
velAccMode = 0
robot.SetSpeed(20)
rtn = robot.MoveJ(joint_pos=j1, tool=tool, user=user, vel=vel, acc=acc, ovl=ovl, exaxis_pos=epos, blendT=blendT, offset_flag=flag, offset_pos=offset_pos)
print(f"movej errcode:{rtn}")
rtn = robot.MoveL(desc_pos=desc_pos2, tool=tool, user=user, vel=vel, acc=acc, ovl=ovl, blendR=blendR, blendMode=blendMode, exaxis_pos=epos, search=search, offset_flag=flag, offset_pos=offset_pos,oacc=oacc, velAccParamMode=velAccMode)
print(f"movel errcode:{rtn}")
rtn = robot.MoveC(desc_pos_p=desc_pos3, tool_p=tool, user_p=user, vel_p=vel, acc_p=acc, exaxis_pos_p=epos, offset_flag_p=flag, offset_pos_p=offset_pos, desc_pos_t=desc_pos4, tool_t=tool, user_t=user, vel_t=vel,acc_t=acc, exaxis_pos_t=epos, offset_flag_t=flag, offset_pos_t=offset_pos, ovl=ovl, blendR=blendR, oacc=oacc, velAccParamMode=velAccMode)
print(f"movec errcode:{rtn}")
rtn = robot.MoveJ(joint_pos=j2, tool=tool, user=user, vel=vel, acc=acc, ovl=ovl, exaxis_pos=epos, blendT=blendT, offset_flag=flag, offset_pos=offset_pos)
print(f"movej errcode:{rtn}")
rtn = robot.Circle(desc_pos_p=desc_pos3, tool_p=tool, user_p=user, vel_p=vel, acc_p=acc, exaxis_pos_p=epos, desc_pos_t=desc_pos1, tool_t=tool, user_t=user, vel_t=vel, acc_t=acc, exaxis_pos_t=epos, ovl=ovl,offset_flag=flag, offset_pos=offset_pos, oacc=oacc, blendR=-1, velAccParamMode=velAccMode)
print(f"circle errcode:{rtn}")
rtn = robot.MoveCart(desc_pos=desc_pos4, tool=tool, user=user, vel=vel, acc=acc,ovl=ovl, blendT=blendT, config=-1)
print(f"MoveCart errcode:{rtn}")
rtn = robot.MoveJ(joint_pos=j1, tool=tool, user=user, vel=vel, acc=acc, ovl=ovl, exaxis_pos=epos, blendT=blendT, offset_flag=flag, offset_pos=offset_pos)
print(f"movej errcode:{rtn}")
rtn = robot.MoveL(desc_pos=desc_pos2, tool=tool, user=user, vel=vel, acc=acc, ovl=ovl, blendR=blendR, blendMode=blendMode, exaxis_pos=epos, search=search, offset_flag=flag, offset_pos=offset_pos, config=-1,velAccParamMode=velAccMode)
print(f"movel errcode:{rtn}")
rtn = robot.MoveC(desc_pos_p=desc_pos3, tool_p=tool, user_p=user, vel_p=vel, acc_p=acc, exaxis_pos_p=epos, offset_flag_p=flag, offset_pos_p=offset_pos, desc_pos_t=desc_pos4, tool_t=tool, user_t=user, vel_t=vel, acc_t=acc,exaxis_pos_t=epos, offset_flag_t=flag, offset_pos_t=offset_pos, ovl=ovl, blendR=blendR, config=-1, velAccParamMode=velAccMode)
print(f"movec errcode:{rtn}")
rtn = robot.MoveJ(joint_pos=j2, tool=tool, user=user, vel=vel, acc=acc, ovl=ovl, exaxis_pos=epos, blendT=blendT, offset_flag=flag, offset_pos=offset_pos)
print(f"movej errcode:{rtn}")
rtn = robot.Circle(desc_pos_p=desc_pos3, tool_p=tool, user_p=user, vel_p=vel, acc_p=acc, exaxis_pos_p=epos, desc_pos_t=desc_pos1, tool_t=tool, user_t=user, vel_t=vel, acc_t=acc, exaxis_pos_t=epos, ovl=ovl, offset_flag=flag,offset_pos=offset_pos, oacc=oacc, blendR=-1, velAccParamMode=velAccMode)
print(f"circle errcode:{rtn}")
robot.CloseRPC()
return 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

from fairino import Robot
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
j = [67.957-81.48287.595-95.691-94.899-9.727]
desc_pos = [-123.142-551.735430.549178.753-4.757167.754]
offset_pos1 = [50.00.00.0-30.00.00.0]
offset_pos2 = [50.00.00.0-30.00.00.0]
epos = [0.0* 4
sp = [230.050.010.010.001]  # [circle_num, circle_angle, rad_init, rad_add, rotaxis_add, rot_direction, velAccMode]
tool = 0
user = 0
vel = 30.0
acc = 60.0
ovl = 100.0
blendT = -1.0
flag = 2
robot.SetSpeed(20)
rtn = 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)
print(f"movej errcode:{rtn}")
rtn = 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)
print(f"newspiral errcode:{rtn}")
robot.CloseRPC()
return 0

4.13. Start of servo motion

Prototype

ServoMoveStart()

Description

Servo motion start, used with ServoJ, ServoCart commands

Mandatory parameters

NULL

Default parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

4.14. End of servo motion

Prototype

ServoMoveEnd()

Description

End of servo motion, used with ServoJ, ServoCart commands

Mandatory parameters

NULL

Default parameters

NULL

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)

Description

Joint space servo mode motion

Mandatory parameters

  • joint_pos: target joint position in [°];

  • axisPos: external axis position in mm;

Default parameter

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

  • vel: velocity, range [0~100], not open, default 0.0.

  • cmdT: command send cycle, unit s, recommended range [0.001~0.0016], default is 0.008.

  • filterT: filter time in [s], not open, default is 0.0; filterT: filter time in [s], not open, default is 0.0.

  • gain: proportional amplifier for target position, not open yet, default 0.0;

  • id: servoJ command ID, default 0.

Return Value

Error Code Success-0 Failure- errcode

4.16. Example of joint space servo mode motion code

from fairino import Robot
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
j = [0.0* 6
epos = [0.0* 4
vel = 0.0
acc = 0.0
cmdT = 0.008
filterT = 0.0
gain = 0.0
flag = 0
count = 500
dt = 0.1
cmdID = 0
ret, j = robot.GetActualJointPosDegree(flag)
if ret == 0:
    cmdID += 1
    robot.ServoMoveStart()
    while count:
        robot.ServoJ(joint_pos=j,axisPos= epos,acc= acc,vel= vel, cmdT=cmdT, filterT=filterT, gain=gain, id=cmdID)
        j[4+= dt
        count -= 1
        time.sleep(cmdT)
        rtn,pkg = robot.GetRobotRealTimeState()
        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]}")

        if count < 50:
            robot.MotionQueueClear()
            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]}")
            break
    robot.ServoMoveEnd()
else:
    print(f"GetActualJointPosDegree errcode:{ret}")
robot.CloseRPC()

4.17. Joint torque control begins

Prototype

ServoJTStart()

Description

Joint torque control begins

Mandatory parameters

NULL

Default_parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

4.18. 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])

Description

Joint Torque Control

Required Parameters

  • torque: Torque for joints j1~j6, unit: Nm

    • interval: Command cycle, unit: s, range: [0.001~0.008]

    • checkFlag: Detection strategy 0-No restrictions; 1-Power limit; 2-Velocity limit; 3-Both power and velocity limits, default: 0

    • jPowerLimit: Default parameter jPowerLimit Maximum joint power limit (W), default: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

    • jVelLimit: Maximum joint velocity (°/s), default: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

Default Parameters

None

Return Value

Error code Success-0 Failure- errcode

4.19. Joint torque control is completed

Prototype

ServoJTEnd()

Description

Joint torque control is completed

Mandatory parameters

NULL

Default_parameters

NULL

Return Value

Error Code Success-0 Failure- errcode

4.20. Sample code for joint torque control

from fairino import Robot
# Establish a connection with the robot controller and return a robot object if the connection is successful
robot = Robot.RPC('192.168.58.2')
robot.DragTeachSwitch(1)
# torques = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
error,torques = robot.GetJointTorques(1)
robot.ServoJTStart()
count = 100
while count > 0:
    error = robot.ServoJT(torques, 0.001)
    count -= 1
    time.sleep(0.001)
error = robot.ServoJTEnd()
robot.DragTeachSwitch(0)
robot.CloseRPC()

4.21. Joint Torque Control Code Example with Overspeed Protection

from fairino import Robot
import time
robot = Robot.RPC('192.168.58.2')
robot.ResetAllError()
time.sleep(0.5)
torques = [0.0* 6
rtn, torques = robot.GetJointTorques(1)
robot.ServoJTStart()
robot.DragTeachSwitch(1)
checkFlag = 3
jPowerLimit = [10.010.010.010.010.010.0]
jVelLimit = [181,80,80,80,80,80]
count = 800000
error = 0
while count > 0:
    torques[2= torques[2+ 0.01
    error = robot.ServoJT(torques, 0.008, checkFlag, jPowerLimit, jVelLimit)
    print(f"ServoJT rtn is {error}")
    count = count - 1
    time.sleep(0.001)
    rtn,pkg = robot.GetRobotRealTimeState()
    print(f"maincode {pkg.main_code},subcode {pkg.sub_code}")
robot.DragTeachSwitch(0)
error = robot.ServoJTEnd()

robotic arm
FAIRINO ROBOTIC ARMS

Contact

Location: 10637 Scripps Summit Court,

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

© 2023 Fairino US official site Proudly created By G2T

bottom of page