13. Extended Axis

13.1. Set 485 Extended Axis Parameters

New in version C++SDK-v2.1.3.0.

 1/**
 2* @brief Set 485 extended axis parameters
 3* @param [in] servoId Servo driver ID, range [1-15], corresponding to slave ID
 4* @param [in] servoCompany Servo driver manufacturer, 1-Dynatek
 5* @param [in] servoModel Servo driver model, 1-FD100-750C
 6* @param [in] servoSoftVersion Servo driver software version, 1-V1.0
 7* @param [in] servoResolution Encoder resolution
 8* @param [in] axisMechTransRatio Mechanical transmission ratio
 9* @return Error code
10*/
11errno_t AuxServoSetParam(int servoId, int servoCompany, int servoModel, int servoSoftVersion, int servoResolution, double axisMechTransRatio);

13.2. Get 485 Extended Axis Configuration Parameters

New in version C++SDK-v2.1.3.0.

 1/**
 2* @brief Get 485 extended axis configuration parameters
 3* @param [in] servoId Servo driver ID, range [1-15], corresponding to slave ID
 4* @param [out] servoCompany Servo driver manufacturer, 1-Dynatek
 5* @param [out] servoModel Servo driver model, 1-FD100-750C
 6* @param [out] servoSoftVersion Servo driver software version, 1-V1.0
 7* @param [out] servoResolution Encoder resolution
 8* @param [out] axisMechTransRatio Mechanical transmission ratio
 9* @return Error code
10*/
11errno_t AuxServoGetParam(int servoId, int* servoCompany, int* servoModel, int* servoSoftVersion, int* servoResolution, double* axisMechTransRatio);

13.3. Set 485 Extended Axis Enable/Disable

New in version C++SDK-v2.1.3.0.

1/**
2* @brief Set 485 extended axis enable/disable
3* @param [in] servoId Servo driver ID, range [1-15], corresponding to slave ID
4* @param [in] status Enable status, 0-disable, 1-enable
5* @return Error code
6*/
7errno_t AuxServoEnable(int servoId, int status);

13.4. Set 485 Extended Axis Control Mode

New in version C++SDK-v2.1.3.0.

1/**
2* @brief Set 485 extended axis control mode
3* @param [in] servoId Servo driver ID, range [1-15], corresponding to slave ID
4* @param [in] mode Control mode, 0-position mode, 1-velocity mode
5* @return Error code
6*/
7errno_t AuxServoSetControlMode(int servoId, int mode);

13.5. Set 485 Extended Axis Target Position (Position Mode)

New in version C++SDK-v2.1.3.0.

1/**
2* @brief Set 485 extended axis target position (position mode)
3* @param [in] servoId Servo driver ID, range [1-15], corresponding to slave ID
4* @param [in] pos Target position, mm or °
5* @param [in] speed Target speed, mm/s or °/s
6* @return Error code
7*/
8errno_t AuxServoSetTargetPos(int servoId, double pos, double speed);

13.6. Set 485 Extended Axis Target Torque (Torque Mode) - Temporarily Unavailable

New in version C++SDK-v2.1.3.0.

1/**
2* @brief Set 485 extended axis target torque (torque mode)
3* @param [in] servoId Servo driver ID, range [1-15], corresponding to slave ID
4* @param [in] torque Target torque, Nm
5* @return Error code
6*/
7errno_t AuxServoSetTargetTorque(int servoId, double torque);

13.7. Set 485 Extended Axis Homing

New in version C++SDK-v2.1.3.0.

1/**
2* @brief Set 485 extended axis homing
3* @param [in] servoId Servo driver ID, range [1-15], corresponding to slave ID
4* @param [in] mode Homing mode, 0-current position homing; 1-limit homing
5* @param [in] searchVel Homing speed, mm/s or °/s
6* @param [in] latchVel Latch speed, mm/s or °/s
7* @return Error code
8*/
9errno_t AuxServoHoming(int servoId, int mode, double searchVel, double latchVel);

13.8. Clear 485 Extended Axis Error Information

New in version C++SDK-v2.1.3.0.

1/**
2* @brief Clear 485 extended axis error information
3* @param [in] servoId Servo driver ID, range [1-15], corresponding to slave ID
4* @return Error code
5*/
6errno_t AuxServoClearError(int servoId);

13.9. Get 485 Extended Axis Servo Status

New in version C++SDK-v2.1.3.0.

 1/**
 2* @brief Get 485 extended axis servo status
 3* @param [in] servoId Servo driver ID, range [1-15], corresponding to slave ID
 4* @param [out] servoErrCode Servo driver error code
 5* @param [out] servoState Servo driver state [Decimal converted to binary, bit0-bit5: Servo enable-Servo running-Positive limit triggered-Negative limit triggered-Positioning complete-Homing complete]
 6* @param [out] servoPos Current servo position, mm or °
 7* @param [out] servoSpeed Current servo speed, mm/s or °/s
 8* @param [out] servoTorque Current servo torque, Nm
 9* @return Error code
10*/
11errno_t AuxServoGetStatus(int servoId, int* servoErrCode, int* servoState, double* servoPos, double* servoSpeed, double* servoTorque);

13.10. Set 485 Extended Axis Target Speed (Velocity Mode)

New in version C++SDK-v2.1.3.0.

1/**
2* @brief Set 485 extended axis target speed (velocity mode)
3* @param [in] servoId Servo driver ID, range [1-15], corresponding to slave ID
4* @param [in] speed Target speed, mm/s or °/s
5* @return Error code
6*/
7errno_t AuxServoSetTargetSpeed(int servoId, double speed);

13.11. Set Status Feedback 485 Extended Axis Data Axis Number

New in version C++SDK-v2.1.3.0.

1/**
2* @brief Set status feedback 485 extended axis data axis number
3* @param [in] servoId Servo driver ID, range [1-15], corresponding to slave ID
4* @return Error code
5*/
6errno_t AuxServosetStatusID(int servoId);

13.12. Set 485 Extended Axis Motion Acceleration/Deceleration

New in version C++SDK-v2.1.5.0.

1/**
2* @brief Set 485 extended axis motion acceleration/deceleration
3* @param [in] acc 485 extended axis motion acceleration
4* @param [in] dec 485 extended axis motion deceleration
5* @return Error code
6*/
7errno_t AuxServoSetAcc(double acc, double dec);

13.13. Set 485 Extended Axis Emergency Stop Acceleration/Deceleration

New in version C++SDK-v2.1.5.0.

1/**
2* @brief Set 485 extended axis emergency stop acceleration/deceleration
3* @param [in] acc 485 extended axis emergency stop acceleration
4* @param [in] dec 485 extended axis emergency stop deceleration
5* @return Error code
6*/
7errno_t AuxServoSetEmergencyStopAcc(double acc, double dec);

13.14. Get 485 Extended Axis Motion Acceleration/Deceleration

New in version C++SDK-v2.1.5.0.

1/**
2* @brief Get 485 extended axis motion acceleration/deceleration
3* @param [out] acc 485 extended axis motion acceleration
4* @param [out] dec 485 extended axis motion deceleration
5* @return Error code
6*/
7errno_t AuxServoGetAcc(double& acc, double& dec);

13.15. Get 485 Extended Axis Emergency Stop Acceleration/Deceleration

New in version C++SDK-v2.1.5.0.

1/**
2* @brief Get 485 extended axis emergency stop acceleration/deceleration
3* @param [out] acc 485 extended axis emergency stop acceleration
4* @param [out] dec 485 extended axis emergency stop deceleration
5* @return Error code
6*/
7errno_t AuxServoGetEmergencyStopAcc(double& acc, double& dec);

13.16. Extended Axis Control Code Example

New in version C++SDK-v2.1.5.0.

 1int Test485Auxservo(void)
 2{
 3  ROBOT_STATE_PKG pkg = {};
 4  FRRobot robot;
 5  robot.LoggerInit();
 6  robot.SetLoggerLevel(1);
 7  int rtn = robot.RPC("192.168.58.2");
 8  if (rtn != 0)
 9  {
10    return -1;
11  }
12  robot.SetReConnectParam(true, 30000, 500);
13  int retval = robot.AuxServoSetParam(1, 1, 1, 1, 131072, 15.45);
14  std::cout << "AuxServoSetParam is: " << retval << std::endl;
15  int servoCompany;
16  int servoModel;
17  int servoSoftVersion;
18  int servoResolution;
19  double axisMechTransRatio;
20  retval = robot.AuxServoGetParam(1, &servoCompany, &servoModel, &servoSoftVersion, &servoResolution, &axisMechTransRatio);
21  std::cout << "servoCompany " << servoCompany << "\n"
22    << "servoModel " << servoModel << "\n"
23    << "servoSoftVersion " << servoSoftVersion << "\n"
24    << "servoResolution " << servoResolution << "\n"
25    << "axisMechTransRatio " << axisMechTransRatio << "\n"
26    << std::endl;
27  retval = robot.AuxServoSetParam(1, 10, 11, 12, 13, 14);
28  std::cout << "AuxServoSetParam is: " << retval << std::endl;
29  retval = robot.AuxServoGetParam(1, &servoCompany, &servoModel, &servoSoftVersion, &servoResolution, &axisMechTransRatio);
30  std::cout << "servoCompany " << servoCompany << "\n"
31    << "servoModel " << servoModel << "\n"
32    << "servoSoftVersion " << servoSoftVersion << "\n"
33    << "servoResolution " << servoResolution << "\n"
34    << "axisMechTransRatio " << axisMechTransRatio << "\n"
35    << std::endl;
36  retval = robot.AuxServoSetParam(1, 1, 1, 1, 131072, 36);
37  std::cout << "AuxServoSetParam is: " << retval << std::endl;
38  robot.Sleep(3000);
39  robot.AuxServoSetAcc(3000, 3000);
40  robot.AuxServoSetEmergencyStopAcc(5000, 5000);
41  robot.Sleep(1000);
42  double emagacc = 0, acc = 0;
43  double emagdec = 0, dec = 0;
44  robot.AuxServoGetEmergencyStopAcc(emagacc, emagdec);
45  printf("emergency acc is %f dec is %f \n", emagacc, emagdec);
46  robot.AuxServoGetAcc(acc, dec);
47  printf("acc is %f dec is %f \n", acc, dec);
48  robot.AuxServoSetControlMode(1, 0);
49  robot.Sleep(2000);
50  retval = robot.AuxServoEnable(1, 0);
51  std::cout << "AuxServoEnable disenable " << retval << std::endl;
52  robot.Sleep(1000);
53  int servoerrcode = 0;
54  int servoErrCode;
55  int servoState;
56  double servoPos;
57  double servoSpeed;
58  double servoTorque;
59  retval = robot.AuxServoGetStatus(1, &servoErrCode, &servoState, &servoPos, &servoSpeed, &servoTorque);
60  std::cout << "AuxServoGetStatus servoState " << servoState << std::endl;
61  robot.Sleep(1000);;
62  retval = robot.AuxServoEnable(1, 1);
63  std::cout << "AuxServoEnable enable " << retval << std::endl;
64  robot.Sleep(1000);
65  retval = robot.AuxServoGetStatus(1, &servoErrCode, &servoState, &servoPos, &servoSpeed, &servoTorque);
66  std::cout << "AuxServoGetStatus servoState " << servoState << std::endl;
67  robot.Sleep(1000);
68  retval = robot.AuxServoHoming(1, 1, 5, 1);
69  std::cout << "AuxServoHoming " << retval << std::endl;
70  robot.Sleep(3000);
71  retval = robot.AuxServoSetTargetPos(1, 200, 30);
72  std::cout << "AuxServoSetTargetPos " << retval << std::endl;
73  robot.Sleep(1000);
74  retval = robot.AuxServoGetStatus(1, &servoErrCode, &servoState, &servoPos, &servoSpeed, &servoTorque);
75  std::cout << "AuxServoGetStatus servoSpeed " << servoSpeed << std::endl;
76  robot.Sleep(8000);
77  robot.AuxServoSetControlMode(1, 1);
78  robot.Sleep(2000);
79  robot.AuxServoEnable(1, 0);
80  robot.Sleep(1000);
81  robot.AuxServoEnable(1, 1);
82  robot.Sleep(1000);
83  robot.AuxServoSetTargetSpeed(1, 100, 80);
84  robot.Sleep(5000);
85  robot.AuxServoSetTargetSpeed(1, 0, 80);
86  robot.CloseRPC();
87  return 0;
88}

13.17. UDP Extended Axis Communication Parameter Configuration

 1/**
 2* @brief UDP extended axis communication parameter configuration
 3* @param [in] ip PLC IP address
 4* @param [in] port  Port number
 5* @param [in] period    Communication cycle (ms, default is 2, do not modify this parameter)
 6* @param [in] lossPkgTime   Packet loss detection time (ms)
 7* @param [in] lossPkgNum    Packet loss count
 8* @param [in] disconnectTime    Communication disconnection confirmation duration
 9* @param [in] reconnectEnable   Communication disconnection auto-reconnect enable, 0-disable, 1-enable
10* @param [in] reconnectPeriod   Reconnect cycle interval (ms)
11* @param [in] reconnectNum  Reconnect count
12* @param [in] selfConnect Auto-establish connection after power restart; 0-do not establish; 1-establish
13* @return Error code
14*/
15errno_t ExtDevSetUDPComParam(std::string ip, int port, int period, int lossPkgTime, int lossPkgNum, int disconnectTime, int reconnectEnable, int reconnectPeriod, int reconnectNum, int selfConnect = 1);

13.18. Get UDP Extension Axis Communication Parameter Configuration

New in version C++SDK-v2.1.4.0.

 1/**
 2* @brief Get UDP extension axis communication parameters
 3* @param [out] ip PLC IP address
 4* @param [out] port Port number
 5* @param [out] period Communication period (ms, default is 2, do not modify this parameter)
 6* @param [out] lossPkgTime Packet loss detection time (ms)
 7* @param [out] lossPkgNum Number of packet losses
 8* @param [out] disconnectTime Communication disconnection confirmation duration
 9* @param [out] reconnectEnable Automatic reconnection enable after communication disconnection 0-disable 1-enable
10* @param [out] reconnectPeriod Reconnection interval (ms)
11* @param [out] reconnectNum Number of reconnection attempts
12* @param [out] selfStart Whether to automatically reconnect after control box restart; 0-no reconnection; 1-reconnect
13* @return Error code
14*/
15errno_t ExtDevGetUDPComParam(std::string& ip, int& port, int& period, int& lossPkgTime, int& lossPkgNum, int& disconnectTime, int& reconnectEnable, int& reconnectPeriod, int& reconnectNum, int& selfConnect);

13.19. Load UDP Communication

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Load UDP communication
3* @return Error code
4*/
5errno_t ExtDevLoadUDPDriver();

13.20. Unload UDP Communication

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Unload UDP communication
3* @return Error code
4*/
5errno_t ExtDevUnloadUDPDriver();

13.21. UDP Extended Axis Communication Exception Disconnection Recovery

New in version C++SDK-v2.1.4.0.

1/**
2* @brief UDP extended axis communication exception disconnection recovery
3* @return Error code
4*/
5errno_t ExtDevUDPClientComReset();

13.22. UDP Extended Axis Communication Exception Disconnection Close Communication

New in version C++SDK-v2.1.4.0.

1/**
2* @brief UDP extended axis communication exception disconnection close communication
3* @return Error code
4*/
5errno_t ExtDevUDPClientComClose();

13.23. UDP Extended Axis Parameter Configuration

New in version C++SDK-v2.1.4.0.

 1/**
 2* @brief UDP extended axis parameter configuration
 3* @param [in] axisID Axis number
 4* @param [in] axisType Extended axis type, 0-translation; 1-rotation
 5* @param [in] axisDirection Extended axis direction, 0-forward; 1-reverse
 6* @param [in] axisMax Extended axis maximum position, mm
 7* @param [in] axisMin Extended axis minimum position, mm
 8* @param [in] axisVel Speed, mm/s
 9* @param [in] axisAcc Acceleration, mm/s²
10* @param [in] axisLead Lead, mm
11* @param [in] encResolution Encoder resolution
12* @param [in] axisOffect Weld starting point extended axis offset
13* @param [in] axisCompany Driver manufacturer, 1-Hiwin; 2-Inovance; 3-Panasonic
14* @param [in] axisModel Driver model, 1-Hiwin-SV-XD3EA040L-E, 2-Hiwin-SV-X2EA150A-A, 1-Inovance-SV620PT5R4I, 1-Panasonic-MADLN15SG, 2-Panasonic-MSDLN25SG, 3-Panasonic-MCDLN35SG
15* @param [in] axisEncType Encoder type, 0-incremental; 1-absolute
16* @return Error code
17*/
18errno_t ExtAxisParamConfig(int axisID, int axisType, int axisDirection, double axisMax, double axisMin, double axisVel, double axisAcc, double axisLead, long encResolution, double axisOffect, int axisCompany, int axisModel, int axisEncType);

13.24. Set Extended Axis Installation Position

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Set extended axis installation position
3* @param [in] installType 0-Robot installed on external axis, 1-Robot installed outside external axis
4* @return Error code
5*/
6errno_t SetRobotPosToAxis(int installType);

13.25. Set Extended Axis System DH Parameter Configuration

New in version C++SDK-v2.1.4.0.

 1/**
 2* @brief Set extended axis system DH parameter configuration
 3* @param [in] axisConfig External axis configuration, 0-single degree of freedom linear slide, 1-two degree of freedom L-type positioner, 2-three degree of freedom, 3-four degree of freedom, 4-single degree of freedom positioner
 4* @param [in] axisDHd1 External axis DH parameter d1, mm
 5* @param [in] axisDHd2 External axis DH parameter d2, mm
 6* @param [in] axisDHd3 External axis DH parameter d3, mm
 7* @param [in] axisDHd4 External axis DH parameter d4, mm
 8* @param [in] axisDHa1 External axis DH parameter a1, mm
 9* @param [in] axisDHa2 External axis DH parameter a2, mm
10* @param [in] axisDHa3 External axis DH parameter a3, mm
11* @param [in] axisDHa4 External axis DH parameter a4, mm
12* @return Error code
13*/
14errno_t SetAxisDHParaConfig(int axisConfig, double axisDHd1, double axisDHd2, double axisDHd3, double axisDHd4, double axisDHa1, double axisDHa2, double axisDHa3, double axisDHa4);

13.26. UDP Extended Axis Enable

New in version C++SDK-v2.1.4.0.

1/**
2* @brief UDP extended axis enable
3* @param [in] axisID Axis number [1-4]
4* @param [in] status 0-disable; 1-enable
5* @return Error code
6*/
7errno_t ExtAxisServoOn(int axisID, int status);

13.27. UDP Extended Axis Homing

New in version C++SDK-v2.1.4.0.

1/**
2* @brief UDP extended axis homing
3* @param [in] axisID Axis number [1-4]
4* @param [in] mode Homing method, 0-current position homing, 1-negative limit homing, 2-positive limit homing
5* @param [in] searchVel Homing speed (mm/s)
6* @param [in] latchVel Homing latch speed (mm/s)
7* @return Error code
8*/
9errno_t ExtAxisSetHoming(int axisID, int mode, double searchVel, double latchVel);

13.28. UDP Extended Axis Jog Start

New in version C++SDK-v2.1.4.0.

 1/**
 2* @brief UDP extended axis jog start
 3* @param [in] axisID Axis number [1-4]
 4* @param [in] direction Rotation direction, 0-reverse; 1-forward
 5* @param [in] vel Speed (mm/s)
 6* @param [in] acc Acceleration (mm/s²)
 7* @param [in] maxDistance Maximum jog distance
 8* @return Error code
 9*/
10errno_t ExtAxisStartJog(int axisID, int direction, double vel, double acc, double maxDistance);

13.29. UDP Extended Axis Jog Stop

New in version C++SDK-v2.1.4.0.

1/**
2* @brief UDP extended axis jog stop
3* @param [in] axisID Axis number [1-4]
4* @return Error code
5*/
6errno_t ExtAxisStopJog(int axisID);

13.30. UDP Extended Axis Configuration and Jog Code Example

 1int TestUDPAxis(void)
 2{
 3  ROBOT_STATE_PKG pkg = {};
 4  FRRobot robot;
 5  robot.LoggerInit();
 6  robot.SetLoggerLevel(1);
 7  int rtn = robot.RPC("192.168.58.2");
 8  if (rtn != 0)
 9  {
10    return -1;
11  }
12  robot.SetReConnectParam(true, 30000, 500);
13  rtn = robot.ExtDevSetUDPComParam("192.168.58.88", 2021, 2, 100, 3, 200, 1, 100, 5, 1);
14  cout << "ExtDevSetUDPComParam rtn is " << rtn << endl;
15  string ip = ""; int port = 0; int period = 0; int lossPkgTime = 0; int lossPkgNum = 0; int disconnectTime = 0; int reconnectEnable = 0; int reconnectPeriod = 0; int reconnectNum = 0;
16  rtn = robot.ExtDevGetUDPComParam(ip, port, period, lossPkgTime, lossPkgNum, disconnectTime, reconnectEnable, reconnectPeriod, reconnectNum);
17  string patam = "\nip " + ip + "\nport " + to_string(port) + "\nperiod " + to_string(period) + "\nlossPkgTime " + to_string(lossPkgTime) + "\nlossPkgNum " + to_string(lossPkgNum) + "\ndisConntime " + to_string(disconnectTime) + "\nreconnecable " + to_string(reconnectEnable) + "\nreconnperiod " + to_string(reconnectPeriod) + "\nreconnnun " + to_string(reconnectNum);
18  cout << "ExtDevGetUDPComParam rtn is " << rtn << patam << endl;
19  robot.ExtDevLoadUDPDriver();
20  rtn = robot.ExtAxisServoOn(1, 1);
21  cout << "ExtAxisServoOn axis id 1 rtn is " << rtn << endl;
22  rtn = robot.ExtAxisServoOn(2, 1);
23  cout << "ExtAxisServoOn axis id 2 rtn is " << rtn << endl;
24  robot.Sleep(2000);
25  robot.ExtAxisSetHoming(1, 0, 10, 2);
26  robot.Sleep(2000);
27  rtn = robot.ExtAxisSetHoming(2, 0, 10, 2);
28  cout << "ExtAxisSetHoming rtnn is " << rtn << endl;
29  robot.Sleep(4000);
30  rtn = robot.SetRobotPosToAxis(1);
31  cout << "SetRobotPosToAxis rtn is " << rtn << endl;
32  rtn = robot.SetAxisDHParaConfig(10, 20, 0, 0, 0, 0, 0, 0, 0);
33  cout << "SetAxisDHParaConfig rtn is " << rtn << endl;
34  rtn = robot.ExtAxisParamConfig(1, 1, 1, 1000, -1000, 1000, 1000, 1.905, 262144, 200, 1, 0, 0);
35  cout << "ExtAxisParamConfig axis 1 rtn is " << rtn << endl;
36  rtn = robot.ExtAxisParamConfig(2, 1, 1, 1000, -1000, 1000, 1000, 4.444, 262144, 200, 1, 0, 0);
37  cout << "ExtAxisParamConfig axis 1 rtn is " << rtn << endl;
38  robot.Sleep(1000 * 3);
39  robot.ExtAxisStartJog(1, 0, 10, 10, 30);
40  robot.Sleep(1000 * 1);
41  robot.ExtAxisStopJog(1);
42  robot.Sleep(1000 * 3);
43  robot.ExtAxisServoOn(1, 0);
44  robot.Sleep(1000 * 3);
45  robot.ExtAxisStartJog(2, 0, 10, 10, 30);
46  robot.Sleep(1000 * 1);
47  robot.ExtAxisStopJog(2);
48  robot.Sleep(1000 * 3);
49  robot.ExtAxisServoOn(2, 0);
50  robot.ExtDevUnloadUDPDriver();
51  robot.CloseRPC();
52  return 0;
53}

13.31. Set Extended Axis Coordinate System Reference Point - Four-Point Method

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Set extended axis coordinate system reference point - four-point method
3* @param [in] pointNum Point number [1-4]
4* @return Error code
5*/
6errno_t ExtAxisSetRefPoint(int pointNum);

13.32. Calculate Extended Axis Coordinate System - Four-Point Method

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Calculate extended axis coordinate system - four-point method
3* @param [out] coord Coordinate system value
4* @return Error code
5*/
6errno_t ExtAxisComputeECoordSys(DescPose& coord);

13.33. Positioner Coordinate System Reference Point Setting

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Positioner coordinate system reference point setting
3* @param [in] pointNum Point number [1-4]
4* @return Error code
5*/
6errno_t PositionorSetRefPoint(int pointNum);

13.34. Positioner Coordinate System Calculation - Four-Point Method

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Positioner coordinate system calculation - four-point method
3* @param [out] coord Coordinate system value
4* @return Error code
5*/
6errno_t PositionorComputeECoordSys(DescPose& coord);

13.35. Set Calibration Reference Point Pose in Extended Axis End Coordinate System

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Set calibration reference point pose in extended axis end coordinate system
3* @param [in] pos Pose value
4* @return Error code
5*/
6errno_t SetRefPointInExAxisEnd(DescPose pos);

13.36. Apply Extended Axis Coordinate System

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Apply extended axis coordinate system
3* @param [in] applyAxisId Extended axis number, bit0-bit3 corresponds to extended axis number 1-4, e.g., to apply extended axis 1 and 3, use 0b 0000 0101; which is 5
4* @param [in] axisCoordNum Extended axis coordinate system number
5* @param [in] coord Coordinate system value
6* @param [in] calibFlag Calibration flag, 0-no, 1-yes
7* @return Error code
8*/
9errno_t ExtAxisActiveECoordSys(int applyAxisId, int axisCoordNum, DescPose coord, int calibFlag);

13.37. Get Extended Axis Coordinate System

1/**
2* @brief Get extended axis coordinate system
3* @param [out] coord Extended axis coordinate system
4* @return Error code
5*/
6errno_t ExtAxisGetCoord(DescPose& coord);

13.38. Extended Axis Coordinate System Calibration Code Example

  1int TestUDPAxisCalib(void)
  2{
  3   ROBOT_STATE_PKG pkg = {};
  4   FRRobot robot;
  5   robot.LoggerInit();
  6   robot.SetLoggerLevel(1);
  7   int rtn = robot.RPC("192.168.58.2");
  8   if (rtn != 0)
  9   {
 10      return -1;
 11   }
 12   robot.SetReConnectParam(true, 30000, 500);
 13   rtn = robot.ExtDevSetUDPComParam("192.168.58.88", 2021, 2, 100, 3, 200, 1, 100, 5, 1);
 14   cout << "ExtDevSetUDPComParam rtn is " << rtn << endl;
 15   string ip = ""; int port = 0; int period = 0; int lossPkgTime = 0; int lossPkgNum = 0; int disconnectTime = 0; int reconnectEnable = 0; int reconnectPeriod = 0; int reconnectNum = 0;
 16   rtn = robot.ExtDevGetUDPComParam(ip, port, period, lossPkgTime, lossPkgNum, disconnectTime, reconnectEnable, reconnectPeriod, reconnectNum);
 17   string patam = "\nip " + ip + "\nport " + to_string(port) + "\nperiod " + to_string(period) + "\nlossPkgTime " + to_string(lossPkgTime) + "\nlossPkgNum " + to_string(lossPkgNum) + "\ndisConntime " + to_string(disconnectTime) + "\nreconnecable " + to_string(reconnectEnable) + "\nreconnperiod " + to_string(reconnectPeriod) + "\nreconnnun " + to_string(reconnectNum);
 18   cout << "ExtDevGetUDPComParam rtn is " << rtn << patam << endl;
 19   robot.ExtDevLoadUDPDriver();
 20   rtn = robot.ExtAxisServoOn(1, 1);
 21   cout << "ExtAxisServoOn axis id 1 rtn is " << rtn << endl;
 22   rtn = robot.ExtAxisServoOn(2, 1);
 23   cout << "ExtAxisServoOn axis id 2 rtn is " << rtn << endl;
 24   robot.Sleep(2000);
 25   robot.ExtAxisSetHoming(1, 0, 10, 2);
 26   robot.Sleep(2000);
 27   rtn = robot.ExtAxisSetHoming(2, 0, 10, 2);
 28   cout << "ExtAxisSetHoming rtnn is " << rtn << endl;
 29   robot.Sleep(4000);
 30   rtn = robot.SetRobotPosToAxis(1);
 31   cout << "SetRobotPosToAxis rtn is " << rtn << endl;
 32   rtn = robot.SetAxisDHParaConfig(1, 128.5, 206.4, 0, 0, 0, 0, 0, 0);
 33   cout << "SetAxisDHParaConfig rtn is " << rtn << endl;
 34   rtn = robot.ExtAxisParamConfig(1, 1, 1, 1000, -1000, 1000, 1000, 1.905, 262144, 200, 1, 0, 0);
 35   cout << "ExtAxisParamConfig axis 1 rtn is " << rtn << endl;
 36   rtn = robot.ExtAxisParamConfig(2, 1, 1, 1000, -1000, 1000, 1000, 4.444, 262144, 200, 1, 0, 0);
 37   cout << "ExtAxisParamConfig axis 1 rtn is " << rtn << endl;
 38   DescPose toolCoord(0, 0, 210, 0, 0, 0);
 39   robot.SetToolCoord(1, &toolCoord, 0, 0, 1, 0);
 40   JointPos jSafe(115.193, -96.149, 92.489, -87.068, -89.15, -83.488);
 41   JointPos j1(117.559, -92.624, 100.329, -96.909, -94.057, -83.488);
 42   JointPos j2(112.239, -90.096, 99.282, -95.909, -89.824, -83.488);
 43   JointPos j3(110.839, -83.473, 93.166, -89.22, -90.499, -83.487);
 44   JointPos j4(107.935, -83.572, 95.424, -92.873, -87.933, -83.488);
 45   DescPose descSafe = {};
 46   DescPose desc1 = {};
 47   DescPose desc2 = {};
 48   DescPose desc3 = {};
 49   DescPose desc4 = {};
 50   ExaxisPos exaxisPos = { 0, 0, 0, 0 };
 51   DescPose offdese = { 0, 0, 0, 0, 0, 0 };
 52   robot.GetForwardKin(&jSafe, &descSafe);
 53   robot.MoveJ(&jSafe, &descSafe, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
 54   robot.Sleep(2000);
 55   robot.GetForwardKin(&j1, &desc1);
 56   robot.MoveJ(&j1, &desc1, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
 57   robot.Sleep(2000);
 58   DescPose actualTCPPos = {};
 59   robot.GetActualTCPPose(0, &actualTCPPos);
 60   robot.SetRefPointInExAxisEnd(actualTCPPos);
 61   rtn = robot.PositionorSetRefPoint(1);
 62   cout << "PositionorSetRefPoint 1 rtn is " << rtn << endl;
 63   robot.Sleep(2000);
 64   robot.MoveJ(&jSafe, &descSafe, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
 65   robot.ExtAxisStartJog(1, 0, 50, 50, 10);
 66   robot.Sleep(1000);
 67   robot.ExtAxisStartJog(2, 0, 50, 50, 10);
 68   robot.Sleep(1000);
 69   robot.GetForwardKin(&j2, &desc2);
 70   rtn = robot.MoveJ(&j2, &desc2, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
 71   rtn = robot.PositionorSetRefPoint(2);
 72   cout << "PositionorSetRefPoint 2 rtn is " << rtn << endl;
 73   robot.Sleep(2000);
 74   robot.MoveJ(&jSafe, &descSafe, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
 75   robot.ExtAxisStartJog(1, 0, 50, 50, 10);
 76   robot.Sleep(1000);
 77   robot.ExtAxisStartJog(2, 0, 50, 50, 10);
 78   robot.Sleep(1000);
 79   robot.GetForwardKin(&j3, &desc3);
 80   robot.MoveJ(&j3, &desc3, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
 81   rtn = robot.PositionorSetRefPoint(3);
 82   cout << "PositionorSetRefPoint 3 rtn is " << rtn << endl;
 83   robot.Sleep(2000);
 84   robot.MoveJ(&jSafe, &descSafe, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
 85   robot.ExtAxisStartJog(1, 0, 50, 50, 10);
 86   robot.Sleep(1000);
 87   robot.ExtAxisStartJog(2, 0, 50, 50, 10);
 88   robot.Sleep(1000);
 89   robot.GetForwardKin(&j4, &desc4);
 90   robot.MoveJ(&j4, &desc4, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
 91   rtn = robot.PositionorSetRefPoint(4);
 92   cout << "PositionorSetRefPoint 4 rtn is " << rtn << endl;
 93   robot.Sleep(2000);
 94   DescPose axisCoord = {};
 95   robot.PositionorComputeECoordSys(axisCoord);
 96   robot.MoveJ(&jSafe, &descSafe, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
 97   printf("PositionorComputeECoordSys rtn is %f %f %f %f %f %f\n", axisCoord.tran.x, axisCoord.tran.y, axisCoord.tran.z, axisCoord.rpy.rx, axisCoord.rpy.ry, axisCoord.rpy.rz);
 98   rtn = robot.ExtAxisActiveECoordSys(3, 1, axisCoord, 1);
 99   cout << "ExtAxisActiveECoordSys rtn is " << rtn << endl;
100DescPose getCoord(0, 0, 0, 0, 0, 0);
101rtn = robot.ExtAxisGetCoord(getCoord);
102printf("ExtAxisGetCoord rtn is %f %f %f %f %f %f\n", getCoord.tran.x, getCoord.tran.y, getCoord.tran.z, getCoord.rpy.rx, getCoord.rpy.ry, getCoord.rpy.rz);
103robot.CloseRPC();
104return 0;
105}

13.39. UDP Extended Axis Motion

New in version C++SDK-v2.2.4.0.

1/**
2* @brief UDP extended axis motion
3* @param [in] pos Target position
4* @param [in] ovl Speed percentage
5* @param [in] blend Smoothing parameter (mm or ms); -1: Wait for motion completion
6* @return Error code
7*/
8    errno_t ExtAxisMove(ExaxisPos pos, double ovl, double blend = -1);

13.40. UDP Extended Axis Motion Code Example

 1int TestUDPAxisCalib(void)
 2{
 3  ROBOT_STATE_PKG pkg = {};
 4  FRRobot robot;
 5  robot.LoggerInit();
 6  robot.SetLoggerLevel(1);
 7  int rtn = robot.RPC("192.168.58.2");
 8  if (rtn != 0)
 9  {
10    return -1;
11  }
12  ExaxisPos axisPos;
13  axisPos.ePos[0] = 20;
14  axisPos.ePos[1] = 0;
15  axisPos.ePos[2] = 0;
16  axisPos.ePos[3] = 0;
17  robot.ExtAxisMove(axisPos, 50);
18  robot.CloseRPC();
19  return 0;
20}

13.41. UDP Extended Axis and Robot Joint Motion Synchronous Motion

New in version C++SDK-v2.1.4.0.

 1/**
 2* @brief UDP extended axis and robot joint motion synchronous motion
 3* @param [in] joint_pos Target joint position, unit deg
 4* @param [in] desc_pos Target Cartesian pose
 5* @param [in] tool Tool coordinate number, range [0~14]
 6* @param [in] user Workpiece coordinate number, range [0~14]
 7* @param [in] vel Speed percentage, range [0~100]
 8* @param [in] acc Acceleration percentage, range [0~100], temporarily unavailable
 9* @param [in] ovl Speed scaling factor, range [0~100]
10* @param [in] epos Extended axis position, unit mm
11* @param [in] blendT [-1.0]-Motion complete (blocking), [0~500.0]-Smoothing time (non-blocking), unit ms
12* @param [in] offset_flag 0-No offset, 1-Base coordinate/workpiece coordinate offset, 2-Tool coordinate offset
13* @param [in] offset_pos Pose offset
14* @return Error code
15*/
16errno_t ExtAxisSyncMoveJ(JointPos joint_pos, DescPose desc_pos, int tool, int user, float vel, float acc, float ovl, ExaxisPos epos, float blendT, byte offset_flag, DescPose offset_pos);

13.42. UDP Extended Axis and Robot Joint Motion Synchronization (Automatic Forward Kinematics Calculation)

 1/**
 2* @brief UDP Extended Axis and Robot Joint Motion Synchronization (Automatic Forward Kinematics Calculation)
 3* @param [in] joint_pos Target joint position, unit: deg
 4* @param [in] tool Tool coordinate number, range [0~14]
 5* @param [in] user Workpiece coordinate number, range [0~14]
 6* @param [in] vel Velocity percentage, range [0~100]
 7* @param [in] acc Acceleration percentage, range [0~100], temporarily not available
 8* @param [in] ovl Velocity scaling factor, range [0~100]
 9* @param [in] epos Extended axis position, unit: mm
10* @param [in] blendT [-1.0]-Move to position (blocking), [0~500.0]-Smoothing time (non-blocking), unit: ms
11* @param [in] offset_flag 0-No offset, 1-Offset in base coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
12* @param [in] offset_pos Pose offset value
13* @return Error code
14*/
15errno_t ExtAxisSyncMoveJ(JointPos joint_pos, int tool, int user, float vel, float acc, float ovl, ExaxisPos epos, float blendT, uint8_t offset_flag, DescPose offset_pos);

13.43. UDP Extended Axis and Robot Joint Motion Synchronous Motion Code Example

 1int testSyncMoveJ()
 2{
 3  ROBOT_STATE_PKG pkg = {};
 4  FRRobot robot;
 5  robot.LoggerInit();
 6  robot.SetLoggerLevel(1);
 7  int rtn = robot.RPC("192.168.58.2");
 8  if (rtn != 0)
 9  {
10    return -1;
11  }
12  robot.SetReConnectParam(true, 30000, 500);
13  //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 in tool coordinate system calibration are as follows:
14  //  int SetToolPoint(int point_num); //Set tool reference point - six-point method
15  //  int ComputeTool(ref DescPose tcp_pose); //Calculate tool coordinate system
16  //  int SetTcp4RefPoint(int point_num);  //Set tool reference point - four-point method
17  //  int ComputeTcp4(ref DescPose tcp_pose);  //Calculate tool coordinate system - four-point method
18  //  int SetToolCoord(int id, DescPose coord, int type, int install); //Set application tool coordinate system
19  //  int SetToolList(int id, DescPose coord, int type, int install);  //Set application tool coordinate system list
20  //2. Set UDP communication parameters and load UDP communication
21  robot.ExtDevSetUDPComParam("192.168.58.88", 2021, 2, 100, 3, 100, 1, 100, 10);
22  robot.ExtDevLoadUDPDriver();
23  //3. Set extended axis parameters, including extended axis type, extended axis driver parameters, extended axis DH parameters
24  robot.SetAxisDHParaConfig(4, 200, 200, 0, 0, 0, 0, 0, 0); //Single-axis positioner and DH parameters
25  robot.SetRobotPosToAxis(1); //Extended axis installation position
26  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, you need to set driver parameters for each axis.
27  //4. Set the selected axis enable and homing
28  robot.ExtAxisServoOn(1, 0);
29  robot.ExtAxisSetHoming(1, 0, 20, 3);
30  //5. Perform extended axis coordinate system calibration and application
31  DescPose pos = {/* Enter your calibration point coordinates */ };
32  robot.SetRefPointInExAxisEnd(pos);
33  robot.PositionorSetRefPoint(1); /* You need to call this interface 4 times to complete the calibration of the extended axis using four different position points */
34  DescPose coord = {};
35  robot.PositionorComputeECoordSys(coord); //Calculate extended axis calibration result
36  robot.ExtAxisActiveECoordSys(1, 1, coord, 1); //Apply the calibration result to the extended axis coordinate system
37  //6. Calibrate the workpiece coordinate system on the extended axis. You need to use the following interfaces:
38  //int SetWObjCoordPoint(int point_num);
39  //int ComputeWObjCoord(int method, ref DescPose wobj_pose);
40  //int SetWObjCoord(int id, DescPose coord);
41  //int SetWObjList(int id, DescPose coord);
42  //7. Record your synchronous joint motion starting point
43  DescPose startdescPose = {/*Enter your coordinates*/ };
44  JointPos startjointPos = {/*Enter your coordinates*/ };
45  ExaxisPos startexaxisPos = {/* Enter your extended axis starting point coordinates */ };
46  //8. Record your synchronous joint motion end point coordinates
47  DescPose enddescPose = {/*Enter your coordinates*/ };
48  JointPos endjointPos = {/*Enter your coordinates*/ };
49  ExaxisPos endexaxisPos = {/* Enter your extended axis end point coordinates */ };
50  //9. Write synchronous motion program
51  //Move to starting point, assuming the applied tool coordinate system and workpiece coordinate system are both 1
52  robot.ExtAxisMove(startexaxisPos, 20);
53  DescPose offdese = { 0, 0, 0, 0, 0, 0 };
54  robot.MoveJ(&startjointPos, &startdescPose, 1, 1, 100, 100, 100, &startexaxisPos, 0, 0, &offdese);
55  //Start synchronous motion
56  robot.ExtAxisSyncMoveJ(endjointPos, enddescPose, 1, 1, 100, 100, 100, endexaxisPos, -1, 0, offdese);
57  robot.MoveJ(&startjointPos, 1, 1, 100, 100, 100, &startexaxisPos, 0, 0, &offdese);
58  // Start synchronous motion
59  robot.ExtAxisSyncMoveJ(endjointPos, 1, 1, 100, 100, 100, endexaxisPos, -1, 0, offdese);
60  robot.CloseRPC();
61}

13.44. UDP Extended Axis and Robot Linear Motion Synchronous Motion

New in version C++SDK-v2.1.4.0.

 1/**
 2* @brief UDP extended axis and robot linear motion synchronous motion
 3* @param [in] joint_pos Target joint position, unit deg
 4* @param [in] desc_pos Target Cartesian pose
 5* @param [in] tool Tool coordinate number, range [0~14]
 6* @param [in] user Workpiece coordinate number, range [0~14]
 7* @param [in] vel Speed percentage, range [0~100]
 8* @param [in] acc Acceleration percentage, range [0~100], temporarily unavailable
 9* @param [in] ovl Speed scaling factor, range [0~100]
10* @param [in] blendR [-1.0]-Motion complete (blocking), [0~1000.0]-Smoothing radius (non-blocking), unit mm
11* @param [in] epos Extended axis position, unit mm
12* @param [in] offset_flag 0-No offset, 1-Base coordinate/workpiece coordinate offset, 2-Tool coordinate offset
13* @param [in] offset_pos Pose offset
14* @return Error code
15*/
16errno_t ExtAxisSyncMoveL(JointPos joint_pos, DescPose desc_pos, int tool, int user, float vel, float acc, float ovl, float blendR, ExaxisPos epos, int offset_flag, DescPose offset_pos);

13.45. UDP Extended Axis and Robot Linear Motion Synchronization (Automatic Inverse Kinematics Calculation)

 1/**
 2* @brief UDP Extended Axis and Robot Linear Motion Synchronization (Automatic Inverse Kinematics Calculation)
 3* @param [in] desc_pos  Target Cartesian pose
 4* @param [in] tool Tool coordinate number, range [0~14]
 5* @param [in] user Workpiece coordinate number, range [0~14]
 6* @param [in] vel Velocity percentage, range [0~100]
 7* @param [in] acc Acceleration percentage, range [0~100], temporarily not available
 8* @param [in] ovl Velocity scaling factor, range [0~100]
 9* @param [in] blendR [-1.0]-Move to position (blocking), [0~1000.0]-Smoothing radius (non-blocking), unit: mm
10* @param [in] epos Extended axis position, unit: mm
11* @param [in] offset_flag 0-No offset, 1-Offset in base coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
12* @param [in] offset_pos Pose offset value
13* @param [in] config Inverse kinematics joint space configuration, [-1]-Calculate based on current joint position, [0~7]-Solve based on specific joint space configuration
14* @return Error code
15*/
16errno_t ExtAxisSyncMoveL(DescPose desc_pos, int tool, int user, float vel, float acc, float ovl, float blendR, ExaxisPos epos, uint8_t offset_flag, DescPose offset_pos, int config = -1);

13.46. UDP Extended Axis and Robot Linear Motion Synchronous Motion Code Example

 1int testSyncMoveL()
 2{
 3  ROBOT_STATE_PKG pkg = {};
 4  FRRobot robot;
 5  robot.LoggerInit();
 6  robot.SetLoggerLevel(1);
 7  int rtn = robot.RPC("192.168.58.2");
 8  if (rtn != 0)
 9  {
10    return -1;
11  }
12  robot.SetReConnectParam(true, 30000, 500);
13  //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 in tool coordinate system calibration are as follows:
14  //  int SetToolPoint(int point_num); //Set tool reference point - six-point method
15  //  int ComputeTool(ref DescPose tcp_pose); //Calculate tool coordinate system
16  //  int SetTcp4RefPoint(int point_num);  //Set tool reference point - four-point method
17  //  int ComputeTcp4(ref DescPose tcp_pose);  //Calculate tool coordinate system - four-point method
18  //  int SetToolCoord(int id, DescPose coord, int type, int install); //Set application tool coordinate system
19  //  int SetToolList(int id, DescPose coord, int type, int install);  //Set application tool coordinate system list
20  //2. Set UDP communication parameters and load UDP communication
21  robot.ExtDevSetUDPComParam("192.168.58.88", 2021, 2, 100, 3, 100, 1, 100, 10);
22  robot.ExtDevLoadUDPDriver();
23  //3. Set extended axis parameters, including extended axis type, extended axis driver parameters, extended axis DH parameters
24  robot.SetAxisDHParaConfig(4, 200, 200, 0, 0, 0, 0, 0, 0); //Single-axis positioner and DH parameters
25  robot.SetRobotPosToAxis(1); //Extended axis installation position
26  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, you need to set driver parameters for each axis.
27  //4. Set the selected axis enable and homing
28  robot.ExtAxisServoOn(1, 0);
29  robot.ExtAxisSetHoming(1, 0, 20, 3);
30  //5. Perform extended axis coordinate system calibration and application
31  DescPose pos = {/* Enter your calibration point coordinates */ };
32  robot.SetRefPointInExAxisEnd(pos);
33  robot.PositionorSetRefPoint(1); /* You need to call this interface 4 times to complete the calibration of the extended axis using four different position points */
34  DescPose coord = {};
35  robot.PositionorComputeECoordSys(coord); //Calculate extended axis calibration result
36  robot.ExtAxisActiveECoordSys(1, 1, coord, 1); //Apply the calibration result to the extended axis coordinate system
37  //6. Calibrate the workpiece coordinate system on the extended axis. You need to use the following interfaces:
38  //int SetWObjCoordPoint(int point_num);
39  //int ComputeWObjCoord(int method, ref DescPose wobj_pose);
40  //int SetWObjCoord(int id, DescPose coord);
41  //int SetWObjList(int id, DescPose coord);
42  //7. Record your synchronous linear motion starting point
43  DescPose startdescPose = {/*Enter your coordinates*/ };
44  JointPos startjointPos = {/*Enter your coordinates*/ };
45  ExaxisPos startexaxisPos = {/* Enter your extended axis starting point coordinates */ };
46  //8. Record your synchronous linear motion end point coordinates
47  DescPose enddescPose = {/*Enter your coordinates*/ };
48  JointPos endjointPos = {/*Enter your coordinates*/ };
49  ExaxisPos endexaxisPos = {/* Enter your extended axis end point coordinates */ };
50  //9. Write synchronous motion program
51  //Move to starting point, assuming the applied tool coordinate system and workpiece coordinate system are both 1
52  robot.ExtAxisMove(startexaxisPos, 20);
53  DescPose offdese = { 0, 0, 0, 0, 0, 0 };
54  robot.MoveJ(&startjointPos, &startdescPose, 1, 1, 100, 100, 100, &startexaxisPos, 0, 0, &offdese);
55  //Start synchronous motion
56  robot.ExtAxisSyncMoveL(endjointPos, enddescPose, 1, 1, 100, 100, 100, 0, endexaxisPos, 0, offdese);
57  robot.MoveJ(&startjointPos, 1, 1, 100, 100, 100, &startexaxisPos, 0, 0, &offdese);
58  // Start synchronous motion
59  robot.ExtAxisSyncMoveL(enddescPose, 1, 1, 100, 100, 100, 0, endexaxisPos, 0, offdese);
60  robot.CloseRPC();
61}

13.47. UDP Extended Axis and Robot Arc Motion Synchronous Motion

New in version C++SDK-v2.1.4.0.

 1/**
 2* @brief UDP extended axis and robot arc motion synchronous motion
 3* @param [in] joint_pos_p Path point joint position, unit deg
 4* @param [in] desc_pos_p Path point Cartesian pose
 5* @param [in] ptool Tool coordinate number, range [0~14]
 6* @param [in] puser Workpiece coordinate number, range [0~14]
 7* @param [in] pvel Speed percentage, range [0~100]
 8* @param [in] pacc Acceleration percentage, range [0~100], temporarily unavailable
 9* @param [in] epos_p Intermediate point extended axis position, unit mm
10* @param [in] poffset_flag 0-No offset, 1-Base coordinate/workpiece coordinate offset, 2-Tool coordinate offset
11* @param [in] offset_pos_p Pose offset
12* @param [in] joint_pos_t Target point joint position, unit deg
13* @param [in] desc_pos_t Target point Cartesian pose
14* @param [in] ttool Tool coordinate number, range [0~14]
15* @param [in] tuser Workpiece coordinate number, range [0~14]
16* @param [in] tvel Speed percentage, range [0~100]
17* @param [in] tacc Acceleration percentage, range [0~100], temporarily unavailable
18* @param [in] epos_t Extended axis position, unit mm
19* @param [in] toffset_flag 0-No offset, 1-Base coordinate/workpiece coordinate offset, 2-Tool coordinate offset
20* @param [in] offset_pos_t Pose offset
21* @param [in] ovl Speed scaling factor, range [0~100]
22* @param [in] blendR [-1.0]-Motion complete (blocking), [0~1000.0]-Smoothing radius (non-blocking), unit mm
23* @return Error code
24*/
25errno_t 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.48. UDP Extended Axis and Robot Circular Motion Synchronization (Automatic Inverse Kinematics Calculation)

 1/**
 2* @brief UDP Extended Axis and Robot Circular Motion Synchronization (Automatic Inverse Kinematics Calculation)
 3* @param [in] desc_pos_p  Path point Cartesian pose
 4* @param [in] ptool Tool coordinate number, range [0~14]
 5* @param [in] puser Workpiece coordinate number, range [0~14]
 6* @param [in] pvel Velocity percentage, range [0~100]
 7* @param [in] pacc Acceleration percentage, range [0~100], temporarily not available
 8* @param [in] epos_p Extended axis position, unit: mm
 9* @param [in] poffset_flag 0-No offset, 1-Offset in base coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
10* @param [in] offset_pos_p Pose offset value
11* @param [in] desc_pos_t  Target point Cartesian pose
12* @param [in] ttool Tool coordinate number, range [0~14]
13* @param [in] tuser Workpiece coordinate number, range [0~14]
14* @param [in] tvel Velocity percentage, range [0~100]
15* @param [in] tacc Acceleration percentage, range [0~100], temporarily not available
16* @param [in] epos_t Extended axis position, unit: mm
17* @param [in] toffset_flag 0-No offset, 1-Offset in base coordinate system/workpiece coordinate system, 2-Offset in tool coordinate system
18* @param [in] offset_pos_t Pose offset value
19* @param [in] ovl Velocity scaling factor, range [0~100]
20* @param [in] blendR [-1.0]-Move to position (blocking), [0~1000.0]-Smoothing radius (non-blocking), unit: mm
21* @param [in] config Inverse kinematics joint space configuration, [-1]-Calculate based on current joint position, [0~7]-Solve based on specific joint space configuration
22* @return Error code
23*/
24errno_t ExtAxisSyncMoveC(DescPose desc_pos_p, int ptool, int puser, float pvel, float pacc, ExaxisPos epos_p, uint8_t poffset_flag, DescPose offset_pos_p, DescPose desc_pos_t, int ttool, int tuser, float tvel, float tacc, ExaxisPos epos_t, uint8_t toffset_flag, DescPose offset_pos_t, float ovl, float blendR, int config = -1);

13.49. UDP Extended Axis and Robot Arc Motion Synchronous Motion Code Example

 1int testSyncMoveC()
 2{
 3  ROBOT_STATE_PKG pkg = {};
 4  FRRobot robot;
 5  robot.LoggerInit();
 6  robot.SetLoggerLevel(1);
 7  int rtn = robot.RPC("192.168.58.2");
 8  if (rtn != 0)
 9  {
10    return -1;
11  }
12  robot.SetReConnectParam(true, 30000, 500);
13  //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 in tool coordinate system calibration are as follows:
14  //  int SetToolPoint(int point_num); //Set tool reference point - six-point method
15  //  int ComputeTool(ref DescPose tcp_pose); //Calculate tool coordinate system
16  //  int SetTcp4RefPoint(int point_num);  //Set tool reference point - four-point method
17  //  int ComputeTcp4(ref DescPose tcp_pose);  //Calculate tool coordinate system - four-point method
18  //  int SetToolCoord(int id, DescPose coord, int type, int install); //Set application tool coordinate system
19  //  int SetToolList(int id, DescPose coord, int type, int install);  //Set application tool coordinate system list
20  //2. Set UDP communication parameters and load UDP communication
21  robot.ExtDevSetUDPComParam("192.168.58.88", 2021, 2, 100, 3, 100, 1, 100, 10);
22  robot.ExtDevLoadUDPDriver();
23  //3. Set extended axis parameters, including extended axis type, extended axis driver parameters, extended axis DH parameters
24  robot.SetAxisDHParaConfig(4, 200, 200, 0, 0, 0, 0, 0, 0); //Single-axis positioner and DH parameters
25  robot.SetRobotPosToAxis(1); //Extended axis installation position
26  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, you need to set driver parameters for each axis.
27  //4. Set the selected axis enable and homing
28  robot.ExtAxisServoOn(1, 0);
29  robot.ExtAxisSetHoming(1, 0, 20, 3);
30  //5. Perform extended axis coordinate system calibration and application
31  DescPose pos = {/* Enter your calibration point coordinates */ };
32  robot.SetRefPointInExAxisEnd(pos);
33  robot.PositionorSetRefPoint(1); /* You need to call this interface 4 times to complete the calibration of the extended axis using four different position points */
34  DescPose coord = {};
35  robot.PositionorComputeECoordSys(coord); //Calculate extended axis calibration result
36  robot.ExtAxisActiveECoordSys(1, 1, coord, 1); //Apply the calibration result to the extended axis coordinate system
37  //6. Calibrate the workpiece coordinate system on the extended axis. You need to use the following interfaces:
38  //int SetWObjCoordPoint(int point_num);
39  //int ComputeWObjCoord(int method, ref DescPose wobj_pose);
40  //int SetWObjCoord(int id, DescPose coord);
41  //int SetWObjList(int id, DescPose coord);
42  //7. Record your synchronous arc motion starting point
43  DescPose startdescPose = {/*Enter your coordinates*/ };
44  JointPos startjointPos = {/*Enter your coordinates*/ };
45  ExaxisPos startexaxisPos = {/* Enter your extended axis starting point coordinates */ };
46  //8. Record your synchronous arc motion end point coordinates
47  DescPose enddescPose = {/*Enter your coordinates*/ };
48  JointPos endjointPos = {/*Enter your coordinates*/ };
49  ExaxisPos endexaxisPos = {/* Enter your extended axis end point coordinates */ };
50  //9. Record your synchronous arc motion intermediate point coordinates
51  DescPose middescPose = {/*Enter your coordinates*/ };
52  JointPos midjointPos = {/*Enter your coordinates*/ };
53  ExaxisPos midexaxisPos = {/* Enter the extended axis coordinates at the robot arc intermediate point */ };
54  //10. Write synchronous motion program
55  //Move to starting point, assuming the applied tool coordinate system and workpiece coordinate system are both 1
56  robot.ExtAxisMove(startexaxisPos, 20);
57  DescPose offdese = { 0, 0, 0, 0, 0, 0 };
58  robot.MoveJ(&startjointPos, &startdescPose, 1, 1, 100, 100, 100, &startexaxisPos, 0, 0, &offdese);
59  //Start synchronous motion
60  robot.ExtAxisSyncMoveC(midjointPos, middescPose, 1, 1, 100, 100, midexaxisPos, 0, offdese, endjointPos, enddescPose, 1, 1, 100, 100, endexaxisPos, 0, offdese, 100, 0);
61  robot.MoveJ(&startjointPos, 1, 1, 100, 100, 100, &startexaxisPos, 0, 0, &offdese);
62  // Start synchronous motion
63  robot.ExtAxisSyncMoveC(middescPose, 1, 1, 100, 100, midexaxisPos, 0, offdese, enddescPose, 1, 1, 100, 100, endexaxisPos, 0, offdese, 100, 0);
64  robot.CloseRPC();
65}

13.50. Set Extended DO

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Set extended DO
3* @param [in] DONum DO number
4* @param [in] bOpen Switch, true-on; false-off
5* @param [in] smooth Whether to smooth
6* @param [in] block Whether to block
7* @return Error code
8*/
9errno_t SetAuxDO(int DONum, bool bOpen, bool smooth, bool block);

13.51. Set Extended AO

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Set extended AO
3* @param [in] AONum AO number
4* @param [in] value Analog value [0-4095]
5* @param [in] block Whether to block
6* @return Error code
7*/
8errno_t SetAuxAO(int AONum, double value, bool block);

13.52. Set Extended DI Input Filter Time

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Set extended DI input filter time
3* @param [in] filterTime Filter time (ms)
4* @return Error code
5*/
6errno_t SetAuxDIFilterTime(int filterTime);

13.53. Set Extended AI Input Filter Time

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Set extended AI input filter time
3* @param [in] filterTime Filter time (ms)
4* @return Error code
5*/
6errno_t SetAuxAIFilterTime(int filterTime);

13.54. Wait for Extended DI Input

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Wait for extended DI input
3* @param [in] DINum DI number
4* @param [in] bOpen Switch, 0-off; 1-on
5* @param [in] time Maximum wait time (ms)
6* @param [in] errorAlarm Whether to continue motion
7* @return Error code
8*/
9errno_t WaitAuxDI(int DINum, bool bOpen, int time, bool errorAlarm);

13.55. Wait for Extended AI Input

New in version C++SDK-v2.1.4.0.

 1/**
 2* @brief Wait for extended AI input
 3* @param [in] AINum AI number
 4* @param [in] sign 0-Greater than; 1-Less than
 5* @param [in] value AI value
 6* @param [in] time Maximum wait time (ms)
 7* @param [in] errorAlarm Whether to continue motion
 8* @return Error code
 9*/
10errno_t WaitAuxAI(int AINum, int sign, int value, int time, bool errorAlarm);

13.56. Get Extended DI Value

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Get extended DI value
3* @param [in] DINum DI number
4* @param [in] isNoBlock Whether to block
5* @param [out] isOpen 0-off; 1-on
6* @return Error code
7*/
8errno_t GetAuxDI(int DINum, bool isNoBlock, bool& isOpen);

13.57. Get Extended AI Value

New in version C++SDK-v2.1.4.0.

1/**
2* @brief Get extended AI value
3* @param [in] AINum AI number
4* @param [in] isNoBlock Whether to block
5* @param [in] value Input value
6* @return Error code
7*/
8errno_t GetAuxAI(int AINum, bool isNoBlock, int& value);

13.58. Extended IO Code Example

 1int TestAuxDOAO(void)
 2{
 3  ROBOT_STATE_PKG pkg = {};
 4  FRRobot robot;
 5  robot.LoggerInit();
 6  robot.SetLoggerLevel(1);
 7  int rtn = robot.RPC("192.168.58.2");
 8  if (rtn != 0)
 9  {
10    return -1;
11  }
12  robot.SetReConnectParam(true, 30000, 500);
13  for (int i = 0; i < 128; i++)
14  {
15    robot.SetAuxDO(i, true, false, true);
16    Sleep(100);
17  }
18  for (int i = 0; i < 128; i++)
19  {
20    robot.SetAuxDO(i, false, false, true);
21    Sleep(100);
22  }
23  for (int i = 0; i < 409; i++)
24  {
25    robot.SetAuxAO(0, i * 10, true);
26    robot.SetAuxAO(1, 4095 - i * 10, true);
27    robot.SetAuxAO(2, i * 10, true);
28    robot.SetAuxAO(3, 4095 - i * 10, true);
29    Sleep(10);
30  }
31  robot.SetAuxDIFilterTime(10);
32  robot.SetAuxAIFilterTime(0, 10);
33  for (int i = 0; i < 20; i++)
34  {
35    bool curValue = false;
36    int rtn = robot.GetAuxDI(i, false, curValue);
37    cout << "DI" << i << "  " << curValue << endl;
38  }
39  int curValue = -1;
40  for (int i = 0; i < 4; i++)
41  {
42    rtn = robot.GetAuxAI(i, true, curValue);
43  }
44  robot.WaitAuxDI(1, false, 1000, false);
45  robot.WaitAuxAI(1, 1, 132, 1000, false);
46  robot.CloseRPC();
47  return 0;
48}

13.59. Mobile Device Enable

New in version C++SDK-v2.1.5.0.

1/**
2* @brief Mobile device enable
3* @param enable false-disable; true-enable
4* @return Error code
5*/
6errno_t TractorEnable(bool enable);

13.60. Mobile Device Homing

New in version C++SDK-v2.1.5.0.

1/**
2* @brief Mobile device homing
3* @return Error code
4*/
5errno_t TractorHoming();

13.61. Mobile Device Linear Motion

New in version C++SDK-v2.1.5.0.

1/**
2* @brief Mobile device linear motion
3* @param distance Linear motion distance (mm)
4* @param vel Linear motion speed percentage (0-100)
5* @return Error code
6*/
7errno_t TractorMoveL(double distance, double vel);

13.62. Mobile Device Arc Motion

New in version C++SDK-v2.1.5.0.

1/**
2* @brief Mobile device arc motion
3* @param radio Arc motion radius (mm)
4* @param angle Arc motion angle (°)
5* @param vel Linear motion speed percentage (0-100)
6* @return Error code
7*/
8errno_t TractorMoveC(double radio, double angle, double vel);

13.63. Mobile Device Stop Motion

New in version C++SDK-v2.1.5.0.

1/**
2* @brief Mobile device stop motion
3* @return Error code
4*/
5errno_t TractorStop();

13.64. Mobile Device Code Example

 1int TestTractor(void)
 2{
 3  ROBOT_STATE_PKG pkg = {};
 4  FRRobot robot;
 5  robot.LoggerInit();
 6  robot.SetLoggerLevel(1);
 7  int rtn = robot.RPC("192.168.58.2");
 8  if (rtn != 0)
 9  {
10    return -1;
11  }
12  robot.SetReConnectParam(true, 30000, 500);
13  robot.ExtDevSetUDPComParam("192.168.58.2", 2021, 2, 50, 5, 50, 1, 50, 10, 1);
14  robot.ExtDevLoadUDPDriver();
15  rtn = robot.ExtAxisServoOn(1, 1);
16  rtn = robot.ExtAxisServoOn(2, 1);
17  robot.Sleep(2000);
18  robot.ExtAxisSetHoming(1, 0, 10, 2);
19  robot.Sleep(2000);
20  rtn = robot.ExtAxisSetHoming(2, 0, 10, 2);
21  robot.Sleep(4000);
22  robot.ExtAxisParamConfig(1, 0, 0, 50000, -50000, 1000, 1000, 6.280, 16384, 200, 0, 0, 0);
23  robot.ExtAxisParamConfig(2, 0, 0, 50000, -50000, 1000, 1000, 6.280, 16384, 200, 0, 0, 0);
24  robot.SetAxisDHParaConfig(5, 0, 0, 0, 0, 0, 0, 0, 0);
25  robot.TractorEnable(false);
26  robot.Sleep(2000);
27  robot.TractorEnable(true);
28  robot.Sleep(2000);
29  robot.TractorHoming();
30  robot.Sleep(2000);
31  robot.TractorMoveL(100, 2);
32  robot.Sleep(5000);
33  robot.TractorStop();
34  robot.TractorMoveL(-100, 20);
35  robot.Sleep(5000);
36  robot.TractorMoveC(300, 90, 20);
37  robot.Sleep(10000);
38  robot.TractorMoveC(300, -90, 20);
39  robot.Sleep(1);
40  robot.CloseRPC();
41  return 0;
42}

13.65. UDP Extension Axis Positioning Completion Time Setting

1/**
2* @brief UDP extension axis positioning completion time setting
3* @param [in] time Positioning completion time [ms]
4* @return Error code
5*/
6errno_t SetExAxisCmdDoneTime(double time);