top of page
private void btnSyncMoveL_Click(object sender, EventArgs e)
{
Robot robot = new Robot();
robot.RPC("192.168.58.2");
//1. Calibrate and apply the robot tool coordinate system. You can use the four-point method or six-point method to calibrate and apply the tool coordinate system. The interfaces involved in calibrating the tool coordinate system are as follows:
// int SetToolPoint(int point_num); //Set the 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 application tool coordinate system
// int SetToolList(int id, DescPose coord, int type, int install); // Set application tool coordinate system list
//2. Set UDP communication parameters and load UDP communication
robot.ExtDevSetUDPComParam("192.168.58.88", 2021, 2, 100, 3, 100, 1, 100, 10);
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 drive parameters. In this example, a single-axis positioner is used, so only one drive parameter needs to be set. If you select an extended axis type with multiple axes, each axis must have its drive parameters set.
//4.Enable the selected axis and set it to home position.
robot.ExtAxisServoOn(1, 0);
robot.ExtAxisSetHoming(1, 0, 20, 3);
//5. Perform extended axis coordinate system calibration and apply
DescPose pos = new DescPose(/* Enter your calibration point coordinates */);
robot.SetRefPointInExAxisEnd(pos);
robot.PositionorSetRefPoint(1); /* You need to calibrate the extended axis using four different points, so you must call this interface four times to complete the calibration */
DescPose coord = new DescPose();
robot.PositionorComputeECoordSys(ref coord); // Calculate the extended axis calibration results
robot.ExtAxisActiveECoordSys(1, 1, coord, 1); //Apply the calibration results to the extended axis coordinate system
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 the endpoint coordinates of your synchronized linear motion
DescPose enddescPose = new DescPose(/*Enter your coordinates*/);
JointPos endjointPos = new JointPos(/*Enter your coordinates*/);
ExaxisPos endexaxisPos = new ExaxisPos(/* Enter your extended axis endpoint coordinates */);
//9. Write the synchronized motion program
//Move to the starting point, assuming that the 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 synchronized movement
robot.ExtAxisSyncMoveL(endjointPos, enddescPose, 1, 1, 100, 100, 100, 0, endexaxisPos, 0, offdese);
}
13.45. UDP extended axis and robot arc motion synchronization
New in version C#SDK-v1.0.7.
/**
* @brief UDP extended axis and robot arc motion synchronization
* @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 currently available
* @param [in] epos_p Intermediate point extension axis position, unit mm
* @param [in] poffset_flag 0-no offset, 1-offset relative to base coordinate system/workpiece coordinate system, 2-offset relative to tool coordinate system
* @param [in] offset_pos_p Position offset
* @param [in] joint_pos_t Target point joint position, unit deg
* @param [in] desc_pos_t Target point Cartesian position
* @param [in] ttool Tool coordinate number, range [0~14]
* @param [in] tuser Workpiece coordinate index, range [0~14]
* @param [in] tvel Velocity percentage, range [0~100]
* @param [in] tacc Acceleration percentage, range [0~100], not currently available
* @param [in] epos_t Extended axis position, unit mm
* @param [in] toffset_flag 0-no offset, 1-offset relative to base coordinate system/workpiece coordinate system, 2-offset relative to tool coordinate system
* @param [in] offset_pos_t Pose offset
* @param [in] ovl Speed scaling factor, range [0~100]
* @param [in] blendR [-1.0]-Move to position (blocked), [0~1000.0]-Smooth radius (unblocked), unit mm
* @return Error code
*/
int ExtAxisSyncMoveC(JointPos joint_pos_p, DescPose desc_pos_p, int ptool, int puser, float pvel, float pacc, ExaxisPos epos_p, int poffset_flag, DescPose offset_pos_p, JointPos joint_pos_t, DescPose desc_pos_t, int ttool, int tuser, float tvel, float tacc, ExaxisPos epos_t, int toffset_flag, DescPose offset_pos_t, float ovl, float blendR);
13.46. Code example
private void btnSyncMoveC_Click(object sender, EventArgs e)
{
Robot robot = new Robot();
robot.RPC("192.168.58.2");
//1. Calibrate and apply the robot tool coordinate system. You can use the four-point method or six-point method to calibrate and apply the tool coordinate system. The interfaces involved in calibrating the tool coordinate system are as follows:
// int SetToolPoint(int point_num); //Set tool reference point - six-point method
// int ComputeTool(ref DescPose tcp_pose); //Compute 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 application tool coordinate system
// int SetToolList(int id, DescPose coord, int type, int install); // Set application tool coordinate system list
//2. Set UDP communication parameters and load UDP communication
robot.ExtDevSetUDPComParam("192.168.58.88", 2021, 2, 100, 3, 100, 1, 100, 10);
robot.ExtDevLoadUDPDriver();
//3. Set the 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 drive parameters. In this example, it is a single-axis positioner, so only one drive parameter needs to be set. If you select an extended axis type with multiple axes, each axis must have its drive parameters set
//4. Enable the selected axis and set it to home position
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 calibrate the extended axis using four different points, so you need to call this interface four times to complete the calibration */
DescPose coord = new DescPose();
robot.PositionorComputeECoordSys(ref coord); // Calculate the extended axis calibration results
robot.ExtAxisActiveECoordSys(1, 1, coord, 1); // Apply the calibration results 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 the starting point of your synchronized arc motion
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 the endpoint coordinates of your synchronized circular arc motion
DescPose endDescPose = new DescPose(/*Enter your coordinates*/);
JointPos endJointPos = new JointPos(/*Enter your coordinates*/);
ExaxisPos endexaxisPos = new ExaxisPos(/* Enter your extended axis endpoint coordinates */);
//8. Record your synchronized arc motion midpoint 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 midpoint */);
//9. Write the synchronized motion program
//Move to the starting point, assuming the 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 synchronized motion
robot.ExtAxisSyncMoveC(midjointPos, middescPose, 1, 1, 100, 100, midexaxisPos, 0, offdese, endjointPos, enddescPose, 1, 1, 100, 100, endexaxisPos, 0, offdese, 100, 0);
}
13.47. Set extended DO
New in version C#SDK-v1.0.7.
/**
* @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, bool bOpen, bool smooth, bool block);
13.48. Set extended AO
New in version C#SDK-v1.0.7.
/**
* @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, bool block);
13.49. Set extended DI input filter time
New in version C#SDK-v1.0.7.
/**
* @brief Set extended DI input filter time
* @param [in] filterTime Filter time (ms)
* @return Error code
*/
int SetAuxDIFilterTime(int filterTime);
13.50. Set extended AI input filter time
New in version C#SDK-v1.0.7.
/**
* @brief Set extended AI input filter time
* @param [in] filterTime Filter time (ms)
* @return Error code
*/
int SetAuxAIFilterTime(int filterTime);
13.51. Wait for extended DI input
New in version C#SDK-v1.0.7.
/**
* @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 movement
* @return Error code
*/
int WaitAuxDI(int DINum, bool bOpen, int time, bool errorAlarm);
13.52. Wait for extended AI input
New in version C#SDK-v1.0.7.
/**
* @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 Continue movement
* @return Error code
*/
int WaitAuxAI(int AINum, int sign, int value, int time, bool errorAlarm);
13.53. Get extended DI value
New in version C#SDK-v1.0.7.
/**
* @brief Get extended DI value
* @param [in] DINum DI number
* @param [in] isNoBlock Whether to block
* @param [out] isOpen 0-off; 1-on
* @return Error code
*/
int GetAuxDI(int DINum, bool isNoBlock, bool& isOpen);
13.54. Get extended AI value
New in version C#SDK-v1.0.7.
/**
* @brief Get extended AI value
* @param [in] AINum AI number
* @param [in] isNoBlock Whether to block
* @param [in] value Input value
* @return Error code
*/
int GetAuxAI(int AINum, bool isNoBlock, int& value);
13.55. Extended IO code example
private void btnAODO_Click(object sender, EventArgs e)
{
int rtn;
for (int i = 0; i < 128; i++)
{
robot.SetAuxDO(i, true, false, true);
Thread.Sleep(100);
}
for (int i = 0; i < 128; i++)
{
robot.SetAuxDO(i, false, false, true);
Thread.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);
Thread.Sleep(10);
}
robot.SetAuxDIFilterTime(10);
robot.SetAuxAIFilterTime(0, 10);
for (int i = 0; i < 20; i++)
{
bool curValue = false;
rtn = robot.GetAuxDI(i, false, ref curValue);
Console.WriteLine("DI" + i + " " + curValue);
}
int curValueAI = -1;
for (int i = 0; i < 4; i++)
{
rtn = robot.GetAuxAI(i, true, ref curValueAI);
}
robot.WaitAuxDI(1, false, 1000, false);
robot.WaitAuxAI(1, 1, 132, 1000, false);
}
13.56. Enable movable device
New in version C#SDK-v1.0.9.
/**
* @brief Enable movable device
* @param enable false-disable; true-enable
* @return Error code
*/
int TractorEnable(bool enable);
13.57. Stop movable device movement
New in version C#SDK-v1.0.9.
/**
* @brief Stop the movement of the movable device
* @return Error code
*/
int TractorStop();
13.58. Reset the movable device
New in version C#SDK-v1.0.9.
/**
* @brief Movable device returns to zero
* @return Error code
*/
int TractorHoming();
13.59. Movable device moves in a straight line
New in version C#SDK-v1.0.9.
/**
* @brief Movable device moves in a straight line
* @param distance Linear movement distance (mm)
* @param vel Linear movement speed percentage (0-100)
* @return Error code
*/
int TractorMoveL(double distance, double vel);
13.60. Circular motion of a movable device
New in version C#SDK-v1.0.9.
/**
* @brief Circular motion of a movable device
* @param radio Circular motion radius (mm)
* @param angle Arc movement angle (°)
* @param vel Linear movement speed percentage (0-100)
* @return Error code
*/
int TractorMoveC(double radio, double angle, double vel);
13.61. Code example
private void button6_Click(object sender, EventArgs e)
{
int rtn;
robot.ExtDevSetUDPComParam("192.168.58.2", 2021, 2, 50, 5, 50, 1, 50, 10,1);
robot.ExtDevLoadUDPDriver();
rtn = robot.ExtAxisServoOn(1, 1);
rtn = robot.ExtAxisServoOn(2, 1);
Thread.Sleep(2000);
robot.ExtAxisSetHoming(1, 0, 10, 2);
Thread.Sleep(2000);
rtn = robot.ExtAxisSetHoming(2, 0, 10, 2);
Thread.Sleep(4000);
robot.ExtAxisParamConfig(1, 0, 0, 50000, -50000, 1000, 1000, 6.280f, 16384, 200, 0, 0, 0);
robot.ExtAxisParamConfig(2, 0, 0, 50000, -50000, 1000, 1000, 6.280f, 16384, 200, 0, 0, 0);
robot.SetAxisDHParaConfig(5, 0, 0, 0, 0, 0, 0, 0, 0);
robot.TractorEnable(false);
Thread.Sleep(2000);
robot.TractorEnable(true);
Thread.Sleep(2000);
robot.TractorHoming();
Thread.Sleep(2000);
robot.TractorMoveL(100, 2);
Thread.Sleep(5000);
robot.TractorStop();
robot.TractorMoveL(-100, 20);
Thread.Sleep(5000);
robot.TractorMoveC(300, 90, 20);
Thread.Sleep(10000);
robot.TractorMoveC(300, -90, 20);
Thread.Sleep(1000);
robot.TractorStop();
}
13.62. Set the synchronous motion strategy of the extension axis and the robot
New in version C#SDK-V1.1.7: Web-3.8.5
/**
* @brief Set the synchronous movement strategy of the extended axis with the robot
* @param strategy Strategy; 0 - Robot as the main; 1 - Extended axis synchronous with the robot
* @return Error code */
int SetExAxisRobotPlan(int strategy)
13.63. Code example for setting up the extended axis to move synchronously with the robot
New in version C#SDK-V1.1.7: Web-3.8.5
private void button94_Click(object sender, EventArgs e)
{
JointPos joint_pos1 = new JointPos(-22.016, -49.217, 124.714, -161.100, -85.108, -0.333);
JointPos joint_pos2 = new JointPos(-21.083, -46.613, 110.079, -147.796, -80.757, -0.330);
JointPos joint_pos3 = new JointPos(-25.572, -60.090, 135.397, -163.889, -82.489, -0.345);
DescPose desc_pos1 = new DescPose(2.637, -0.001, 30.673, 178.786, -4.134, 68.326);
DescPose desc_pos2 = new DescPose(213.812, -1.440, 47.311, 177.410, 0.166, 68.946);
DescPose desc_pos3 = new DescPose(444.342, -12.723, 82.470, -177.701, -1.325, 65.151);
ExaxisPos epos1 =