top of page
public int testSyncMoveL(Robot robot)
{
//1. Calibrate and apply robot tool coordinate system. You can use the four-point or six-point method for tool coordinate system calibration and application. The interfaces involved are as follows:
// int SetToolPoint(int point_num); //Set tool reference point - six-point method
// int ComputeTool(ref DescPose tcp_pose); //Calculate tool coordinate system
// int SetTcp4RefPoint(int point_num); //Set tool reference point - four-point method
// int ComputeTcp4(ref DescPose tcp_pose); //Calculate tool coordinate system - four-point method
// int SetToolCoord(int id, DescPose coord, int type, int install); //Set and apply tool coordinate system
// int SetToolList(int id, DescPose coord, int type, int install); //Set and apply tool coordinate system list
//2. Set UDP communication parameters and load UDP communication
UDPComParam param=new UDPComParam("192.168.58.88", 2021, 2, 100, 3, 100, 1, 100, 10,0);
robot.ExtDevSetUDPComParam(param);
robot.ExtDevLoadUDPDriver();
//3. Set extended axis parameters, including extended axis type, extended axis driver parameters, and extended axis DH parameters
robot.SetAxisDHParaConfig(4, 200, 200, 0, 0, 0, 0, 0, 0); //Single-axis positioner and DH parameters
robot.SetRobotPosToAxis(1); //Extended axis installation position
robot.ExtAxisParamConfig(1, 0, 1, 100, -100, 10, 10, 12, 131072, 0, 1, 0, 0); //Servo driver parameters. This example is for a single-axis positioner, so only one driver parameter needs to be set. If you choose an extended axis type with multiple axes, each axis needs to be configured.
//4. Enable the selected axis and perform homing
robot.ExtAxisServoOn(1, 0);
robot.ExtAxisSetHoming(1, 0, 20, 3);
//5. Perform extended axis coordinate system calibration and application
DescPose pos = new DescPose(/* Enter your calibration point coordinates */ );
robot.SetRefPointInExAxisEnd(pos);
robot.PositionorSetRefPoint(1); /*You need to call this interface 4 times with different points to complete the calibration */
DescPose coord = new DescPose();
robot.PositionorComputeECoordSys(coord); //Calculate extended axis calibration result
robot.ExtAxisActiveECoordSys(1, 1, coord, 1); //Apply the calibration result to the extended axis coordinate system
//6. Calibrate the workpiece coordinate system on the extended axis. You will need the following interfaces:
//int SetWObjCoordPoint(int point_num);
//int ComputeWObjCoord(int method, ref DescPose wobj_pose);
//int SetWObjCoord(int id, DescPose coord);
//int SetWObjList(int id, DescPose coord);
//7. Record your synchronous joint motion starting point
DescPose startdescPose = new DescPose(/*Enter your coordinates*/ );
JointPos startjointPos = new JointPos(/*Enter your coordinates*/ );
ExaxisPos startexaxisPos = new ExaxisPos(/* Enter your extended axis starting point coordinates */ );
//8. Record your synchronous joint motion end point coordinates
DescPose enddescPose = new DescPose(/*Enter your coordinates*/ );
JointPos endjointPos = new JointPos(/*Enter your coordinates*/ );
ExaxisPos endexaxisPos =new ExaxisPos(/* Enter your extended axis end point coordinates */);
//9. Write the synchronous motion program
//Move to the starting point, assuming the applied tool coordinate system and workpiece coordinate system are both 1
robot.ExtAxisMove(startexaxisPos, 20);
DescPose offdese = new DescPose( 0, 0, 0, 0, 0, 0 );
robot.MoveJ(startjointPos, startdescPose, 1, 1, 100, 100, 100, startexaxisPos, 0, 0, offdese);
//Start synchronous motion
robot.ExtAxisSyncMoveL(endjointPos, enddescPose, 1, 1, 100, 100, 100, 0, endexaxisPos, 0, offdese);
robot.MoveJ(startjointPos, 1, 1, 100, 100, 100, startexaxisPos, 0, 0, offdese);
//Start synchronous motion
robot.ExtAxisSyncMoveL(enddescPose, 1, 1, 100, 100, 100, 0, endexaxisPos, 0, offdese,-1);
robot.CloseRPC();
return 0;
}
13.47. UDP Extended Axis and Robot Arc Motion Synchronous Motion
/**
* @brief UDP extended axis and robot arc motion synchronous motion
* @param [in] joint_pos_p Path point joint position, unit deg
* @param [in] desc_pos_p Path point Cartesian pose
* @param [in] ptool Tool coordinate number, range [0~14]
* @param [in] puser Workpiece coordinate number, range [0~14]
* @param [in] pvel Speed percentage, range [0~100]
* @param [in] pacc Acceleration percentage, range [0~100], not yet available
* @param [in] epos_p Intermediate point extended axis position, unit mm
* @param [in] poffset_flag 0-no offset, 1-offset in base coordinate system/workpiece coordinate system, 2-offset in tool coordinate system
* @param [in] offset_pos_p Pose offset
* @param [in] joint_pos_t Target point joint position, unit deg
* @param [in] desc_pos_t Target point Cartesian pose
* @param [in] ttool Tool coordinate number, range [0~14]
* @param [in] tuser Workpiece coordinate number, range [0~14]
* @param [in] tvel Speed percentage, range [0~100]
* @param [in] tacc Acceleration percentage, range [0~100], not yet available
* @param [in] epos_t Extended axis position, unit mm
* @param [in] toffset_flag 0-no offset, 1-offset in base coordinate system/workpiece coordinate system, 2-offset in tool coordinate system
* @param [in] offset_pos_t Pose offset
* @param [in] ovl Speed scaling factor, range [0~100]
* @param [in] blendR [-1.0]-motion到位(blocking), [0~1000.0]-smoothing radius (non-blocking), unit mm
* @return Error code
*/
int ExtAxisSyncMoveC(JointPos joint_pos_p, DescPose desc_pos_p, int ptool, int puser, double pvel, double pacc, ExaxisPos epos_p, int poffset_flag, DescPose offset_pos_p, JointPos joint_pos_t, DescPose desc_pos_t, int ttool, int tuser, double tvel, double tacc, ExaxisPos epos_t, int toffset_flag, DescPose offset_pos_t, double ovl, double blendR);
13.48. UDP extended axis and robot circular motion synchronous motion (automatic inverse kinematics calculation)
New in version Java: SDK-v1.0.8-3.8.5
/**
* @brief UDP extended axis and robot circular motion synchronous motion (automatic inverse kinematics calculation)
* @param [in] desc_pos_p Path point cartesian pose
* @param [in] ptool Tool coordinate number, range [0~14]
* @param [in] puser Workpiece coordinate number, range [0~14]
* @param [in] pvel Velocity percentage, range [0~100]
* @param [in] pacc Acceleration percentage, range [0~100], not open yet
* @param [in] epos_p Extended axis position, unit mm
* @param [in] poffset_flag 0-no offset, 1-offset in base/workpiece coordinate system, 2-offset in tool coordinate system
* @param [in] offset_pos_p Pose offset
* @param [in] desc_pos_t Target point cartesian pose
* @param [in] ttool Tool coordinate number, range [0~14]
* @param [in] tuser Workpiece coordinate number, range [0~14]
* @param [in] tvel Velocity percentage, range [0~100]
* @param [in] tacc Acceleration percentage, range [0~100], not open yet
* @param [in] epos_t Extended axis position, unit mm
* @param [in] toffset_flag 0-no offset, 1-offset in base/workpiece coordinate system, 2-offset in tool coordinate system
* @param [in] offset_pos_t Pose offset
* @param [in] ovl Velocity scaling factor, range [0~100]
* @param [in] blendR [-1.0]-move to position (blocking), [0~1000.0]-smoothing radius (non-blocking), unit mm
* @param [in] config Inverse kinematics joint space configuration, [-1]-calculate based on current joint position, [0~7]-solve according to specific joint space configuration
* @return Error code
*/
int ExtAxisSyncMoveC(DescPose desc_pos_p, int ptool, int puser, double pvel, double pacc, ExaxisPos epos_p, int poffset_flag, DescPose offset_pos_p, DescPose desc_pos_t, int ttool, int tuser, double tvel, double tacc, ExaxisPos epos_t, int toffset_flag, DescPose offset_pos_t, double ovl, double blendR,int config)
13.49. UDP Extended Axis and Robot Arc Motion Synchronous Motion Code Example
public int testSyncMoveC(Robot robot)
{
//1. Calibrate and apply robot tool coordinate system. You can use the four-point or six-point method for tool coordinate system calibration and application. The interfaces involved are as follows:
// int SetToolPoint(int point_num); //Set tool reference point - six-point method
// int ComputeTool(ref DescPose tcp_pose); //Calculate tool coordinate system
// int SetTcp4RefPoint(int point_num); //Set tool reference point - four-point method
// int ComputeTcp4(ref DescPose tcp_pose); //Calculate tool coordinate system - four-point method
// int SetToolCoord(int id, DescPose coord, int type, int install); //Set and apply tool coordinate system
// int SetToolList(int id, DescPose coord, int type, int install); //Set and apply tool coordinate system list
//2. Set UDP communication parameters and load UDP communication
UDPComParam param=new UDPComParam("192.168.58.88", 2021, 2, 100, 3, 100, 1, 100, 10,0);
robot.ExtDevSetUDPComParam(param);
robot.ExtDevLoadUDPDriver();
//3. Set extended axis parameters, including extended axis type, extended axis driver parameters, and extended axis DH parameters
robot.SetAxisDHParaConfig(4, 200, 200, 0, 0, 0, 0, 0, 0); //Single-axis positioner and DH parameters
robot.SetRobotPosToAxis(1); //Extended axis installation position
robot.ExtAxisParamConfig(1, 0, 1, 100, -100, 10, 10, 12, 131072, 0, 1, 0, 0); //Servo driver parameters. This example is for a single-axis positioner, so only one driver parameter needs to be set. If you choose an extended axis type with multiple axes, each axis needs to be configured.
//4. Enable the selected axis and perform homing
robot.ExtAxisServoOn(1, 0);
robot.ExtAxisSetHoming(1, 0, 20, 3);
//5. Perform extended axis coordinate system calibration and application
DescPose pos = new DescPose(/* Enter your calibration point coordinates */ );
robot.SetRefPointInExAxisEnd(pos);
robot.PositionorSetRefPoint(1); /*You need to call this interface 4 times with different points to complete the calibration */
DescPose coord = new DescPose();
robot.PositionorComputeECoordSys(coord); //Calculate extended axis calibration result
robot.ExtAxisActiveECoordSys(1, 1, coord, 1); //Apply the calibration result to the extended axis coordinate system
//6. Calibrate the workpiece coordinate system on the extended axis. You will need the following interfaces:
//int SetWObjCoordPoint(int point_num);
//int ComputeWObjCoord(int method, ref DescPose wobj_pose);
//int SetWObjCoord(int id, DescPose coord);
//int SetWObjList(int id, DescPose coord);
//7. Record your synchronous arc motion starting point
DescPose startdescPose = new DescPose(/*Enter your coordinates*/ );
JointPos startjointPos = new JointPos(/*Enter your coordinates*/ );
ExaxisPos startexaxisPos = new ExaxisPos(/* Enter your extended axis starting point coordinates */ );
//8. Record your synchronous arc motion end point coordinates
DescPose enddescPose = new DescPose(/*Enter your coordinates*/ );
JointPos endjointPos = new JointPos(/*Enter your coordinates*/ );
ExaxisPos endexaxisPos = new ExaxisPos(/* Enter your extended axis end point coordinates */ );
//9. Record your synchronous arc motion intermediate point coordinates
DescPose middescPose = new DescPose(/*Enter your coordinates*/ );
JointPos midjointPos =new JointPos(/*Enter your coordinates*/ );
ExaxisPos midexaxisPos = new ExaxisPos(/* Enter the extended axis coordinates when the robot is at the arc intermediate point */ );
//10. Write the synchronous motion program
//Move to the starting point, assuming the applied tool coordinate system and workpiece coordinate system are both 1
robot.ExtAxisMove(startexaxisPos, 20);
DescPose offdese = new DescPose( 0, 0, 0, 0, 0, 0 );
robot.MoveJ(startjointPos, startdescPose, 1, 1, 100, 100, 100, startexaxisPos, 0, 0, offdese);
//Start synchronous motion
robot.ExtAxisSyncMoveC(midjointPos, middescPose, 1, 1, 100, 100, midexaxisPos, 0, offdese, endjointPos, enddescPose, 1, 1, 100, 100, endexaxisPos, 0, offdese, 100, 0);
robot.MoveJ(startjointPos, 1, 1, 100, 100, 100, startexaxisPos, 0, 0, offdese);
//Start synchronous motion
robot.ExtAxisSyncMoveC(middescPose, 1, 1, 100, 100, midexaxisPos, 0, offdese, enddescPose, 1, 1, 100, 100, endexaxisPos, 0, offdese, 100, 0,-1);
robot.CloseRPC();
return 0;
}
13.50. Set Extended DO
/**
* @brief Set extended DO
* @param [in] DONum DO number
* @param [in] bOpen Switch true-on; false-off
* @param [in] smooth Whether to smooth
* @param [in] block Whether to block
* @return Error code
*/
int SetAuxDO(int DONum, boolean bOpen, boolean smooth, boolean block);
13.51. Set Extended AO
/**
* @brief Set extended AO
* @param [in] AONum AO number
* @param [in] value Analog value [0-4095]
* @param [in] block Whether to block
* @return Error code
*/
int SetAuxAO(int AONum, double value, boolean block);
13.52. Set Extended DI Input Filter Time
/**
* @brief Set extended DI input filter time
* @param [in] filterTime Filter time (ms)
* @return Error code
*/
int SetAuxDIFilterTime(int filterTime);
13.53. Set Extended AI Input Filter Time
/**
* @brief Set extended AI input filter time
* @param [in] AONum AO number
* @param [in] filterTime Filter time (ms)
* @return Error code
*/
int SetAuxAIFilterTime(int AONum, int filterTime);
13.54. Wait for Extended DI Input
/**
* @brief Wait for extended DI input
* @param [in] DINum DI number
* @param [in] bOpen Switch 0-off; 1-on
* @param [in] time Maximum wait time (ms)
* @param [in] errorAlarm Whether to continue motion
* @return Error code
*/
int WaitAuxDI(int DINum, boolean bOpen, int time, boolean errorAlarm);
13.55. Wait for Extended AI Input
/**
* @brief Wait for extended AI input
* @param [in] AINum AI number
* @param [in] sign 0-greater than; 1-less than
* @param [in] value AI value
* @param [in] time Maximum wait time (ms)
* @param [in] errorAlarm Whether to continue motion
* @return Error code
*/
int WaitAuxAI(int AINum, int sign, int value, int time, boolean errorAlarm);
13.56. Get Extended DI Value
/**
* @brief Get extended DI value
* @param [in] DINum DI number
* @param [in] isNoBlock Whether to block
* @return List[0]: Error code; List[1] : isOpen 0-off; 1-on
*/
List<Integer> GetAuxDI(int DINum, boolean isNoBlock)
13.57. Get Extended AI Value
/**
* @brief Get extended AI value
* @param [in] AINum AI number
* @param [in] isNoBlock Whether to block
* @return List[0]: Error code; List[1] : value Input value
*/
List<Integer> GetAuxAI(int AINum, boolean isNoBlock);
13.58. Extended IO Code Example
public static int TestAuxDOAO(Robot robot)
{
for (int i = 0; i < 128; i++)
{
robot.SetAuxDO(i, true, false, true);
robot.Sleep(100);
}
for (int i = 0; i < 128; i++)
{
robot.SetAuxDO(i, false, false, true);
robot.Sleep(100);
}
for (int i = 0; i < 409; i++)
{
robot.SetAuxAO(0, i * 10, true);
robot.SetAuxAO(1, 4095 - i * 10, true);
robot.SetAuxAO(2, i * 10, true);
robot.SetAuxAO(3, 4095 - i * 10, true);
robot.Sleep(10);
}
robot.SetAuxDIFilterTime(10);
robot.SetAuxAIFilterTime(0, 10);
int curValue = -1;
List<Integer> liter=new ArrayList<>();
for (int i = 0; i < 4; i++)
{
liter = robot.GetAuxAI(i, true);
}
robot.WaitAuxDI(1, false, 1000, false);
robot.WaitAuxAI(1, 1, 132, 1000, false);
robot.CloseRPC();
return 0;
}
13.59. Movable Device Enable
/**
* @brief Movable device enable
* @param [in] enable false-disable; true-enable
* @return Error code
*/
int TractorEnable(Boolean enable);
13.60. Movable Device Homing
/**
* @brief Movable device homing
* @return Error code
*/
int TractorHoming();
13.61. Movable Device Linear Motion
/**
* @brief Movable device linear motion
* @param [in] distance Linear motion distance (mm)
* @param [in] vel Linear motion speed percentage (0-100)
* @return Error code
*/
int TractorMoveL(double distance, double vel);
13.62. Movable Device Arc Motion
/**
* @brief Movable device arc motion
* @param [in] radio Arc motion radius (mm)
* @param [in] angle Arc motion angle (°)
* @param [in] vel Linear motion speed percentage (0-100)
* @return Error code
*/
int TractorMoveC(double radio, double angle, double vel);
13.63. Movable Device Stop Motion
/**
* @brief Movable device stop motion
* @return Error code
*/
int TractorStop();
13.64. Movable Device Code Example
public static void main(String[] args)
{
Robot robot = new Robot();
robot.SetReconnectParam(true,20,500);//Set reconnection count and interval
robot.LoggerInit(FrLogType.DIRECT, FrLogLevel.INFO, "D://log", 10, 10);
int rtn = robot.RPC("192.168.58.2");
if(rtn == 0)
{
System.out.println("RPC connection success");
}
else
{
System.out.println("RPC connection fail");
return ;
}
UDPComParam param = new UDPComParam("192.168.58.88", 2021, 2, 100, 3, 100, 1, 100, 10);
robot.ExtDevSetUDPComParam(param);//UDP extended axis communication
robot.ExtAxisParamConfig(1, 0, 0, 50000, -50000, 1000, 1000, 6.280, 16384, 200, 0, 0, 0);
robot.ExtAxisParamConfig(2, 0, 0, 50000, -50000, 1000, 1000, 6.280, 16384, 200, 0, 0, 0);
robot.SetAxisDHParaConfig(5, 0, 0, 0, 0, 0, 0, 0, 0);
robot.TractorEnable(false);
robot.Sleep(2000);
robot.TractorEnable(true);
robot.Sleep(2000);
robot.TractorHoming();
robot.Sleep(2000);
robot.TractorMoveL(100, 20);
robot.Sleep(5000);
robot.TractorMoveL(-100, 20);
robot.Sleep(5000);
robot.TractorMoveC(300, 90, 20);
robot.Sleep(2000);
robot.TractorStop();//Stop the device
robot.TractorMoveC(300, -90, 20);
}
bottom of page