9.1. Setting Track Recording Parameters
prototype | SetTPDParam(name, period_ms, type=1,di_choose=0, do_choose=0) |
Description | Setting parameters for track logging |
Mandatory parameters |
|
Default parameters |
|
Return Value | Error Code Success-0 Failure- errcode |
9.2. Start Track Recording
Prototype | SetTPDStart(name, period_ms, type=1,di_choose=0, do_choose=0) |
Description | Start Track Record |
Mandatory parameters |
|
Default parameters |
|
Return Value | Error Code Success-0 Failure- errcode |
9.3. Stop Track Recording
prototype | SetWebTPDStop() |
Description | Stop Track Record |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.4. Deleting track records
Prototype | SetTPDDelete(name) |
Description | Delete Track Record |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.5. 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')
type = 1
name = "tpd2025"
period_ms = 4
di_choose = 0
do_choose = 0
robot.SetTPDParam(name, period_ms)
robot.Mode(1)
time.sleep(1)
robot.DragTeachSwitch(1)
robot.SetTPDStart(name, period_ms)
print("SetTPDStart")
time.sleep(10)
robot.SetWebTPDStop()
robot.DragTeachSwitch(0)
robot.CloseRPC()
9.6. Trajectory preloading
Prototype | LoadTPD(name) |
Description | Trajectory Preloading |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.7. Trajectory Reproduction
Prototype | MoveTPD(name,blend,ovl) |
Description | Trajectory Reproduction |
Mandatory parameters |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.8. Get the starting position of the trajectory
Prototype | GetTPDStartPose(name) |
Description | Get trajectory start position |
Mandatory parameters |
|
Default parameters | NULL |
Return Value |
|
9.9. Example of robot TPD trajectory recording code
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')
type = 1
name = "tpd2025"
period_ms = 4
di_choose = 0
do_choose = 0
ovl = 100.0
blend = 0
rtn = robot.LoadTPD(name)
print(f"LoadTPD rtn is: {rtn}")
error,start_pose = robot.GetTPDStartPose(name)
print(f"start pose, xyz is: {start_pose[0]},{start_pose[1]},{start_pose[2]}. "
f"rpy is: {start_pose[3]},{start_pose[4]},{start_pose[5]}")
robot.MoveCart(start_pose, 0, 0, 100, 100)
time.sleep(1)
rtn = robot.MoveTPD(name, blend, ovl)
print(f"MoveTPD rtn is: {rtn}")
time.sleep(5)
robot.SetTPDDelete(name)
robot.CloseRPC()
9.10. Trajectory preprocessing
prototype | LoadTrajectoryJ(name,ovl,opt=1) |
description | trajectory preprocessing |
Mandatory parameters |
|
Default parameter |
|
Return Value | Error Code Success-0 Failure- errcode |
9.11. Trajectory Reproduction
Prototype | MoveTrajectoryJ() |
Description | Trajectory Reproduction |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.12. Getting the starting position of the trajectory
Prototype | GetTrajectoryStartPose(name) |
Description | Get trajectory starting position |
Mandatory parameters | name: track name |
Default parameters | NULL |
Return Value |
|
9.13. Get track point number
prototype | GetTrajectoryPointNum() |
Description | Get track point number |
Mandatory parameters | NULL |
Default parameters | NULL |
Return Value |
|
9.14. Setting the speed of the trajectory in operation
Prototype | SetTrajectoryJSpeed(ovl) |
Description | Sets the speed of the trajectory as it runs. |
Mandatory parameter | ovl: speed scaling percentage, range [0~100] |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.15. Setting the force and torque during trajectory operation
Prototype | SetTrajectoryJForceTorque(ft) |
Description | Setting the force and torque in the trajectory run |
Mandatory parameters | ft=[fx,fy,fz,tx,ty,tz]: units N and Nm |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.16. Setting the force along the x-direction in the trajectory run
Prototype | SetTrajectoryJForceFx(fx) |
Description | Set the force along the x-direction in the trajectory run |
Mandatory parameter | ft: force in x direction, in N |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.17. Setting the force along the y-direction in the trajectory run
Prototype | SetTrajectoryJForceFx(fy) |
Description | Set the force along the y-direction in the trajectory run |
Mandatory parameter | fy: force along y direction in N |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.18. Setting the force along the z-direction in a trajectory run
Prototype | SetTrajectoryJForceFx(fz) |
Description | Set the force along the z-direction in the trajectory run |
Mandatory parameter | fz: force along the z-direction, in N |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.19. Setting the torque around the x-axis in a trajectory run
Prototype | SetTrajectoryJTorqueTx(tx) |
Description | Set the torque around the x-axis for the trajectory run |
Mandatory parameter | tx: torque around x-axis in Nm |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.20. Setting the torque around the y-axis in trajectory operation
prototype | SetTrajectoryJTorqueTx(ty) |
Description | Set the torque around the y-axis for the trajectory run |
Mandatory parameter | ty: torque around y-axis in Nm |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.21. Setting the torque around the z-axis in trajectory operation
Prototype | SetTrajectoryJTorqueTx(tz) |
Description | Sets the torque around the z-axis for the trajectory run |
Mandatory parameter | tz: torque around z-axis in Nm |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.22. Upload trace J file
New in version python: SDK-v2.0.7
Prototype | TrajectoryJUpLoad(filePath) |
Description | Upload trace J file |
Mandatory parameter |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.23. Delete the track J file
New in version python: SDK-v2.0.7
Prototype | TrajectoryJDelete(filePath) |
Description | Delete the track J file |
Mandatory parameter |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.24. Robot trajectory J file reproduction 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')
rtn = robot.TrajectoryJUpLoad("D://zUP/traj.txt")
print(f"Upload TrajectoryJ A {rtn}")
traj_file_name = "/fruser/traj/traj.txt"
rtn = robot.LoadTrajectoryJ(traj_file_name, 100, 1)
print(f"LoadTrajectoryJ {traj_file_name}, rtn is: {rtn}")
rtn,traj_start_pose = robot.GetTrajectoryStartPose(traj_file_name)
print(f"GetTrajectoryStartPose is: {rtn}")
print(f"desc_pos:{traj_start_pose[0]},{traj_start_pose[1]},{traj_start_pose[2]},"
f"{traj_start_pose[3]},{traj_start_pose[4]},{traj_start_pose[5]}")
time.sleep(1)
robot.SetSpeed(50)
robot.MoveCart(traj_start_pose, 0, 0, 50, 100, 100)
rtn,traj_num = robot.GetTrajectoryPointNum()
print(f"GetTrajectoryStartPose rtn is: {rtn}, traj num is: {traj_num}")
rtn = robot.SetTrajectoryJSpeed(50.0)
print(f"SetTrajectoryJSpeed is: {rtn}")
traj_force = [0.0,0.0,0.0,0.0,0.0,0.0]
traj_force[0] = 10 # fx = 10
rtn = robot.SetTrajectoryJForceTorque(traj_force)
print(f"SetTrajectoryJForceTorque rtn is: {rtn}")
rtn = robot.SetTrajectoryJForceFx(10.0)
print(f"SetTrajectoryJForceFx rtn is: {rtn}")
rtn = robot.SetTrajectoryJForceFy(0.0)
print(f"SetTrajectoryJForceFy rtn is: {rtn}")
rtn = robot.SetTrajectoryJForceFz(0.0)
print(f"SetTrajectoryJForceFz rtn is: {rtn}")
rtn = robot.SetTrajectoryJTorqueTx(10.0)
print(f"SetTrajectoryJTorqueTx rtn is: {rtn}")
rtn = robot.SetTrajectoryJTorqueTy(10.0)
print(f"SetTrajectoryJTorqueTy rtn is: {rtn}")
rtn = robot.SetTrajectoryJTorqueTz(10.0)
print(f"SetTrajectoryJTorqueTz rtn is: {rtn}")
rtn = robot.MoveTrajectoryJ()
print(f"MoveTrajectoryJ rtn is: {rtn}")
robot.CloseRPC()
9.25. Trajectory preprocessing(Trajectory foresight)
New in version python: SDK-v2.1.4
Prototype | LoadTrajectoryLA(name, mode, errorLim, type, precision, vamx, amax, jmax, flag) |
Description | Trajectory preprocessing(Trajectory foresight) |
Mandatory parameter |
|
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.26. Trajectory reproduction(Trajectory foresight)
New in version python: SDK-v2.1.0
Prototype | MoveTrajectoryLA() |
Description | Trajectory reproduction(Trajectory foresight) |
Mandatory parameter | NULL |
Default parameters | NULL |
Return Value | Error Code Success-0 Failure- errcode |
9.27. Code example for trajectory reproduction
from fairino import Robot
import time
# A connection is established with the robot controller and a robot object is returned if the connection is successful
robot = Robot.RPC('192.168.58.2')
rtn = robot.TrajectoryJUpLoad("D://zUP/traj.txt")
print(f"Upload TrajectoryJ A {rtn}")
traj_file_name = "/fruser/traj/traj.txt"
rtn = robot.LoadTrajectoryLA(traj_file_name, 1, 2, 0, 2, 50, 200, 1000, 0)
print(f"LoadTrajectoryLA {traj_file_name}, rtn is: {rtn}")
rtn, traj_start_pose = robot.GetTrajectoryStartPose(traj_file_name)
print(f"GetTrajectoryStartPose is: {rtn}")
print(f"desc_pos: {traj_start_pose[0]},{traj_start_pose[1]},{traj_start_pose[2]},{traj_start_pose[3]},{traj_start_pose[4]},{traj_start_pose[5]}")
time.sleep(1)
robot.SetSpeed(50)
robot.MoveCart(traj_start_pose, 0, 0, 100, 100, 100)
rtn = robot.MoveTrajectoryLA()
print(f"MoveTrajectoryLA rtn is: {rtn}")
robot.CloseRPC()