top of page
9.1. Set TPD trajectory recording parameters
/**
* @brief Set TPD trajectory recording parameters
* @param [in] type Recording data type, 1-Joint position
* @param [in] name Trajectory file name
* @param [in] period_ms Data sampling period, fixed value 2ms/4ms/8ms
* @param [in] di_choose DI selection, bit0~bit7 correspond to controller DI0~DI7, bit8~bit9 correspond to end DI0~DI1, 0-Not selected, 1-Selected
* @param [in] do_choose DO selection, bit0~bit7 correspond to controller DO0~DO7, bit8~bit9 correspond to end DO0~DO1, 0-Not selected, 1-Selected
* @return Error code
*/
int SetTPDParam(int type, String name, int period_ms, int di_choose, int do_choose);
9.2. Start TPD trajectory recording
/**
* @brief Start TPD trajectory recording
* @param [in] type Recording data type, 1-Joint position
* @param [in] name Trajectory file name
* @param [in] period_ms Data sampling period, fixed value 2ms/4ms/8ms
* @param [in] di_choose DI selection, bit0~bit7 correspond to controller DI0~DI7, bit8~bit9 correspond to end DI0~DI1, 0-Not selected, 1-Selected
* @param [in] do_choose DO selection, bit0~bit7 correspond to controller DO0~DO7, bit8~bit9 correspond to end DO0~DO1, 0-Not selected, 1-Selected
* @return Error code
*/
int SetTPDStart(int type, String name, int period_ms, int di_choose, int do_choose);
9.3. Stop TPD trajectory recording
/**
* @brief Stop TPD trajectory recording
* @return Error code
*/
int SetWebTPDStop();
9.4. Delete TPD trajectory recording
/**
* @brief Delete TPD trajectory recording
* @param [in] name Trajectory file name
* @return Error code
*/
int SetTPDDelete(string name);
9.5. TPD trajectory preloading
/**
* @brief Trajectory preloading
* @param [in] name Trajectory file name
* @return Error code
*/
int LoadTPD(String name);
9.6. TPD trajectory playback
/**
* @brief Trajectory playback
* @param [in] name Trajectory file name
* @param [in] blend 0-No smoothing, 1-Smoothing
* @param [in] ovl Speed scaling percentage, range [0~100]
* @return Error code
*/
int MoveTPD(String name, int blend, double ovl);
9.7. Get TPD starting pose
/**
* @brief Get trajectory starting pose
* @param [in] name Trajectory file name (without extension)
* @param [out] desc_pose Retrieved trajectory starting pose
* @return Error code
*/
int GetTPDStartPose(String name, DescPose desc_pose);
9.8. Robot TPD trajectory recording code example
public static int TestTPD(Robot robot)
{
int type = 1;
String name = "tpd2025";
int period_ms = 4;
int di_choose = 0;
int do_choose = 0;
robot.SetTPDParam(type, name, period_ms, di_choose, do_choose);
robot.Mode(1);
robot.Sleep(1000);
robot.DragTeachSwitch(1);
robot.SetTPDStart(type, name, period_ms, di_choose, do_choose);
robot.Sleep(10000);
robot.SetWebTPDStop();
robot.DragTeachSwitch(0);
double ovl = 100.0;
int blend = 0;
DescPose start_pose =new DescPose() {};
int rtn = robot.LoadTPD(name);
System.out.println("LoadTPD rtn is:"+ rtn);
robot.GetTPDStartPose(name, start_pose);
robot.MoveCart(start_pose, 0, 0, 100, 100, ovl, -1, -1);
robot.Sleep(1000);
rtn = robot.MoveTPD(name, blend, ovl);
System.out.println("MoveTPD rtn is: "+ rtn);
robot.Sleep(5000);
robot.SetTPDDelete(name);
return 0;
}
9.9. Trajectory preprocessing
/**
* @brief External trajectory file preprocessing
* @param [in] name Trajectory file name
* @param [in] ovl Speed scaling percentage, range [0~100]
* @param [in] opt 1-Control point (default)
* @return Error code
*/
int LoadTrajectoryJ(String name, double ovl, int opt);
9.10. Trajectory playback
/**
* @brief External trajectory file playback
* @return Error code
*/
int MoveTrajectoryJ();
9.11. Get trajectory starting pose
/**
* @brief Get trajectory starting pose
* @param [in] name Trajectory file name
* @param [out] desc_pose Retrieved trajectory starting pose
* @return Error code
*/
int GetTrajectoryStartPose(String name, DescPose desc_pose);
9.12. Get trajectory point number
/**
* @brief Get trajectory point number
* @return Error code
*/
public int GetTrajectoryPointNum(int pnum)
9.13. Set trajectory playback speed
/**
* @brief Set trajectory playback speed
* @param [in] ovl Speed percentage
* @return Error code
*/
public int SetTrajectoryJSpeed(double ovl)
9.14. Set force/torque during trajectory playback
/**
* @brief Set force/torque during trajectory playback
* @param [in] ft Force and torque in three directions (unit: N and Nm)
* @return Error code
*/
public int SetTrajectoryJForceTorque(ForceTorque ft)
9.15. Set x-direction force during trajectory playback
/**
* @brief Set x-direction force during trajectory playback
* @param [in] fx x-direction force (unit: N)
* @return Error code
*/
int SetTrajectoryJForceFx(double fx);
9.16. Set y-direction force during trajectory playback
/**
* @brief Set y-direction force during trajectory playback
* @param [in] fy y-direction force (unit: N)
* @return Error code
*/
int SetTrajectoryJForceFy(double fy);
9.17. Set z-direction force during trajectory playback
/**
* @brief Set z-direction force during trajectory playback
* @param [in] fz z-direction force (unit: N)
* @return Error code
*/
int SetTrajectoryJForceFz(double fz);
9.18. Set x-axis torque during trajectory playback
/**
* @brief Set x-axis torque during trajectory playback
* @param [in] tx x-axis torque (unit: Nm)
* @return Error code
*/
int SetTrajectoryJTorqueTx(double tx);
9.19. Set y-axis torque during trajectory playback
/**
* @brief Set y-axis torque during trajectory playback
* @param [in] ty y-axis torque (unit: Nm)
* @return Error code
*/
int SetTrajectoryJTorqueTy(double ty);
9.20. Set z-axis torque during trajectory playback
/**
* @brief Set z-axis torque during trajectory playback
* @param [in] tz z-axis torque (unit: Nm)
* @return Error code
*/
int SetTrajectoryJTorqueTz(double tz);
9.21. Upload trajectory J file
/**
* @brief Upload trajectory J file
* @param [in] filePath Full path of trajectory file (e.g., C://test/testJ.txt)
* @return Error code
*/
int TrajectoryJUpLoad(String filePath);
9.22. Delete trajectory J file
/**
* @brief Delete trajectory J file
* @param [in] fileName File name (e.g., testJ.txt)
* @return Error code
*/
int TrajectoryJDelete(String fileName);
9.23. Robot trajectory J file playback code example
public static int TestTraj(Robot robot)
{
int rtn = robot.TrajectoryJUpLoad("D://zUP/traj.txt");
System.out.println("Upload TrajectoryJ A :"+ rtn);
String traj_file_name = "/fruser/traj/traj.txt";
rtn = robot.LoadTrajectoryJ(traj_file_name, 100, 1);
System.out.println("LoadTrajectoryJ:"+traj_file_name+", rtn is:"+ rtn);
DescPose traj_start_pose=new DescPose(0,0,0,0,0,0);
rtn = robot.GetTrajectoryStartPose(traj_file_name, traj_start_pose);
robot.Sleep(1000);
ExaxisPos epos=new ExaxisPos(0,0,0,0);
DescPose po=new DescPose(0,0,0,0,0,0);
robot.SetSpeed(50);
robot.MoveCart(traj_start_pose, 0, 0, 100, 100, 100, -1, -1);
int traj_num = 0;
rtn = robot.GetTrajectoryPointNum(traj_num);
rtn = robot.SetTrajectoryJSpeed(50.0);
System.out.println("SetTrajectoryJSpeed is:"+ rtn);
ForceTorque traj_force=new ForceTorque(0,0,0,0,0,0);
traj_force.fx = 10;
rtn = robot.SetTrajectoryJForceTorque(traj_force);
System.out.println("SetTrajectoryJForceTorque rtn is: "+ rtn);
rtn = robot.SetTrajectoryJForceFx(10.0);
System.out.println("SetTrajectoryJForceFx rtn is:"+ rtn);
rtn = robot.SetTrajectoryJForceFy(0.0);
System.out.println("SetTrajectoryJForceFy rtn is:"+ rtn);
rtn = robot.SetTrajectoryJForceFz(0.0);
System.out.println("SetTrajectoryJForceFz rtn is: "+ rtn);
rtn = robot.SetTrajectoryJTorqueTx(10.0);
System.out.println("SetTrajectoryJTorqueTx rtn is: "+ rtn);
rtn = robot.SetTrajectoryJTorqueTy(10.0);
System.out.println("SetTrajectoryJTorqueTy rtn is:"+ rtn);
rtn = robot.SetTrajectoryJTorqueTz(10.0);
System.out.println("SetTrajectoryJTorqueTz rtn is:"+ rtn);
rtn = robot.MoveTrajectoryJ();
System.out.println("MoveTrajectoryJ rtn is: "+ rtn);
return 0;
}
9.24. Trajectory preprocessing (lookahead)
New in version Java: SDK-v1.0.3-3.8.0
/**
* @brief Trajectory preprocessing (lookahead)
* @param [in] name Trajectory file name
* @param [in] mode Sampling mode: 0-No sampling; 1-Equal interval sampling; 2-Equal error limit sampling
* @param [in] errorLim Error limit (effective when using linear fitting)
* @param [in] type Smoothing method: 0-Bezier smoothing
* @param [in] precision Smoothing precision (effective when using Bezier smoothing)
* @param [in] vamx Maximum speed setting (mm/s)
* @param [in] amax Maximum acceleration setting (mm/s²)
* @param [in] jmax Maximum jerk setting (mm/s³)
* @return Error code
*/
int LoadTrajectoryLA(String name, int mode, double errorLim, int type, double precision, double vamx, double amax, double jmax);
9.25. Trajectory playback (lookahead)
New in version Java: SDK-v1.0.3-3.8.0
/**
* @brief Trajectory playback (lookahead)
* @return Error code
*/
int MoveTrajectoryLA();
9.26. Trajectory playback (lookahead) code example
public static int TestLoadTrajLA(Robot robot)
{
int rtn = robot.TrajectoryJUpLoad("D://zUP/traj.txt");
String traj_file_name = "/fruser/traj/traj.txt";
rtn = robot.LoadTrajectoryLA(traj_file_name, 1, 2, 0, 2, 100, 200, 1000);
DescPose traj_start_pose=new DescPose(0,0,0,0,0,0);
rtn = robot.GetTrajectoryStartPose(traj_file_name, traj_start_pose);
robot.Sleep(1000);
robot.SetSpeed(50);
robot.MoveCart(traj_start_pose, 0, 0, 100, 100, 100, -1, -1);
rtn = robot.MoveTrajectoryLA();
robot.CloseRPC();
return 0;
}
bottom of page