6. Common Settings

6.1. Set Tool Reference Point - Six-Point Method

1/**
2 * @brief Set tool reference point - six-point method
3 * @param [in] point_num Point number, range [1~6]
4 * @return Error code
5 */
6errno_t SetToolPoint(int point_num);

6.2. Calculate Tool Coordinate System

1/**
2 * @brief Calculate tool coordinate system
3 * @param [out] tcp_pose Tool coordinate system
4 * @return Error code
5 */
6errno_t ComputeTool(DescPose *tcp_pose);

6.3. Set Tool Reference Point - Four-Point Method

1/**
2 * @brief Set tool reference point - four-point method
3 * @param [in] point_num Point number, range [1~4]
4 * @return Error code
5 */
6errno_t SetTcp4RefPoint(int point_num);

6.4. Calculate Tool Coordinate System

1/**
2 * @brief Calculate tool coordinate system
3 * @param [out] tcp_pose Tool coordinate system
4 * @return Error code
5 */
6errno_t ComputeTcp4(DescPose *tcp_pose);

6.5. Calculate Tool Coordinate System from Points

New in version C++SDK-v2.1.8-3.7.8.

1/**
2 * @brief Calculate tool coordinate system from point data
3 * @param [in] method Calculation method: 0-four-point method; 1-six-point method
4 * @param [in] pos Joint position array (4 points for four-point method, 6 points for six-point method)
5 * @param [out] coord Resulting tool coordinate system
6 * @return Error code
7 */
8errno_t ComputeToolCoordWithPoints(int method, JointPos pos[], DescPose& coord);

6.6. Set Tool Coordinate System

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

 1/**
 2 * @brief Set tool coordinate system
 3 * @param [in] id Coordinate system ID, range [0~14]
 4 * @param [in] coord Tool center point pose relative to end flange center
 5 * @param [in] type 0-tool coordinate system, 1-sensor coordinate system
 6 * @param [in] install Installation position: 0-robot end, 1-external to robot
 7 * @param [in] toolID Tool ID
 8 * @param [in] loadNum Load number
 9 * @return Error code
10 */
11errno_t SetToolCoord(int id, DescPose *coord, int type, int install, int toolID, int loadNum);

6.7. Set Tool Coordinate System List

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

 1/**
 2 * @brief Set tool coordinate system list
 3 * @param [in] id Coordinate system ID, range [0~14]
 4 * @param [in] coord Tool center point pose relative to end flange center
 5 * @param [in] type 0-tool coordinate system, 1-sensor coordinate system
 6 * @param [in] install Installation position: 0-robot end, 1-external to robot
 7 * @param [in] loadNum Load number
 8 * @return Error code
 9 */
10errno_t SetToolList(int id, DescPose *coord, int type, int install, int loadNum);

6.8. Get Current Tool Coordinate System

1/**
2 * @brief Get current tool coordinate system
3 * @param [in] flag 0-blocking, 1-non-blocking
4 * @param [out] desc_pos Tool coordinate system pose
5 * @return Error code
6 */
7errno_t GetTCPOffset(uint8_t flag, DescPose *desc_pos);

6.9. Robot Tool Coordinate System Operation Example

 1int TestTCPCompute(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    DescPose p1Desc(186.331, 487.913, 209.850, 149.030, 0.688, -114.347);
14    JointPos p1Joint(-127.876, -75.341, 115.417, -122.741, -59.820, 74.300);
15    DescPose p2Desc(69.721, 535.073, 202.882, -144.406, -14.775, -89.012);
16    JointPos p2Joint(-101.780, -69.828, 110.917, -125.740, -127.841, 74.300);
17    DescPose p3Desc(146.861, 578.426, 205.598, 175.997, -36.178, -93.437);
18    JointPos p3Joint(-112.851, -60.191, 86.566, -80.676, -97.463, 74.300);
19    DescPose p4Desc(136.284, 509.876, 225.613, 178.987, 1.372, -100.696);
20    JointPos p4Joint(-116.397, -76.281, 113.845, -128.611, -88.654, 74.299);
21    DescPose p5Desc(138.395, 505.972, 298.016, 179.134, 2.147, -101.110);
22    JointPos p5Joint(-116.814, -82.333, 109.162, -118.662, -88.585, 74.302);
23    DescPose p6Desc(105.553, 454.325, 232.017, -179.426, 0.444, -99.952);
24    JointPos p6Joint(-115.649, -84.367, 122.447, -128.663, -90.432, 74.303);
25    ExaxisPos exaxisPos(0, 0, 0, 0);
26    DescPose offdese(0, 0, 0, 0, 0, 0);
27    JointPos posJ[6] = { p1Joint , p2Joint , p3Joint , p4Joint , p5Joint , p6Joint };
28    DescPose coordRtn = {};
29    rtn = robot.ComputeToolCoordWithPoints(1, posJ, coordRtn);
30    printf("ComputeToolCoordWithPoints    %d  coord is %f %f %f %f %f %f \n", rtn, coordRtn.tran.x, coordRtn.tran.y, coordRtn.tran.z, coordRtn.rpy.rx, coordRtn.rpy.ry, coordRtn.rpy.rz);
31    robot.MoveJ(&p1Joint, &p1Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
32    robot.SetToolPoint(1);
33    robot.MoveJ(&p2Joint, &p2Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
34    robot.SetToolPoint(2);
35    robot.MoveJ(&p3Joint, &p3Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
36    robot.SetToolPoint(3);
37    robot.MoveJ(&p4Joint, &p4Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
38    robot.SetToolPoint(4);
39    robot.MoveJ(&p5Joint, &p5Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
40    robot.SetToolPoint(5);
41    robot.MoveJ(&p6Joint, &p6Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
42    robot.SetToolPoint(6);
43    rtn = robot.ComputeTool(&coordRtn);
44    printf("6 Point ComputeTool        %d  coord is %f %f %f %f %f %f \n", rtn, coordRtn.tran.x, coordRtn.tran.y, coordRtn.tran.z, coordRtn.rpy.rx, coordRtn.rpy.ry, coordRtn.rpy.rz);
45    robot.SetToolList(1, &coordRtn, 0, 0, 0);
46    robot.MoveJ(&p1Joint, &p1Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
47    robot.SetTcp4RefPoint(1);
48    robot.MoveJ(&p2Joint, &p2Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
49    robot.SetTcp4RefPoint(2);
50    robot.MoveJ(&p3Joint, &p3Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
51    robot.SetTcp4RefPoint(3);
52    robot.MoveJ(&p4Joint, &p4Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
53    robot.SetTcp4RefPoint(4);
54    rtn = robot.ComputeTcp4(&coordRtn);
55    printf("4 Point ComputeTool        %d  coord is %f %f %f %f %f %f \n", rtn, coordRtn.tran.x, coordRtn.tran.y, coordRtn.tran.z, coordRtn.rpy.rx, coordRtn.rpy.ry, coordRtn.rpy.rz);
56    robot.SetToolCoord(2, &coordRtn, 0, 0, 1, 0);
57    DescPose getCoord = {};
58    rtn = robot.GetTCPOffset(0, &getCoord);
59    printf("GetTCPOffset    %d  coord is %f %f %f %f %f %f \n", rtn, coordRtn.tran.x, coordRtn.tran.y, coordRtn.tran.z, coordRtn.rpy.rx, coordRtn.rpy.ry, coordRtn.rpy.rz);
60    robot.CloseRPC();
61    return 0;
62}

6.10. Set External Tool Reference Point - Six-Point Method

1/**
2 * @brief Set external tool reference point - six-point method
3 * @param [in] point_num Point number, range [1~4]
4 * @return Error code
5 */
6errno_t SetExTCPPoint(int point_num);

6.11. Calculate External Tool Coordinate System

1/**
2 * @brief Calculate external tool coordinate system
3 * @param [out] tcp_pose External tool coordinate system
4 * @return Error code
5 */
6errno_t ComputeExTCF(DescPose *tcp_pose);

6.12. Set External Tool Coordinate System

Changed in version C++SDK-v2.1.2.0.

1/**
2 * @brief Set external tool coordinate system
3 * @param [in] id Coordinate system ID, range [0~14]
4 * @param [in] etcp Tool center point pose relative to end flange center
5 * @param [in] etool To be determined
6 * @return Error code
7 */
8errno_t SetExToolCoord(int id, DescPose *etcp, DescPose *etool);

6.13. Set External Tool Coordinate System List

Changed in version C++SDK-v2.1.2.0.

1/**
2 * @brief Set external tool coordinate system list
3 * @param [in] id Coordinate system ID, range [0~14]
4 * @param [in] etcp Tool center point pose relative to end flange center
5 * @param [in] etool To be determined
6 * @return Error code
7 */
8errno_t SetExToolList(int id, DescPose *etcp, DescPose *etool);

6.14. Robot External Tool Coordinate System Operation Example

 1int TestExtCoord(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   DescPose p1Desc(-89.606, 779.517, 193.516, 178.000, 0.476, -92.484);
14   JointPos p1Joint(-108.145, -50.137, 85.818, -125.599, -87.946, 74.329);
15   DescPose p2Desc(-24.656, 850.384, 191.361, 177.079, -2.058, -95.355);
16   JointPos p2Joint(-111.024, -41.538, 69.222, -114.913, -87.743, 74.329);
17   DescPose p3Desc(-99.813, 766.661, 241.878, -176.817, 1.917, -91.604);
18   JointPos p3Joint(-107.266, -56.116, 85.971, -122.560, -92.548, 74.331);
19   ExaxisPos exaxisPos(0, 0, 0, 0);
20   DescPose offdese(0, 0, 0, 0, 0, 0);
21   DescPose posTCP[3] = { p1Desc , p2Desc , p3Desc };
22   DescPose coordRtn = {};
23   robot.MoveJ(&p1Joint, &p1Desc, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
24   robot.SetExTCPPoint(1);
25   robot.MoveJ(&p2Joint, &p2Desc, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
26   robot.SetExTCPPoint(2);
27   robot.MoveJ(&p3Joint, &p3Desc, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
28   robot.SetExTCPPoint(3);
29   rtn = robot.ComputeExTCF(&coordRtn);
30   printf("ComputeExTCF          %d coord is %f %f %f %f %f %f \n", rtn, coordRtn.tran.x, coordRtn.tran.y, coordRtn.tran.z, coordRtn.rpy.rx, coordRtn.rpy.ry, coordRtn.rpy.rz);
31   robot.SetExToolCoord(1, &coordRtn, &offdese);
32   robot.SetExToolList(1, &coordRtn, &offdese);
33   robot.CloseRPC();
34   return 0;
35}

6.15. Set Workpiece Reference Point - Three-Point Method

1/**
2 * @brief Set workpiece reference point - three-point method
3 * @param [in] point_num Point number, range [1~3]
4 * @return Error code
5 */
6errno_t SetWObjCoordPoint(int point_num);

6.16. Calculate Workpiece Coordinate System

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

1/**
2 * @brief Calculate workpiece coordinate system
3 * @param [in] method Calculation method: 0-origin-x-axis-z-axis, 1-origin-x-axis-xy-plane
4 * @param [in] refFrame Reference coordinate system
5 * @param [out] wobj_pose Workpiece coordinate system
6 * @return Error code
7 */
8errno_t ComputeWObjCoord(int method, int refFrame, DescPose *wobj_pose);

6.17. Set Workpiece Coordinate System

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

1/**
2 * @brief Set workpiece coordinate system
3 * @param [in] id Coordinate system ID, range [0~14]
4 * @param [in] coord Workpiece coordinate system pose relative to end flange center
5 * @param [in] refFrame Reference coordinate system
6 * @return Error code
7 */
8errno_t SetWObjCoord(int id, DescPose *coord, int refFrame);

6.18. Set Workpiece Coordinate System List

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

1/**
2 * @brief Set workpiece coordinate system list
3 * @param [in] id Coordinate system ID, range [0~14]
4 * @param [in] coord Workpiece coordinate system pose relative to end flange center
5 * @param [in] refFrame Reference coordinate system
6 * @return Error code
7 */
8errno_t SetWObjList(int id, DescPose *coord, int refFrame);

6.19. Calculate Workpiece Coordinate System from Points

New in version C++SDK-v2.1.8-3.7.8.

1/**
2 * @brief Calculate workpiece coordinate system from point data
3 * @param [in] method Calculation method: 0-origin-x-axis-z-axis, 1-origin-x-axis-xy-plane
4 * @param [in] pos Three TCP position array
5 * @param [in] refFrame Reference coordinate system
6 * @param [out] coord Resulting workpiece coordinate system
7 * @return Error code
8 */
9errno_t ComputeWObjCoordWithPoints(int method, DescPose pos[], int refFrame, DescPose& coord);

6.20. Get Current Workpiece Coordinate System

1/**
2 * @brief Get current workpiece coordinate system
3 * @param [in] flag 0-blocking, 1-non-blocking
4 * @param [out] desc_pos Workpiece coordinate system pose
5 * @return Error code
6 */
7errno_t GetWObjOffset(uint8_t flag, DescPose *desc_pos);

6.21. Robot Workpiece Coordinate System Operation Example

 1int TestWobjCoord(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    DescPose p1Desc(-89.606, 779.517, 193.516, 178.000, 0.476, -92.484);
14    JointPos p1Joint(-108.145, -50.137, 85.818, -125.599, -87.946, 74.329);
15    DescPose p2Desc(-24.656, 850.384, 191.361, 177.079, -2.058, -95.355);
16    JointPos p2Joint(-111.024, -41.538, 69.222, -114.913, -87.743, 74.329);
17    DescPose p3Desc(-99.813, 766.661, 241.878, -176.817, 1.917, -91.604);
18    JointPos p3Joint(-107.266, -56.116, 85.971, -122.560, -92.548, 74.331);
19    ExaxisPos exaxisPos(0, 0, 0, 0);
20    DescPose offdese(0, 0, 0, 0, 0, 0);
21    DescPose posTCP[3] = { p1Desc , p2Desc , p3Desc };
22    DescPose coordRtn = {};
23    rtn = robot.ComputeWObjCoordWithPoints(1, posTCP, 0, coordRtn);
24    printf("ComputeWObjCoordWithPoints    %d  coord is %f %f %f %f %f %f \n", rtn, coordRtn.tran.x, coordRtn.tran.y, coordRtn.tran.z, coordRtn.rpy.rx, coordRtn.rpy.ry, coordRtn.rpy.rz);
25    robot.MoveJ(&p1Joint, &p1Desc, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
26    robot.SetWObjCoordPoint(1);
27    robot.MoveJ(&p2Joint, &p2Desc, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
28    robot.SetWObjCoordPoint(2);
29    robot.MoveJ(&p3Joint, &p3Desc, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
30    robot.SetWObjCoordPoint(3);
31    rtn = robot.ComputeWObjCoord(1, 0, &coordRtn);
32    printf("ComputeWObjCoord                   %d  coord is %f %f %f %f %f %f \n", rtn, coordRtn.tran.x, coordRtn.tran.y, coordRtn.tran.z, coordRtn.rpy.rx, coordRtn.rpy.ry, coordRtn.rpy.rz);
33    robot.SetWObjCoord(1, &coordRtn, 0);
34    robot.SetWObjList(1, &coordRtn, 0);
35    DescPose getWobjDesc = {};
36    rtn = robot.GetWObjOffset(0, &getWobjDesc);
37    printf("GetWObjOffset                   %d  coord is %f %f %f %f %f %f \n", rtn, coordRtn.tran.x, coordRtn.tran.y, coordRtn.tran.z, coordRtn.rpy.rx, coordRtn.rpy.ry, coordRtn.rpy.rz);
38    robot.CloseRPC();
39    return 0;
40}

6.22. Set Global Speed

1/**
2 * @brief Set global speed
3 * @param [in] vel Speed percentage, range [0~100]
4 * @return Error code
5 */
6errno_t SetSpeed(int vel);

6.23. Set Robot Acceleration

1/**
2 * @brief Set robot acceleration
3 * @param [in] acc Robot acceleration percentage
4 * @return Error code
5 */
6errno_t SetOaccScale(double acc);

6.24. Get Robot Default Speed

1/**
2 * @brief Get robot default speed
3 * @param [out] vel Speed in mm/s
4 * @return Error code
5 */
6errno_t GetDefaultTransVel(float *vel);

6.25. Set End Load Weight

Changed in version C++SDK-v2.1.8-3.7.8.

1/**
2 * @brief Set end load weight
3 * @param [in] loadNum Load number
4 * @param [in] weight Load weight in kg
5 * @return Error code
6 */
7errno_t SetLoadWeight(int loadNum = 0, float weight);

6.26. Set End Effector Payload Center of Gravity Coordinates

New in version C++SDK-v3.8.6.

1/**
2* @brief Set End Effector Payload Center of Gravity Coordinates
3* @param [in] loadNum Payload number
4* @param [in] coord Center of gravity coordinates, unit mm
5* @return Error code
6*/
7errno_t SetLoadCoord(int loadNum, DescTran* coord);

6.27. Get Current Load Weight

1/**
2 * @brief Get current load weight
3 * @param [in] flag 0-blocking, 1-non-blocking
4 * @param [out] weight Load weight in kg
5 * @return Error code
6 */
7errno_t GetTargetPayload(uint8_t flag, float *weight);

6.28. Get Current Load Center of Gravity

1/**
2 * @brief Get current load center of gravity
3 * @param [in] flag 0-blocking, 1-non-blocking
4 * @param [out] cog Load center of gravity in mm
5 * @return Error code
6 */
7errno_t GetTargetPayloadCog(uint8_t flag, DescTran *cog);

6.29. Set Robot Installation Method

1/**
2 * @brief Set robot installation method
3 * @param [in] install Installation method: 0-standard, 1-wall-mounted, 2-ceiling-mounted
4 * @return Error code
5 */
6errno_t SetRobotInstallPos(uint8_t install);

6.30. Set Robot Installation Angle

1/**
2 * @brief Set robot installation angle (free installation)
3 * @param [in] yangle Tilt angle
4 * @param [in] zangle Rotation angle
5 * @return Error code
6 */
7errno_t SetRobotInstallAngle(double yangle, double zangle);

6.31. Get Robot Installation Angle

1/**
2 * @brief Get robot installation angle
3 * @param [out] yangle Tilt angle
4 * @param [out] zangle Rotation angle
5 * @return Error code
6 */
7errno_t GetRobotInstallAngle(float *yangle, float *zangle);

6.32. Set System Variable Value

1/**
2 * @brief Set system variable value
3 * @param [in] id Variable number, range [1~20]
4 * @param [in] value Variable value
5 * @return Error code
6 */
7errno_t SetSysVarValue(int id, float value);

6.33. Get System Variable Value

1/**
2 * @brief Get system variable value
3 * @param [in] id System variable number, range [1~20]
4 * @param [out] value System variable value
5 * @return Error code
6 */
7errno_t GetSysVarValue(int id, float *value);

6.34. Robot Common Settings Example

 1int TestLoadInstall(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 = 1; i < 100; i++)
14    {
15        robot.SetSpeed(i);
16        robot.SetOaccScale(i);
17        robot.Sleep(30);
18    }
19    float defaultVel = 0.0;
20    robot.GetDefaultTransVel(&defaultVel);
21    printf("GetDefaultTransVel is %f\n", defaultVel);
22    for (int i = 1; i < 21; i++)
23    {
24        robot.SetSysVarValue(i, i + 0.5);
25        robot.Sleep(100);
26    }
27    for (int i = 1; i < 21; i++)
28    {
29        float value = 0;
30        robot.GetSysVarValue(i, &value);
31        printf("sys value  %d is :%f\n", i, value);
32        robot.Sleep(100);
33    }
34    robot.SetLoadWeight(0, 2.5);
35    DescTran loadCoord = {};
36    loadCoord.x = 3.0;
37    loadCoord.y = 4.0;
38    loadCoord.z = 5.0;
39    robot.SetLoadCoord(&loadCoord);
40    robot.Sleep(1000);
41    float getLoad = 0.0;
42    robot.GetTargetPayload(0, &getLoad);
43    DescTran getLoadTran = {};
44    robot.GetTargetPayloadCog(0, &getLoadTran);
45    printf("get load is %f; get load cog is %f %f %f\n", getLoad, getLoadTran.x, getLoadTran.y, getLoadTran.z);
46    robot.SetRobotInstallPos(0);
47    robot.SetRobotInstallAngle(15.0, 25.0);
48    float anglex = 0.0;
49    float angley = 0.0;
50    robot.GetRobotInstallAngle(&anglex, &angley);
51    printf("GetRobotInstallAngle x:  %f;  y:  %f\n", anglex, angley);
52    robot.CloseRPC();
53    return 0;
54}

6.35. Joint Friction Compensation Switch

1/**
2 * @brief Joint friction compensation switch
3 * @param [in] state 0-off, 1-on
4 * @return Error code
5 */
6errno_t FrictionCompensationOnOff(uint8_t state);

6.36. Set Joint Friction Compensation Coefficient - Standard Installation

1/**
2 * @brief Set joint friction compensation coefficient - standard installation
3 * @param [in] coeff Six joint compensation coefficients, range [0~1]
4 * @return Error code
5 */
6errno_t SetFrictionValue_level(float coeff[6]);

6.37. Set Joint Friction Compensation Coefficient - Wall Installation

1/**
2 * @brief Set joint friction compensation coefficient - wall installation
3 * @param [in] coeff Six joint compensation coefficients, range [0~1]
4 * @return Error code
5 */
6errno_t SetFrictionValue_wall(float coeff[6]);

6.38. Set Joint Friction Compensation Coefficient - Ceiling Installation

1/**
2 * @brief Set joint friction compensation coefficient - ceiling installation
3 * @param [in] coeff Six joint compensation coefficients, range [0~1]
4 * @return Error code
5 */
6errno_t SetFrictionValue_ceiling(float coeff[6]);

6.39. Set Joint Friction Compensation Coefficient - Free Installation

1/**
2 * @brief Set joint friction compensation coefficient - free installation
3 * @param [in] coeff Six joint compensation coefficients, range [0~1]
4 * @return Error code
5 */
6errno_t SetFrictionValue_freedom(float coeff[6]);

6.40. Robot Joint Friction Compensation Example

 1int TestFriction(void)
 2{
 3    ROBOT_STATE_PKG pkg = {};
 4    FRRobot robot;
 5
 6    robot.LoggerInit();
 7    robot.SetLoggerLevel(1);
 8    int rtn = robot.RPC("192.168.58.2");
 9    if (rtn != 0)
10    {
11        return -1;
12    }
13    robot.SetReConnectParam(true, 30000, 500);
14    float lcoeff[6] = { 0.9,0.9,0.9,0.9,0.9,0.9 };
15    float wcoeff[6] = { 0.4,0.4,0.4,0.4,0.4,0.4 };
16    float ccoeff[6] = { 0.6,0.6,0.6,0.6,0.6,0.6 };
17    float fcoeff[6] = { 0.5,0.5,0.5,0.5,0.5,0.5 };
18    rtn = robot.FrictionCompensationOnOff(1);
19    printf("FrictionCompensationOnOff rtn is %d\n", rtn);
20    rtn = robot.SetFrictionValue_level(lcoeff);
21    printf("SetFrictionValue_level rtn is %d\n", rtn);
22    rtn = robot.SetFrictionValue_wall(wcoeff);
23    printf("SetFrictionValue_wall rtn is %d\n", rtn);
24    rtn = robot.SetFrictionValue_ceiling(ccoeff);
25    printf("SetFrictionValue_ceiling rtn is %d\n", rtn);
26    rtn = robot.SetFrictionValue_freedom(fcoeff);
27    printf("SetFrictionValue_freedom rtn is %d\n", rtn);
28    robot.CloseRPC();
29    return 0;
30}

6.41. Query Robot Error Code

1/**
2 * @brief Query robot error code
3 * @param [out] maincode Main error code
4 * @param [out] subcode Sub error code
5 * @return Error code
6 */
7errno_t GetRobotErrorCode(int *maincode, int *subcode);

6.42. Error State Clear

1/**
2 * @brief Error state clear
3 * @return Error code
4 */
5errno_t ResetAllError();

6.43. Robot Fault State Acquisition and Error Clear Example

 1int TestGetError(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 maincode, subcode;
14    robot.GetRobotErrorCode(&maincode, &subcode);
15    printf("robot maincode is %d; subcode is %d\n", maincode, subcode);
16    robot.ResetAllError();
17    robot.Sleep(1000);
18    robot.GetRobotErrorCode(&maincode, &subcode);
19    printf("robot maincode is %d; subcode is %d\n", maincode, subcode);
20    robot.CloseRPC();
21    return 0;
22}

6.44. Set wide voltage control box temperature and fan current monitoring parameters

1/**
2*@brief setting wide voltage control box temperature and fan current monitoring parameters
3*@param [ in ] enable 0-do not enable monitoring; 1-enable monitoring
4*@param [ in ] period (s) , range 1-100
5*@return error code
6*/
7errno_t SetWideBoxTempFanMonitorParam(int enable, int period);

6.45. Obtain wide voltage control box temperature and fan current monitoring parameters

1/**
2* @brief Obtain wide voltage control box temperature and fan current monitoring parameters
3*@param [ in ] enable 0-do not enable monitoring; 1-enable monitoring
4*@param [ in ] period (s) , range 1-100
5*@return error code
6*/
7errno_t GetWideBoxTempFanMonitorParam(int &enable, int &period);

6.46. Wide voltage control box temperature and fan current state acquisition code example

 1 int TestWideVoltageCtrlBoxtemp(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     printf("robot rpc rtn is %d\n", rtn);
 9     if (rtn != 0)
10     {
11         return -1;
12     }
13     robot.SetReConnectParam(true, 30000, 500);
14     robot.SetWideBoxTempFanMonitorParam(1, 2);
15     int enable = 0;
16     int period = 0;
17     robot.GetWideBoxTempFanMonitorParam(enable, period);
18     printf("GetWideBoxTempFanMonitorParam enable is %d   period is %d\n", enable, period);
19     for (int i = 0; i < 100; i++)
20     {
21         robot.GetRobotRealTimeState(&pkg);
22         printf("robot ctrl box temp is %f,  fan current is %d\n", pkg.wideVoltageCtrlBoxTemp, pkg.wideVoltageCtrlBoxFanCurrent);
23         robot.Sleep(100);
24     }
25     rtn = robot.SetWideBoxTempFanMonitorParam(0, 2);
26     printf("SetWideBoxTempFanMonitorParam rtn is %d\n", rtn);
27     enable = 0;
28     period = 0;
29     robot.GetWideBoxTempFanMonitorParam(enable, period);
30     printf("GetWideBoxTempFanMonitorParam enable is %d   period is %d\n", enable, period);
31     for (int i = 0; i < 100; i++)
32     {
33         robot.GetRobotRealTimeState(&pkg);
34         printf("robot ctrl box temp is %f,  fan current is %d\n", pkg.wideVoltageCtrlBoxTemp, pkg.wideVoltageCtrlBoxFanCurrent);
35         robot.Sleep(100);
36     }
37     robot.CloseRPC();
38     robot.Sleep(2000);
39     return 0;
40 }

6.47. Calculate Focus Calibration Results

1/**
2* @brief Calculate focus calibration results
3* @param [in] pointNum Number of calibration points
4* @param [out] resultPos Calibration result XYZ
5* @param [out] accuracy Calibration accuracy error
6* @return Error code
7*/
8errno_t ComputeFocusCalib(int pointNum, DescTran& resultPos, float& accuracy);

6.48. Set Focus Position

1/**
2* @brief Set focus position
3* @param [in] pos Focus position XYZ
4* @return Error code
5*/
6errno_t SetFocusPosition(DescTran pos);

6.49. Enable Focus Following

 1/**
 2* @brief Enable focus following
 3* @param [in] kp Proportional parameter (default: 50.0)
 4* @param [in] kpredict Feedforward parameter (default: 19.0)
 5* @param [in] aMax Maximum angular acceleration limit (default: 1440°/s²)
 6* @param [in] vMax Maximum angular velocity limit (default: 180°/s)
 7* @param [in] type X-axis locking mode (0-reference input vector; 1-horizontal; 2-vertical)
 8* @return Error code
 9*/
10errno_t FocusStart(double kp, double kpredict, double aMax, double vMax, int type);

6.50. Disable Focus Following

1/**
2* @brief Disable focus following
3* @return Error code
4*/
5errno_t FocusEnd();

6.51. Robot Focus Following Code Example

 1int TestFocus()
 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  DescPose p1Desc(186.331, 487.913, 209.850, 149.030, 0.688, -114.347);
14  JointPos p1Joint(-127.876, -75.341, 115.417, -122.741, -59.820, 74.300);
15  DescPose p2Desc(69.721, 535.073, 202.882, -144.406, -14.775, -89.012);
16  JointPos p2Joint(-101.780, -69.828, 110.917, -125.740, -127.841, 74.300);
17  DescPose p3Desc(146.861, 578.426, 205.598, 175.997, -36.178, -93.437);
18  JointPos p3Joint(-112.851, -60.191, 86.566, -80.676, -97.463, 74.300);
19  DescPose p4Desc(136.284, 509.876, 225.613, 178.987, 1.372, -100.696);
20  JointPos p4Joint(-116.397, -76.281, 113.845, -128.611, -88.654, 74.299);
21  DescPose p5Desc(138.395, 505.972, 298.016, 179.134, 2.147, -101.110);
22  JointPos p5Joint(-116.814, -82.333, 109.162, -118.662, -88.585, 74.302);
23  DescPose p6Desc(105.553, 454.325, 232.017, -179.426, 0.444, -99.952);
24  JointPos p6Joint(-115.649, -84.367, 122.447, -128.663, -90.432, 74.303);
25  ExaxisPos exaxisPos(0, 0, 0, 0);
26  DescPose offdese(0, 0, 100, 0, 0, 0);
27  robot.MoveJ(&p1Joint, &p1Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
28  robot.SetTcp4RefPoint(1);
29  robot.MoveJ(&p2Joint, &p2Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
30  robot.SetTcp4RefPoint(2);
31  robot.MoveJ(&p3Joint, &p3Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
32  robot.SetTcp4RefPoint(3);
33  robot.MoveJ(&p4Joint, &p4Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
34  robot.SetTcp4RefPoint(4);
35  DescPose coordRtn = {};
36  rtn = robot.ComputeTcp4(&coordRtn);
37  printf("4 Point ComputeTool    %d coord is %f %f %f %f %f %f \n", rtn, coordRtn.tran.x, coordRtn.tran.y, coordRtn.tran.z, coordRtn.rpy.rx, coordRtn.rpy.ry, coordRtn.rpy.rz);
38  robot.SetToolCoord(1, &coordRtn, 0, 0, 1, 0);
39  robot.GetForwardKin(&p1Joint, &p1Desc);
40  robot.GetForwardKin(&p2Joint, &p2Desc);
41  robot.GetForwardKin(&p3Joint, &p3Desc);
42  robot.SetFocusCalibPoint(1, p1Desc);
43  robot.SetFocusCalibPoint(2, p2Desc);
44  robot.SetFocusCalibPoint(3, p3Desc);
45  DescTran resultPos = {};
46  float accuracy = 0.0;
47  rtn = robot.ComputeFocusCalib(3, resultPos, accuracy);
48  printf("ComputeFocusCalib coord is %d %f %f %f accuracy is %f\n", rtn, resultPos.x, resultPos.y, resultPos.z, accuracy);
49  rtn = robot.SetFocusPosition(resultPos);
50  robot.GetForwardKin(&p5Joint, &p5Desc);
51  robot.GetForwardKin(&p6Joint, &p6Desc);
52  robot.MoveL(&p5Joint, &p5Desc, 1, 0, 10, 100, 100, -1, 0, &exaxisPos, 0, 1, &offdese);
53  robot.MoveL(&p6Joint, &p6Desc, 1, 0, 10, 100, 100, -1, 0, &exaxisPos, 0, 1, &offdese);
54  robot.FocusStart(50, 19, 710, 90, 0);
55  robot.MoveL(&p5Joint, &p5Desc, 1, 0, 10, 100, 100, -1, 0, &exaxisPos, 0, 1, &offdese);
56  robot.MoveL(&p6Joint, &p6Desc, 1, 0, 10, 100, 100, -1, 0, &exaxisPos, 0, 1, &offdese);
57  robot.FocusEnd();
58  robot.CloseRPC();
59  return 0;
60}

6.52. Open the joint torque sensor sensitivity calibration function

1/**
2* @brief Open the joint torque sensor sensitivity calibration function
3* @param [ in ] status 0-off; 1-on
4* @return  error code
5*/
6errno_t JointSensitivityEnable(int status);

6.53. Data acquisition of joint torque sensor sensitivity

1/**
2* @brief Data acquisition of joint torque sensor sensitivity
3* @return error code
4*/
5errno_t JointSensitivityCollect();

6.54. Obtain joint torque sensor sensitivity calibration results

1/**
2* @brief Get joint torque sensor sensitivity calibration results
3* @param [out] calibResult j1~j6 joint sensitivity [0-1]
4* @param [out] linearity j1~j6 joint linearity [0-1]
5* @return Error code
6*/
7errno_t JointSensitivityCalibration(double calibResult[6], double linearity[6]);

6.55. Get Joint Torque Sensor Hysteresis Error

1/**
2* @brief Get joint torque sensor hysteresis error
3* @param [out] hysteresisError j1~j6 joint hysteresis error
4* @return Error code
5*/
6errno_t JointHysteresisError(double hysteresisError[6]);

6.56. Get Joint Torque Sensor Repeatability

1/**
2* @brief Get joint torque sensor repeatability
3* @param [out] repeatability j1~j6 joint torque sensor repeatability
4* @return Error code
5*/
6errno_t JointRepeatability(double repeatability[6]);

6.57. Set Joint Force Sensor Parameters

 1/**
 2* @brief Set joint force sensor parameters
 3* @param [in] M J1-J6 mass coefficient [0.001 ~ 10]
 4* @param [in] B J1-J6 damping coefficient [0.001 ~ 10]
 5* @param [in] K J1-J6 stiffness coefficient [0.001 ~ 10]
 6* @param [in] threshold Force control threshold, Nm
 7* @param [in] sensitivity Sensitivity, Nm/V, [0 ~ 10]
 8* @param [in] setZeroFlag Function enable flag; 0-Off; 1-On; 2-Record zero point at position 1; 3-Record zero point at position 2
 9* @return Error code
10*/
11errno_t SetAdmittanceParams(double M[6], double B[6], double K[6], double threshold[6], double sensitivity[6], int setZeroFlag);

6.58. An example of joint torque sensor sensitivity auto-calibration code

  1int TestSensitivityCalib()
  2{
  3    ROBOT_STATE_PKG pkg = {};
  4    FRRobot robot;
  5    robot.LoggerInit();
  6    robot.SetLoggerLevel(1);
  7    robot.SetReConnectParam(true, 30000, 500);
  8    int rtn = robot.RPC("192.168.58.2");
  9    if (rtn != 0)
 10    {
 11        return 0;
 12    }
 13    rtn = robot.JointSensitivityEnable(0);
 14    rtn = robot.JointSensitivityEnable(1);
 15    printf("JointSensitivityEnable rtn is %d\n", rtn);
 16    JointPos curJPos = {};
 17    robot.GetActualJointPosDegree(0, &curJPos);
 18    ExaxisPos epos = { 0,0,0,0 };
 19    DescPose offset_pos = { 0,0,0,0,0,0 };
 20    JointPos jointPos1 = { curJPos.jPos[0], 0, 0, -90, 0.02, curJPos.jPos[5] };
 21    DescPose descPos1 = {};
 22    robot.GetForwardKin(&jointPos1, &descPos1);
 23    robot.MoveJ(&jointPos1, &descPos1, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
 24    robot.Sleep(200);
 25    rtn = robot.JointSensitivityCollect();
 26    printf("JointSensitivityCollect 1 rtn is %d\n", rtn);
 27    robot.Sleep(100);
 28    JointPos jointPos2 = { curJPos.jPos[0], -30, 0, -90, 0.02, curJPos.jPos[5] };
 29    DescPose descPos2 = {};
 30    robot.GetForwardKin(&jointPos2, &descPos2);
 31    robot.MoveJ(&jointPos2, &descPos2, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
 32    robot.Sleep(100);
 33    rtn = robot.JointSensitivityCollect();
 34    printf("JointSensitivityCollect 2 rtn is %d\n", rtn);
 35    robot.Sleep(100);
 36    JointPos jointPos3 = { curJPos.jPos[0], -60, 0, -90, 0.02, curJPos.jPos[5] };
 37    DescPose descPos3 = {};
 38    robot.GetForwardKin(&jointPos3, &descPos3);
 39    robot.MoveJ(&jointPos3, &descPos3, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
 40    robot.Sleep(100);
 41    rtn = robot.JointSensitivityCollect();
 42    printf("JointSensitivityCollect 3 rtn is %d\n", rtn);
 43    robot.Sleep(100);
 44    JointPos jointPos4 = { curJPos.jPos[0], -90, 0, -90, 0.02, curJPos.jPos[5] };
 45    DescPose descPos4 = {};
 46    robot.GetForwardKin(&jointPos4, &descPos4);
 47    robot.MoveJ(&jointPos4, &descPos4, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
 48    robot.Sleep(100);
 49    rtn = robot.JointSensitivityCollect();
 50    printf("JointSensitivityCollect 4 rtn is %d\n", rtn);
 51    robot.Sleep(100);
 52    JointPos jointPos5 = { curJPos.jPos[0], -120, 0, -90, 0.02, curJPos.jPos[5] };
 53    DescPose descPos5 = {};
 54    robot.GetForwardKin(&jointPos5, &descPos5);
 55    robot.MoveJ(&jointPos5, &descPos5, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
 56    robot.Sleep(100);
 57    rtn = robot.JointSensitivityCollect();
 58    printf("JointSensitivityCollect 5 rtn is %d\n", rtn);
 59    robot.Sleep(100);
 60    JointPos jointPos6 = { curJPos.jPos[0], -150, 0, -90, 0.02, curJPos.jPos[5] };
 61    DescPose descPos6 = {};
 62    robot.GetForwardKin(&jointPos6, &descPos6);
 63    robot.MoveJ(&jointPos6, &descPos6, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
 64    robot.Sleep(100);
 65    rtn = robot.JointSensitivityCollect();
 66    printf("JointSensitivityCollect 6 rtn is %d\n", rtn);
 67    robot.Sleep(100);
 68    JointPos jointPos7 = { curJPos.jPos[0], -180, 0, -90, 0.02, curJPos.jPos[5] };
 69    DescPose descPos7 = {};
 70    robot.GetForwardKin(&jointPos7, &descPos7);
 71    robot.MoveJ(&jointPos7, &descPos7, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
 72    robot.Sleep(100);
 73    rtn = robot.JointSensitivityCollect();
 74    printf("JointSensitivityCollect 7 rtn is %d\n", rtn);
 75    robot.Sleep(100);
 76    //-------------------
 77    robot.MoveJ(&jointPos6, &descPos6, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
 78    robot.Sleep(100);
 79    rtn = robot.JointSensitivityCollect();
 80    printf("JointSensitivityCollect 8 rtn is %d\n", rtn);
 81    robot.Sleep(100);
 82    robot.MoveJ(&jointPos5, &descPos5, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
 83    robot.Sleep(100);
 84    rtn = robot.JointSensitivityCollect();
 85    printf("JointSensitivityCollect 9 rtn is %d\n", rtn);
 86    robot.Sleep(100);
 87    robot.MoveJ(&jointPos4, &descPos4, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
 88    robot.Sleep(100);
 89    rtn = robot.JointSensitivityCollect();
 90    printf("JointSensitivityCollect 10 rtn is %d\n", rtn);
 91    robot.Sleep(100);
 92    robot.MoveJ(&jointPos3, &descPos3, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
 93    robot.Sleep(100);
 94    rtn = robot.JointSensitivityCollect();
 95    printf("JointSensitivityCollect 11 rtn is %d\n", rtn);
 96    robot.Sleep(100);
 97    robot.MoveJ(&jointPos2, &descPos2, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
 98    robot.Sleep(100);
 99    rtn = robot.JointSensitivityCollect();
100    printf("JointSensitivityCollect 12 rtn is %d\n", rtn);
101    robot.Sleep(100);
102    robot.MoveJ(&jointPos1, &descPos1, 0, 0, 100, 100, 100, &epos, -1, 0, &offset_pos);
103    robot.Sleep(200);
104    rtn = robot.JointSensitivityCollect();
105    printf("JointSensitivityCollect 13 rtn is %d\n", rtn);
106    robot.Sleep(100);
107    double calibResult[6] = { 0.0 };
108    double linearity[6] = { 0.0 };
109    rtn = robot.JointSensitivityCalibration(calibResult, linearity);
110    printf("JointSensitivityCalibration rtn is %d\n", rtn);
111    rtn = robot.JointSensitivityEnable(0);
112    printf("JointSensitivityEnable rtn is %d\n", rtn);
113    printf("jointSensor Calib result is %f %f %f %f %f %f\njointSensor linearity is %f %f %f %f %f %f\n",
114        calibResult[0], calibResult[1], calibResult[2],
115        calibResult[3], calibResult[4], calibResult[5],
116        linearity[0], linearity[1], linearity[2],
117        linearity[3], linearity[4], linearity[5]);
118    double hysteresisError[6] = { 0.0 };
119    rtn = robot.JointHysteresisError(hysteresisError);
120    printf("JointHysteresisError result is %f %f %f %f %f %f\n",
121        hysteresisError[0], hysteresisError[1], hysteresisError[2],
122        hysteresisError[3], hysteresisError[4], hysteresisError[5]);
123    double repeatability[6] = { 0.0 };
124    rtn = robot.JointRepeatability(repeatability);
125    printf("JointRepeatability result is %f %f %f %f %f %f\n",
126        repeatability[0], repeatability[1], repeatability[2],
127        repeatability[3], repeatability[4], repeatability[5]);
128    double M[6] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
129    double B[6] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
130    double K[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
131    double threshold[6] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
132    int setZeroFlag = 1;
133    rtn = robot.SetAdmittanceParams(M, B, K, threshold, calibResult, setZeroFlag);
134    printf("SetAdmittanceParams rtn is %d\n", rtn);
135    robot.CloseRPC();
136}

6.59. Gets 8 slave error frames

 1/**
 2* @brief  gets 8 slave error frames
 3* @param [ out ] in recverr
 4* @param [ out -RSB- inCRCErr enCRC CRC error frames
 5* @param [ out ] in forwarding error frames
 6* @param [ out ] inlinker R enter link error frames
 7* @param [ out ] out recverr output received error frames
 8* @param [ out ] outCRCErr output CRC error frames
 9* @param [ out ] outtransmitterr output forwarding error frames
10* @param [ out ] outLinkErr output link error frames
11* @return  error code
12*/
13errno_t GetSlavePortErrCounter(int inRecvErr[8], int inCRCErr[8], int inTransmitErr[8], int inLinkErr[8], int outRecvErr[8], int outCRCErr[8], int outTransmitErr[8], int outLinkErr[8]);

6.60. Error frame zeroing at slave port

1/**
2* @brief Error frame zeroing at slave port
3* @param [in] slaveID Slave station number 0 ~ 7
4* @return error code
5*/
6errno_t SlavePortErrCounterClear(int slaveID);

6.61. Gets an example of a slave port error frame code

 1int TestSlavePortErr()
 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 0;
11    }
12    robot.SetReConnectParam(true, 30000, 500);
13    int inRecvErr[8] = {0.0};
14    int inCRCErr[8] = { 0.0 };
15    int inTransmitErr[8] = { 0.0 };
16    int inLinkErr[8] = { 0.0 };
17    int outRecvErr[8] = { 0.0 };
18    int outCRCErr[8] = { 0.0 };
19    int outTransmitErr[8] = { 0.0 };
20    int outLinkErr[8] = { 0.0 };
21    robot.GetSlavePortErrCounter(inRecvErr,  inCRCErr, inTransmitErr, inLinkErr,
22        outRecvErr, outCRCErr, outTransmitErr, outLinkErr);
23    for (int i = 0; i < 8; i++)
24    {
25        if (inRecvErr[i] != 0)
26        {
27            printf("inRecvErr %d is %d\n", i, inRecvErr[i]);
28        }
29        if (inCRCErr[i] != 0)
30        {
31            printf("inRecvErr %d is %d\n", i, inCRCErr[i]);
32        }
33        if (inTransmitErr[i] != 0)
34        {
35            printf("inRecvErr %d is %d\n", i, inTransmitErr[i]);
36        }
37        if (inLinkErr[i] != 0)
38        {
39            printf("inRecvErr %d is %d\n", i, inLinkErr[i]);
40        }
41        if (outRecvErr[i] != 0)
42        {
43            printf("outRecvErr %d is %d\n", i, outRecvErr[i]);
44        }
45        if (outCRCErr[i] != 0)
46        {
47            printf("outCRCErr %d is %d\n", i, outCRCErr[i]);
48        }
49        if (outTransmitErr[i] != 0)
50        {
51            printf("outTransmitErr %d is %d\n", i, outTransmitErr[i]);
52        }
53        if (outLinkErr[i] != 0)
54        {
55            printf("outLinkErr %d is %d\n", i, outLinkErr[i]);
56        }
57    }
58    printf("others has no err!\n");
59    for (int i = 0; i < 8; i++)
60    {
61        robot.SlavePortErrCounterClear(i);
62    }
63    robot.CloseRPC();
64    return 0;
65}

6.62. Set feed-forward coefficients for each axis

1/**
2* @brief Set feed-forward coefficients for each axis
3* @param [in] radio Feed-forward coefficient of velocity of each axis
4* @return error code
5*/
6errno_t SetVelFeedForwardRatio(double radio[6]);

6.63. Obtain the feed-forward coefficients of each axis

1/**
2* @brief Obtain the feed-forward coefficients of each axis
3* @param [out] radio Feed-forward coefficient of velocity of each axis
4* @return error code
5*/
6errno_t GetVelFeedForwardRatio(double radio[6]);

6.64. Example of robot velocity feed-forward coefficient code

 1int TestVelFeedForwardRatio()
 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 0;
11    }
12    robot.SetReConnectParam(true, 30000, 500);
13    double setRadio[6] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
14    robot.SetVelFeedForwardRatio(setRadio);
15    double getRadio[6] = { 0.0 };
16    robot.GetVelFeedForwardRatio(getRadio);
17    printf(" %f %f %f %f %f %f\n", getRadio[0], getRadio[1], getRadio[2], getRadio[3], getRadio[4], getRadio[5]);
18    robot.CloseRPC();
19    return 0;
20}

6.65. Photoelectric Sensor TCP Calibration - Compute Tool RPY

 1/**
 2* @brief Photoelectric Sensor TCP Calibration - Compute Tool RPY
 3* @param [in] Btool Robot Cartesian position
 4* @param [in] Etool Current tool coordinate values
 5* @param [in] sensor Current sensor coordinate values (not yet available)
 6* @param [in] radius Circular motion radius in mm (not yet available)
 7* @param [in] dz Movement distance along the negative Z-axis of the base coordinate system; when dz = 10000, the function directly returns tool RPY
 8* @param [out] TCPRPY Tool RPY values
 9* @return Error code
10*/
11errno_t TCPComputeRPY(DescPose Btool, DescPose Etool, DescPose sensor, double radius, double dz, Rpy& TCPRPY);

6.66. Photoelectric Sensor TCP Calibration - Compute Tool XYZ

 1/**
 2* @brief Photoelectric Sensor TCP Calibration - Compute Tool XYZ
 3* @param [in] select 0-Compute tool TCP; 1-Compute sensor origin; 2-Compute sensor orientation; 3-Directly return tool TCP; 4-Record current workpiece coordinate system and tool coordinate system
 4* @param [in] originDirection 0-X direction; 1-Y direction; 2-Z direction
 5* @param [in] pos1 Robot Cartesian position 1
 6* @param [in] pos2 Robot Cartesian position 2
 7* @param [in] pos3 Robot Cartesian position 3
 8* @param [in] pos4 Robot Cartesian position 4
 9* @param [out] TCP Tool XYZ values
10* @return Error code
11*/
12errno_t TCPComputeXYZ(int select, double originDirection, DescTran pos1, DescTran pos2, DescTran pos3, DescTran pos4, DescTran& TCP);

6.67. Photoelectric Sensor TCP Calibration - Start Recording Flange Center Position

1/**
2* @brief Photoelectric Sensor TCP Calibration - Start Recording Flange Center Position
3* @return Error code
4*/
5errno_t TCPRecordFlangePosStart();

6.68. Photoelectric Sensor TCP Calibration - Stop Recording Flange Center Position

1/**
2* @brief Photoelectric Sensor TCP Calibration - Stop Recording Flange Center Position
3* @return Error code
4*/
5errno_t TCPRecordFlangePosEnd();

6.69. Photoelectric Sensor TCP Calibration - Get Tool Center Point Position

1/**
2* @brief Photoelectric Sensor TCP Calibration - Get Tool Center Point Position
3* @param [out] TCP Tool center point position (x, y, z)
4* @return Error code
5*/
6errno_t TCPGetRecordFlangePos(DescTran& TCP);

6.70. Photoelectric Sensor TCP Calibration

1/**
2* @brief Photoelectric Sensor TCP Calibration
3* @param [in] luaPath Automatic calibration Lua program path: For QX version robots - "/fruser/FR_CalibrateTheToolTcp.lua"; For LA version robots - "/usr/local/etc/controller/lua/FR_CalibrateTheToolTcp.lua"
4* @param [in] offsetX Teaching point offset (x, y, z) in mm
5* @param [out] TCP Calibrated tool coordinate system (x, y, z, rx, ry, rz)
6* @return Error code
7*/
8errno_t PhotoelectricSensorTCPCalibration(std::string luaPath, DescTran offset, DescPose& TCP);

6.71. Photoelectric Sensor TCP Calibration Code Example

 1int TestPhotoelectricSensorTCPCalib(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 0;
11    }
12    robot.SetReConnectParam(true, 30000, 500);
13    DescTran offset = { 10.0, 10.0, 3.0 };
14    DescPose TCP = {};
15    rtn = robot.PhotoelectricSensorTCPCalibration("/fruser/FR_CalibrateTheToolTcp.lua", offset, TCP);
16    printf("PhotoelectricSensorTCPCalibration rtn is  %d %f %f %f %f %f %f \n", rtn, TCP.tran.x, TCP.tran.y, TCP.tran.z, TCP.rpy.rx, TCP.rpy.ry, TCP.rpy.rz);
17    robot.CloseRPC();
18    robot.Sleep(9999999);
19    return 0;
20}