3. SDK Function Introduction
Interface call return value type:
1typedef enum _ARMErrorCode {
2} ARMErrorCode;
3.1. Introduction to the Robotic Arm SDK Functions
3.1.1. Instantiate the robotic arm
1/**
2* @brief Instantiates a robotic arm
3* @param [in] robotype Robotic arm model
4* @param [in] robotname Single arm, left arm, or right arm
5* @param [in] DHCompensations DH parameter compensation values for the robotic arm
6**/
7SingleRobot(int robotype, RobotName robotname, double DHCompensations[28] = nullptr);
3.1.2. Turn off the robotic arm
1/**
2 * @brief Close the robotic arm
3 **/
4~SingleRobot();
3.1.3. Joint-space motion
1/**
2* @brief Joint-space motion
3* @param [in] destJointPos Target joint positions in degrees
4* @param [in] velocity Velocity percentage, range [0–100]
5* @param [in] acceleration Acceleration percentage, range [0–100]; currently not supported
6* @param [out] errMsg Error message string
7* @return Error code
8**/
9ARMErrorCode MoveJ(double* destJointPos, double velocity, double acceleration, char errMsg[1024]);
3.1.4. Joint-Space Motion Code Example – Single Arm
1int MoveJTest()
2{
3 SingleRobot robot(SingleRobot::ART3_R7, SingleRobot::LeftArm); // Instantiate the robotic arm
4
5 // Target joint position data
6 double j1_left[7] = {10, 10, 10, 10, 10, -10, 10}; // Joint position data is for reference only
7 double velocity = 20;
8 double acceleration = 20;
9 robot.SetSpeed(10); // Set maximum motion speed
10 robot.SetAccScale(10); // Set motion acceleration
11 char errMsg[1024];
12 ARMErrorCode rtnCode = robot.MoveJ(j1_left, velocity, acceleration, errMsg);
13 if (rtnCode != ARMErrorCode::Success)
14 {
15 return -1;
16 }
17 // Check whether motion is complete
18 while(true)
19 {
20 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
21 uint8_t state;
22 robot.GetRobotMotionDone(state);
23 if (state == 1)
24 {
25 break;
26 }
27 }
28 printf("moveJ error code: %d\n", rtnCode);
29
30 return 0;
31}
3.1.5. Joint-Space Motion Code Example – Dual-Arm
1int MoveJTest2()
2{
3 SingleRobot robot_left(SingleRobot::ART3_R7, SingleRobot::LeftArm); // Instantiate left robotic arm
4 SingleRobot robot_right(SingleRobot::ART3_R7, SingleRobot::RightArm); // Instantiate right robotic arm
5
6 // Target joint position data
7 double j1_left[7] = {10, 10, 10, 10, 10, -10, 10};
8 double j1_right[7] = {10, 10, 10, 10, 10, -10, 10};
9 double velocity = 20;
10 double acceleration = 20;
11 robot_left.SetSpeed(10); // Set maximum motion speed
12 robot_left.SetAccScale(10); // Set motion acceleration
13 robot_right.SetSpeed(10); // Set maximum motion speed
14 robot_right.SetAccScale(10); // Set motion acceleration
15 char errMsg[1024];
16 ARMErrorCode rtnCode = robot_left.MoveJ(j1_left, velocity, acceleration, errMsg);
17 if (rtnCode != ARMErrorCode::Success)
18 {
19 return -1;
20 }
21 memset(errMsg, 0, 1024);
22 rtnCode = robot_right.MoveJ(j1_right, velocity, acceleration, errMsg);
23 if (rtnCode != ARMErrorCode::Success)
24 {
25 return -1;
26 }
27 // Check whether motion is complete
28 uint8_t state_left = 0;
29 uint8_t state_right = 0;
30 while(true)
31 {
32 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
33
34 robot_left.GetRobotMotionDone(state_left);
35 robot_right.GetRobotMotionDone(state_right);
36 if (state_left == 1 && state_right == 1)
37 {
38 break;
39 }
40 }
41 printf("moveJ errorcode: %d\n", rtnCode);
42
43 return 0;
44}
3.1.6. Cartesian space point-to-point motion
1/**
2* @brief Cartesian space point-to-point motion
3* @param [in] destCartPos Target Cartesian pose [mm, deg]
4* @param [in] destArmAngle Target arm angle in degrees
5* @param [in] velocity Velocity percentage, range [0–100]
6* @param [in] acceleration Acceleration percentage, range [0–100]; currently not supported
7* @param [out] errMsg Error message string
8* @return Error code
9**/
10ARMErrorCode MoveP(double* destCartPos, double destArmAngle, double velocity, double acceleration, char errMsg[1024]);
3.1.7. Linear motion in Cartesian space
1/**
2* @brief Cartesian space linear motion
3* @param [in] destCartPos Target Cartesian pose [mm, deg]
4* @param [in] destArmAngle Target arm angle in degrees
5* @param [in] velocity Velocity percentage, range [0–100]
6* @param [in] acceleration Acceleration percentage, range [0–100]; currently not supported
7* @param [out] errMsg Error message string
8* @return Error code
9**/
10ARMErrorCode MoveL(double* destCartPos, double destArmAngle, double velocity, double acceleration, char errMsg[1024]);
3.1.8. Cartesian Space Linear Motion Code Example – Single Arm
1int MoveLTest()
2{
3 SingleRobot robot(SingleRobot::ART3_R7, SingleRobot::LeftArm); // Instantiate the robotic arm
4
5 // Cartesian-space linear motion trajectory planning
6 double j0_left[7] = {10, 10, 10, 10, 10, -10, 10};
7 double desc_pos1_left[6] = {148.545536, 14.373573, 791.612359, 14.266475, 4.332141, 29.863598};
8 double armAngle1_left = 351.959826;
9 double velocity = 20;
10 double acceleration = 20;
11 robot.SetSpeed(10); // Set maximum motion speed
12 robot.SetAccScale(10); // Set motion acceleration
13 char errMsg[1024];
14 ARMErrorCode rtnCode = robot.MoveJ(j0_left, velocity, acceleration, errMsg); // Move to the starting point of the linear trajectory
15 if (rtnCode != ARMErrorCode::Success)
16 {
17 return -1;
18 }
19 // Check whether motion is complete
20 while(true)
21 {
22 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
23 uint8_t state;
24 robot.GetRobotMotionDone(state);
25 if (state == 1)
26 {
27 break;
28 }
29 }
30
31 memset(errMsg, 0, 1024);
32 rtnCode = robot.MoveL(desc_pos1_left, armAngle1_left, velocity, acceleration, errMsg);
33 if (rtnCode != ARMErrorCode::Success)
34 {
35 return -1;
36 }
37 // Check whether motion is complete
38 while(true)
39 {
40 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
41 uint8_t state;
42 robot.GetRobotMotionDone(state);
43 if (state == 1)
44 {
45 break;
46 }
47 }
48 printf("moveL errorcode: %d\n", rtnCode);
49
50 return 0;
51}
3.1.9. Cartesian Space Linear Motion Code Example – Dual-Arm
1int MoveLTest2()
2{
3 SingleRobot robot_left(SingleRobot::ART3_R7, SingleRobot::LeftArm); // Instantiate left robotic arm
4 SingleRobot robot_right(SingleRobot::ART3_R7, SingleRobot::RightArm); // Instantiate right robotic arm
5
6 // Cartesian-space linear motion trajectory planning
7 double j0_left[7] = {10, 10, 10, 10, 10, -10, 10};
8 double j0_right[7] = {10, 10, 10, 10, 10, -10, 10};
9 double desc_pos1_left[6] = {148.545536, 14.373573, 791.612359, 14.266475, 4.332141, 29.863598};
10 double armAngle1_left = 351.959826;
11 double desc_pos1_right[6] = {148.545536, 14.373573, 791.612359, 14.266475, 4.332141, 29.863598};
12 double armAngle1_right = 351.959826;
13 double velocity = 20;
14 double acceleration = 20;
15 robot_left.SetSpeed(10); // Set maximum motion speed
16 robot_left.SetAccScale(10); // Set motion acceleration
17 robot_right.SetSpeed(10); // Set maximum motion speed
18 robot_right.SetAccScale(10); // Set motion acceleration
19 char errMsg[1024];
20
21 // Move both arms to the start point of the linear trajectory
22 ARMErrorCode rtnCode = robot_left.MoveJ(j0_left, velocity, acceleration, errMsg);
23 if (rtnCode != ARMErrorCode::Success)
24 {
25 return -1;
26 }
27 memset(errMsg, 0, 1024);
28 rtnCode = robot_right.MoveJ(j0_right, velocity, acceleration, errMsg);
29 if (rtnCode != ARMErrorCode::Success)
30 {
31 return -1;
32 }
33 // Check whether motion is complete
34 uint8_t state_left = 0;
35 uint8_t state_right = 0;
36 while(true)
37 {
38 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
39 robot_left.GetRobotMotionDone(state_left);
40 robot_right.GetRobotMotionDone(state_right);
41 if (state_left == 1 && state_right == 1)
42 {
43 break;
44 }
45 }
46
47 memset(errMsg, 0, 1024);
48 rtnCode = robot_left.MoveL(desc_pos1_left, armAngle1_left, velocity, acceleration, errMsg);
49 if (rtnCode != ARMErrorCode::Success)
50 {
51 return -1;
52 }
53 memset(errMsg, 0, 1024);
54 rtnCode = robot_right.MoveL(desc_pos1_right, armAngle1_right, velocity, acceleration, errMsg);
55 if (rtnCode != ARMErrorCode::Success)
56 {
57 return -1;
58 }
59 // Check whether motion is complete
60 state_left = 0;
61 state_right = 0;
62 while(true)
63 {
64 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
65 robot_left.GetRobotMotionDone(state_left);
66 robot_right.GetRobotMotionDone(state_right);
67 if (state_left == 1 && state_right == 1)
68 {
69 break;
70 }
71 }
72 printf("moveL errorcode: %d\n", rtnCode);
73
74 return 0;
75}
3.1.10. Circular Arc Motion in Cartesian Space
1/**
2* @brief Cartesian space circular arc motion
3* @param [in] midCartPos Cartesian pose of the midpoint, units: [mm, deg]
4* @param [in] midArmAngle Arm angle of the robotic arm at the midpoint, units: deg
5* @param [in] destCartPos Cartesian pose of the destination point, units: [mm, deg]
6* @param [in] destArmAngle Arm angle of the robotic arm at the destination point, units: deg
7* @param [in] velocity Velocity percentage, range: [0–100]
8* @param [in] acceleration Acceleration percentage, range: [0–100]; currently not supported
9* @param [out] errMsg Error message output
10* @return Error code
11**/
12ARMErrorCode MoveC(double* midCartPos, double midArmAngle, double* destCartPos, double destArmAngle, double velocity, double acceleration, char errMsg[1024]);
3.1.11. Cartesian Space Arc Motion Code Example – Single Arm
1int MoveCTest()
2{
3 SingleRobot robot(SingleRobot::ART3_R7, SingleRobot::LeftArm); // Instantiate the robotic arm
4
5 // Position data for the arc trajectory: start point, intermediate point, and target point
6 double desc_pos1_left[6] = {148.545536, 14.373573, 791.612359, 14.266475, 4.332141, 29.863598};
7 double armAngle1_left = 351.959826;
8 double desc_pos2_left[6] = {237.686578, 36.090539, 763.929631, 16.922444, 13.941801, 30.475488};
9 double armAngle2_left = 352.413796;
10 double desc_pos3_left[6] = {321.576660, 56.804783, 723.049930, 19.871510, 23.501873, 31.687545};
11 double armAngle3_left = 352.574131;
12 double velocity = 10;
13 double acceleration = 10;
14 robot.SetSpeed(10); // Set maximum motion speed
15 robot.SetAccScale(10); // Set motion acceleration
16
17 // Move to the arc trajectory’s starting point
18 char errMsg[1024];
19 ARMErrorCode rtnCode = robot.MoveP(desc_pos1_left, armAngle1_left, velocity, acceleration, errMsg);
20 if (rtnCode != ARMErrorCode::Success)
21 {
22 return -1;
23 }
24 // Check whether motion is complete
25 while(true)
26 {
27 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
28 uint8_t state;
29 robot.GetRobotMotionDone(state);
30 if (state == 1)
31 {
32 break;
33 }
34 }
35 printf("moveJ errorcode: %d\n", rtnCode);
36
37 // Cartesian-space arc trajectory planning
38 memset(errMsg, 0, 1024);
39 rtnCode = robot.MoveC(desc_pos2_left, armAngle2_left, desc_pos3_left, armAngle3_left, velocity, acceleration, errMsg);
40 if (rtnCode != ARMErrorCode::Success)
41 {
42 return -1;
43 }
44 // Check whether motion is complete
45 while(true)
46 {
47 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
48 uint8_t state;
49 robot.GetRobotMotionDone(state);
50 if (state == 1)
51 {
52 break;
53 }
54 }
55 printf("moveC errorcode: %d\n", rtnCode);
56
57 return 0;
58}
3.1.12. Cartesian Space Arc Motion Code Example – Dual-Arm
1int MoveCTest2()
2{
3 SingleRobot robot_left(SingleRobot::ART3_R7, SingleRobot::LeftArm); // Instantiate left robotic arm
4 SingleRobot robot_right(SingleRobot::ART3_R7, SingleRobot::RightArm); // Instantiate right robotic arm
5
6 // Position data for the arc’s start point, intermediate point, and target point
7 double desc_pos1_left[6] = {148.545536, 14.373573, 791.612359, 14.266475, 4.332141, 29.863598};
8 double armAngle1_left = 351.959826;
9 double desc_pos1_right[6] = {148.545536, 14.373573, 791.612359, 14.266475, 4.332141, 29.863598};
10 double armAngle1_right = 351.959826;
11 double desc_pos2_left[6] = {237.686578, 36.090539, 763.929631, 16.922444, 13.941801, 30.475488};
12 double armAngle2_left = 352.413796;
13 double desc_pos2_right[6] = {237.686578, 36.090539, 763.929631, 16.922444, 13.941801, 30.475488};
14 double armAngle2_right = 352.413796;
15 double desc_pos3_left[6] = {321.576660, 56.804783, 723.049930, 19.871510, 23.501873, 31.687545};
16 double armAngle3_left = 352.574131;
17 double desc_pos3_right[6] = {321.576660, 56.804783, 723.049930, 19.871510, 23.501873, 31.687545};
18 double armAngle3_right = 352.574131;
19 double velocity = 10;
20 double acceleration = 10;
21 robot_left.SetSpeed(10); // Set maximum motion speed
22 robot_left.SetAccScale(10); // Set motion acceleration
23 robot_right.SetSpeed(10); // Set maximum motion speed
24 robot_right.SetAccScale(10); // Set motion acceleration
25 char errMsg[1024];
26
27 // Move both arms to the arc trajectory’s starting point
28 ARMErrorCode rtnCode = robot_left.MoveP(desc_pos1_left, armAngle1_left, velocity, acceleration, errMsg);
29 if (rtnCode != ARMErrorCode::Success)
30 {
31 return -1;
32 }
33 memset(errMsg, 0, 1024);
34 rtnCode = robot_right.MoveP(desc_pos1_right, armAngle1_right, velocity, acceleration, errMsg);
35 if (rtnCode != ARMErrorCode::Success)
36 {
37 return -1;
38 }
39 // Check whether motion is complete
40 uint8_t state_left = 0;
41 uint8_t state_right = 0;
42 while(true)
43 {
44 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
45 robot_left.GetRobotMotionDone(state_left);
46 robot_right.GetRobotMotionDone(state_right);
47 if (state_left == 1 && state_right == 1)
48 {
49 break;
50 }
51 }
52
53 // Cartesian-space arc trajectory planning
54 memset(errMsg, 0, 1024);
55 rtnCode = robot_left.MoveC(desc_pos2_left, armAngle2_left, desc_pos3_left, armAngle3_left, velocity, acceleration, errMsg);
56 if (rtnCode != ARMErrorCode::Success)
57 {
58 return -1;
59 }
60 memset(errMsg, 0, 1024);
61 rtnCode = robot_right.MoveC(desc_pos2_right, armAngle2_right, desc_pos3_right, armAngle3_right, velocity, acceleration, errMsg);
62 if (rtnCode != ARMErrorCode::Success)
63 {
64 return -1;
65 }
66 // Check whether motion is complete
67 state_left = 0;
68 state_right = 0;
69 while(true)
70 {
71 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
72 robot_left.GetRobotMotionDone(state_left);
73 robot_right.GetRobotMotionDone(state_right);
74 if (state_left == 1 && state_right == 1)
75 {
76 break;
77 }
78 }
79 printf("moveC errorcode: %d\n", rtnCode);
80
81 return 0;
82}
3.1.13. Servo motion starts
1/**
2 * @brief Starts servo motion; used in conjunction with the ServoJ command.
3 * @return Error code
4 **/
5ARMErrorCode ServoMoveStart();
3.1.14. Servo motion ended
1/**
2 * @brief Ends servo motion; used in conjunction with the ServoJ command.
3 * @return Error code
4 */
5ARMErrorCode ServoMoveEnd();
3.1.15. Joint-space servo mode motion
1/**
2* @brief Servo motion in joint space
3* @param [in] jointPos Target joint positions, in degrees
4* @param [in] period Command transmission period, in milliseconds
5* @param [out] errMsg Error message output
6* @return Error code
7**/
8ARMErrorCode ServoJ(double* jointPos, int period, char errMsg[1024]);
3.1.16. Cartesian space servo motion
1/**
2* @brief Cartesian space servo motion
3* @param [in] servo_cartPos Cartesian servo motion trajectory points, formatted as [end-flange coordinate system position, RPY angles of the coordinate system, robot arm angle], with length 7*len and units [mm, deg, deg]
4* @param [in] len Number of Cartesian servo motion trajectory points
5* @param [out] errMsg Error message string
6* @return Error code
7**/
8ARMErrorCode ServoCart(double* servo_cartPos, uint32_t len, char errMsg[1024]);
3.1.17. Joint-space servo mode motion – single arm
1int ServoJTest()
2{
3 SingleRobot robot(SingleRobot::ART3_R7, SingleRobot::LeftArm); // Instantiate the robotic arm
4
5 // Target joint position information
6 double j1_left[7] = {10, 10, 10, 10, 10, -10, 10};
7 double velocity = 20;
8 double acceleration = 20;
9 robot.SetSpeed(10); // Set maximum motion speed
10 robot.SetAccScale(10); // Set motion acceleration
11 char errMsg[1024];
12 ARMErrorCode rtnCode = robot.MoveJ(j1_left, velocity, acceleration, errMsg);
13 // if (rtnCode != ARMErrorCode::Success)
14 // {
15 // return -1;
16 // }
17 // Check whether motion is complete
18 while(true)
19 {
20 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
21 uint8_t state;
22 robot.GetRobotMotionDone(state);
23 if (state == 1)
24 {
25 break;
26 }
27 }
28 printf("moveJ error code: %d\n", rtnCode);
29
30 int stepTime = 5; // ms
31 double speed = 5;
32 double runTime = 1.0; // s
33 int totalNum = static_cast<int>(runTime * 1000.0 / stepTime);
34 double nextJoint[7] = {0};
35
36 memset(errMsg, 0, 1024);
37 rtnCode = robot.ServoMoveStart();
38 if (rtnCode != ARMErrorCode::Success)
39 {
40 return -1;
41 }
42 for (int i = 0; i < totalNum; i++)
43 {
44 for (int j = 0; j < 7; j++)
45 {
46 nextJoint[j] = j1_left[j] + i * 1.0 / totalNum * speed;
47 }
48 rtnCode = robot.ServoJ(nextJoint, stepTime, errMsg);
49 if (rtnCode != ARMErrorCode::Success)
50 {
51 std::cout << static_cast<int>(rtnCode) << std::endl;
52 break;
53 }
54 }
55 printf("servoJ error code: %d\n", rtnCode);
56 rtnCode = robot.ServoMoveEnd();
57 if (rtnCode != ARMErrorCode::Success)
58 {
59 return -1;
60 }
61
62 return 0;
63}
3.1.18. Joint-space servo mode motion—dual-arm
1int ServoJTest2()
2{
3 std::thread th_left([]{
4 SingleRobot robot_left(SingleRobot::ART3_R7, SingleRobot::LeftArm); // Instantiate left arm
5 // Target joint position data
6 double j1_left[7] = {10, 10, 10, 10, 10, -10, 10};
7 double velocity = 20;
8 double acceleration = 20;
9 robot_left.SetSpeed(10); // Set maximum motion speed
10 robot_left.SetAccScale(10); // Set motion acceleration
11 char errMsg_l[1024];
12
13 ARMErrorCode rtnCode = robot_left.MoveJ(j1_left, velocity, acceleration, errMsg_l);
14 if (rtnCode != ARMErrorCode::Success)
15 {
16 return -1;
17 }
18 // Check whether motion is complete
19 uint8_t state_left = 0;
20 while(true)
21 {
22 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
23
24 robot_left.GetRobotMotionDone(state_left);
25 if (state_left == 1)
26 {
27 break;
28 }
29 }
30 printf("left arm moveJ errorcode: %d\n", rtnCode);
31
32 int stepTime = 5; // ms
33 double speed = 5;
34 double runTime = 1.0; // s
35 int totalNum = static_cast<int>(runTime * 1000.0 / stepTime);
36 double nextJoint[7] = {0};
37 ARMErrorCode rtnCode_l = robot_left.ServoMoveStart();
38 if (rtnCode_l != ARMErrorCode::Success)
39 {
40 std::cout << static_cast<int>(rtnCode_l) << std::endl;
41 robot_left.ServoMoveEnd();
42 return -1;
43 }
44 for (int i = 0; i < totalNum; i++)
45 {
46 for (int j = 0; j < 7; j++)
47 {
48 nextJoint[j] = j1_left[j] + i * 1.0 / totalNum * speed;
49 }
50 rtnCode_l = robot_left.ServoJ(nextJoint, stepTime, errMsg_l);
51 if (rtnCode_l != ARMErrorCode::Success)
52 {
53 break;
54 }
55 }
56 printf("servoJ errorcode: %d\n", rtnCode_l);
57 rtnCode_l = robot_left.ServoMoveEnd();
58 if (rtnCode_l != ARMErrorCode::Success)
59 {
60 return -1;
61 }
62 });
63 if (th_left.joinable())
64 {
65 th_left.join();
66 }
67
68 std::this_thread::sleep_for(std::chrono::microseconds(1000));
69 std::thread th_right([]{
70 SingleRobot robot_right(SingleRobot::ART3_R7, SingleRobot::RightArm); // Instantiate right arm
71 // Target joint position data
72 double j1_right[7] = {10, 10, 10, 10, 10, -10, 10};
73 double velocity = 20;
74 double acceleration = 20;
75 robot_right.SetSpeed(10); // Set maximum motion speed
76 robot_right.SetAccScale(10); // Set motion acceleration
77 char errMsg_r[1024];
78
79 ARMErrorCode rtnCode = robot_right.MoveJ(j1_right, velocity, acceleration, errMsg_r);
80 if (rtnCode != ARMErrorCode::Success)
81 {
82 return -1;
83 }
84 // Check whether motion is complete
85 uint8_t state_right = 0;
86 while(true)
87 {
88 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
89
90 robot_right.GetRobotMotionDone(state_right);
91 if (state_right == 1)
92 {
93 break;
94 }
95 }
96 printf("right arm moveJ errorcode: %d\n", rtnCode);
97
98 int stepTime = 5; // ms
99 double speed = 5;
100 double runTime = 1.0; // s
101 int totalNum = static_cast<int>(runTime * 1000.0 / stepTime);
102 double nextJoint[7] = {0};
103 ARMErrorCode rtnCode_r = robot_right.ServoMoveStart();
104 if (rtnCode_r != ARMErrorCode::Success)
105 {
106 std::cout << static_cast<int>(rtnCode_r) << std::endl;
107 robot_right.ServoMoveEnd();
108 return -1;
109 }
110 for (int i = 0; i < totalNum; i++)
111 {
112 for (int j = 0; j < 7; j++)
113 {
114 nextJoint[j] = j1_right[j] + i * 1.0 / totalNum * speed;
115 }
116 rtnCode_r = robot_right.ServoJ(nextJoint, stepTime, errMsg_r);
117 if (rtnCode_r != ARMErrorCode::Success)
118 {
119 break;
120 }
121 }
122 printf("servoJ errorcode: %d\n", rtnCode_r);
123 rtnCode_r = robot_right.ServoMoveEnd();
124 if (rtnCode_r != ARMErrorCode::Success)
125 {
126 return -1;
127 }
128 });
129 if (th_right.joinable())
130 {
131 th_right.join();
132 }
133
134 return 0;
135}
3.1.19. Stop exercising
1/**
2* @brief Stop motion
3* @return Error code
4**/
5ARMErrorCode StopMotion();
3.1.20. Pause exercise
1/**
2* @brief Pause motion
3* @return Error code
4**/
5ARMErrorCode PauseMotion();
3.1.21. Resume exercise
1/**
2* @brief Resumes motion
3* @return Error code
4**/
5ARMErrorCode ResumeMotion();
3.1.22. Clear motion command queue
1/**
2* @brief Clears the motion command queue.
3* @return Error code
4*/
5ARMErrorCode MotionQueueClear();
3.1.23. Multi-point joint-space motion
1/**
2* @brief Multi-point joint-space motion
3* @param [in] jointPos Joint positions, unit: deg
4* @param [in] pointNum Number of joint-space points
5* @param [in] velocity Velocity percentage, range: [0–100]
6* @param [in] acceleration Acceleration percentage, range: [0–100]; currently not supported
7* @param [out] errMsg Error message string
8* @return Error code
9**/
10ARMErrorCode MoveJ_path(double jointPos[256][7], uint8_t pointNum, double velocity, double acceleration, char errMsg[1024]);
3.1.24. Multi-point joint-space motion
1/**
2* @brief Multi-point Cartesian space motion
3* @param [in] cartPos Cartesian pose, unit: [mm, deg]
4* @param [in] armAngle Arm angle, unit: deg
5* @param [in] pointNum Number of joint-space points
6* @param [in] velocity Velocity percentage, range[0-100]
7* @param [in] acceleration Acceleration percentage, range[0-100], not available yet
8* @param [out] errMsg Error message printing
9* @return Error code
10**/
11ARMErrorCode MoveL_path(double cartPos[256][6], double armAngle[256], uint8_t pointNum, double velocity, double acceleration, char errMsg[1024]);
3.1.25. Robot Arm Returning to Home Position
1/**
2* @brief Home the robotic arm
3* @param [in] velocity Velocity percentage, range [0-100]
4* @param [in] acceleration Acceleration percentage, range [0-100] (currently not supported)
5* @param [out] errMsg Error message string
6* @return Error code
7**/
8ARMErrorCode RobotHoming(double velocity, double acceleration, char errMsg[1024]);
3.1.26. Jog Start
1/**
2* @brief Start JOG operation
3* @param [in] ref 0 - Joint JOG
4* @param [in] number Joint number: 1 - Joint 1, 2 - Joint 2, 3 - Joint 3, 4 - Joint 4, 5 - Joint 5, 6 - Joint 6, 7 - Joint 7
5* @param [in] dir Direction: 0 - Negative direction, 1 - Positive direction
6* @param [in] vel Velocity percentage, range [0–100]
7* @param [in] acc Acceleration percentage, range [0–100]; currently not supported
8* @param [in] max_dis Maximum single JOG angle, unit: deg
9* @param [out] errMsg Error message string
10* @return Error code
11**/
12ARMErrorCode StartJOG(uint8_t ref, uint8_t number, uint8_t dir, double vel, double acc, double max_dis, char errMsg[1024]);
3.1.27. Jogging ends
1/**
2* @brief Stop jogging
3* @return Error code
4**/
5ARMErrorCode StopJOG();
3.1.28. Start Singular Pose Protection
1/**
2 * @brief Start singularity avoidance protection
3 * @param [in] dist Singularity distance range, in mm
4 * @param [in] ang Singularity angle range, in deg
5 * @return Error code
6 */
7ARMErrorCode SingularAvoidStart(double dist, double ang);
3.1.29. Disable Singular Pose Protection
1/**
2* @brief Stop singularity avoidance protection
3* @return Error code
4**/
5ARMErrorCode SingularAvoidEnd();
3.1.30. Set Tool Coordinate System
1/**
2* @brief Sets the tool coordinate system
3* @param [in] toolNum Tool coordinate system ID, range: 1–19
4* @param [in] corrd Tool coordinate system {x, y, z, rx, ry, rz}, units: [mm, deg]
5* @return Error code
6**/
7ARMErrorCode SetToolCorrd(int toolNum, double* corrd);
3.1.31. Set robotic arm acceleration percentage
1/**
2* @brief Sets the acceleration percentage of the robotic arm.
3* @param [in] scale Acceleration percentage.
4* @return Error code.
5**/
6ARMErrorCode SetAccScale(double scale);
3.1.32. Set Global Speed Percentage
1/**
2* @brief Sets the global speed percentage.
3* @param [in] speed Speed percentage.
4* @return Error code.
5**/
6ARMErrorCode SetSpeed(double speed);
3.1.33. Forward Kinematics Solution
1/**
2* @brief Solves forward kinematics
3* @param [in] joint_val Joint positions, in degrees
4* @param [out] xyzrpy Cartesian pose
5* @param [out] arm_angle Robotic arm angle
6* @return Error code
7**/
8ARMErrorCode GetForwardKin(double* joint_val, double* desc_pos, double& arm_angle);
3.1.34. Inverse Kinematics Solution
1/**
2 * @brief Solves inverse kinematics
3 * @param [in] trans End-effector Cartesian pose, units: [mm, deg]
4 * @param [in] arm_angle Arm angle of the robotic arm, units: deg
5 * @param [out] joint_val Joint positions, units: deg
6 * @return Error code
7 **/
8ARMErrorCode GetInverseKin(double* desc_pos, double arm_angle, double* joint_val);
3.1.35. Inverse Kinematics Solution (Reference Position)
1/**
2* @brief Solves inverse kinematics with reference to a specified joint position.
3* @param [in] trans Cartesian pose of the end-effector, units: [mm, deg]
4* @param [in] arm_angle Arm angle of the robotic arm, units: deg
5* @param [in] ref_joint_val Reference joint positions, units: deg
6* @param [out] joint_val Joint positions, units: deg
7* @return Error code
8**/
9ARMErrorCode GetInverseKinRef(double* desc_pos, double arm_angle, double* ref_joint_val, double* joint_val);
3.1.36. Get current joint position (angle)
1/**
2* @brief Gets the current joint positions (angles).
3* @param [out] joint_pos: Joint positions in degrees [deg].
4* @return Error code.
5**/
6ARMErrorCode GetActualJointPosDegree(double joint_pos[7]);
3.1.37. Obtain the current tool pose
1/**
2* @brief Gets the current tool pose
3* @param [out] pose, units [mm, deg]
4* @return Error code
5**/
6ARMErrorCode GetActualTCPPose(double pose[6]);
3.1.38. Check whether the robotic arm movement is completed
1/**
2* @brief Checks whether the robotic arm's motion is complete.
3* @param [out] state: 0 - incomplete, 1 - complete
4* @return Error code
5**/
6ARMErrorCode GetRobotMotionDone(uint8_t& state);
3.1.39. Get current end-effector velocity
1/**
2* @brief Gets the current end-effector speed.
3* @param [out] eeVal: speed values, in units of [mm/s, deg/s]
4* @return Error code
5**/
6ARMErrorCode GetActualToolFlangeSpeed(double eeVal[6]);
3.1.40. Obtain joint torque
1/**
2* @brief Gets the joint torques.
3* @param [out] torques: Torques in Nm.
4* @return Error code.
5**/
6ARMErrorCode GetJointTorques(double torques[7]);
3.1.41. Obtain joint actuator torque
1/**
2* @brief Gets the joint driver torque.
3* @param [out] torques: Torque values in Nm.
4* @return Error code.
5**/
6ARMErrorCode GetJointDriverTorque(double torques[7]);
3.1.42. Query Robot Error Codes
1/**
2* @brief Queries the robot error code.
3* @param [out] errCode The error code.
4* @return The error code.
5**/
6ARMErrorCode GetRobotErrorCode(unsigned int& errCode);
3.1.43. Check whether the robot is singular
1/**
2* @brief Gets the robot's singularity state.
3* @param [in] judgeDist Singularity distance threshold, in mm.
4* @param [in] judgeAng Singularity angle threshold, in degrees.
5* @param [out] state 0—non-singular; 1—singular.
6* @return Error code.
7**/
8ARMErrorCode GetRobotSingularState(double judgeDist, double judgeAng, uint8_t& state);
3.1.44. Obtain Robot DH Parameter Compensation Values
1/**
2* @brief Gets the robot's DH parameter compensation values.
3* @param [out] dh_theta Zero-position angles.
4* @param [out] dh_a Link offsets.
5* @param [out] dh_d Link lengths.
6* @param [out] dh_alpha Link twists.
7* @return Error code.
8**/
9ARMErrorCode GetDHCompensation(double dh_theta[7], double dh_a[7], double dh_d[7], double dh_alpha[7]);
3.1.45. Joint Enable
1/**
2* @brief Enables a joint.
3* @param [in] joint_id Joint index: 0 for all robot arm joints, 1–7 for corresponding individual joints.
4* @return Error code.
5**/
6ARMErrorCode AxisEnable(int joint_id);
3.1.46. Joint Disable
1/**
2* @brief Disables a joint.
3* @param [in] joint_id Joint index: 0 for all robotic arm joints, 1–7 for corresponding individual joints.
4* @return Error code.
5**/
6ARMErrorCode AxisDisable(int joint_id);
3.1.47. Joint Zero Calibration
1/**
2* @brief Perform joint zeroing calibration
3* @param [in] joint_id Joint index: 0 for all robotic arm joints, 1–7 for corresponding individual joints
4* @return Error code
5**/
6ARMErrorCode AxisZeroing(int joint_id);
3.1.48. Clear Controller Errors
1/**
2* @brief Clears controller errors
3* @return Error code
4**/
5ARMErrorCode AxisResetError();
3.1.49. Set Load Weight and Center of Gravity(OnlyJK2.0Robotic Arm Use)
1/**
2* @brief Sets the load weight and center of mass
3* @param [in] index Index in the load list, range: [0-19]
4* @param [in] weight Load weight, unit: kg
5* @param [in] centerOfMass Load center-of-mass coordinates, unit: mm
6* @return Error code
7**/
8ARMErrorCode SetLoadcoord(uint8_t index, double weight, double centerOfMass[3]);
3.1.50. Set joint friction compensation switch(onlyJK2.0manipulator use)
1/**
2* @brief Enables or disables joint friction compensation
3* @param [in] onOff Compensation switch: 0 - disabled, 1 - enabled
4* @return Error code
5**/
6ARMErrorCode FrictionCompensationOnOff(uint8_t onOff);
3.1.51. Set joint friction compensation coefficient(onlyJK2.0manipulator use)
1/**
2* @brief Sets the joint friction compensation coefficient
3* @param [in] value Friction compensation coefficient, range: [0, 1]
4* @return Error code
5**/
6ARMErrorCode SetFrictionValue(double value[7]);
3.1.52. Set robotic arm soft limit protection switch ( only JK2.0 robotic arm use )
1/**
2* @brief Enables or disables the robotic arm's soft limit protection.
3* @param [in] onOff Soft limit switch: 0 for disabled, 1 for enabled.
4* @return Error code.
5**/
6ARMErrorCode SetJointSoftLimitOnOff(uint8_t onOff);
3.1.53. Set current loop teaching drag ( only JK2.0 robotic arm use )
1/**
2 * @brief Sets the current-loop teaching mode.
3 * @param [in] enable Teaching mode enable flag: 0 - disabled, 1 - enabled.
4 * @param [in] mode Teaching method selection: 0 - current loop.
5 * @return Error code.
6 **/
7ARMErrorCode SetTeachMode(uint8_t enable, uint8_t mode = 0);
3.1.54. Set Joint Torque Force Sensor Drag Teaching ( Only JK2.0 Robotic Arm Use )
1/**
2* @brief Enables or disables joint torque sensor-based drag teaching.
3* @param [in] enable Drag teaching toggle: 0 = disabled, 1 = enabled.
4* @param [in] mode Drag teaching method selection: 0 = torque sensor.
5* @return Error code.
6**/
7ARMErrorCode SetJointSensorTeachMode(uint8_t enable, uint8_t mode=0);
3.1.55. Get whether in drag-teaching mode(OnlyJK2.0robot arm uses)
1/**
2* @brief Checks whether the system is in drag-teaching mode.
3* @param [out] mode Flag indicating drag mode: 0 - not in drag mode, 1 - in drag mode.
4* @return Error code.
5**/
6ARMErrorCode IsInDragTeach(uint8_t& mode);
3.1.56. Enable collision detection(onlyJK2.0for robotic arm use)
1/**
2* @brief Sets collision detection
3* @param [in] enable Collision detection enable flag: 0 - disabled, 1 - enabled
4* @param [in] mode Collision detection method selection: 0 - current loop
5* @return Error code
6**/
7ARMErrorCode SetCollisionDetectionMode(uint8_t enable, uint8_t mode);
3.1.57. Set Collision Level ( Only JK2.0 Robotic Arm Uses )
1/**
2* @brief Sets the anti-collision level
3* @param [in] level Anti-collision level, range: [1–10]
4* @return Error code
5**/
6ARMErrorCode SetAnticollision(uint8_t level[7]);
3.1.58. Set Collision Response Strategy(OnlyJK2.0Robot Arm Use)
1/**
2* @brief Sets the collision response strategy.
3* @param [in] strategy Collision response strategy: 0 - stop, 1 - gravity torque mode.
4* @return Error code.
5**/
6ARMErrorCode SetCollisionStrategy(uint8_t strategy);
3.1.59. Set Joint Torque Sensor Zero Calibration ( Only JK2.0 Robotic Arm Use )
1/**
2* @brief Sets the zero-point calibration for the joint torque sensor.
3* @param [in] joint_val Joint angles, unit: deg
4* @param [in] speed Speed percentage
5* @return Error code
6**/
7ARMErrorCode SetJointSensorZero(double joint_val[7], double speed);
3.1.60. Set Robot Installation Angle(OnlyJK2.0Robotic Arm Use)
1/**
2* @brief Sets the robot installation angle
3* @param [in] yangle Tilt angle, unit: deg
4* @param [in] zangle Rotation angle, unit: deg
5* @return Error code
6**/
7ARMErrorCode SetRobotInstallAngle(double yangle, double zangle);
3.1.61. Obtain robot installation angle(OnlyJK2.0manipulator use)
1/**
2* @brief Gets the robot installation angle
3* @param [in] yangle Tilt angle, unit: deg
4* @param [in] zangle Rotation angle, unit: deg
5* @return Error code
6**/
7ARMErrorCode GetRobotInstallAngle(double& yangle, double& zangle);
3.1.62. Obtain the current end-effector flange pose
1/**
2* @brief Gets the current tool flange pose.
3* @param [in] jointPos Current robotic arm joint positions, in degrees.
4* @param [out] fLangePos [Tool flange position, orientation, and arm angle], in units of [mm, degrees, degrees].
5* @return Error code.
6**/
7ARMErrorCode GetActualToolFlangePose(double jointPos[7], double fLangePos[7]);
3.1.63. Set the robotic arm’s positive limit
1/**
2* @brief Sets the positive limit for the robotic arm.
3* @param [in] limitPositive Positive joint limits, in degrees.
4* @return Error code.
5**/
6ARMErrorCode SetLimitPositive(double limitPositive[7]);
3.1.64. Set the mechanical arm’s negative limit
1/**
2* @brief Sets the negative limit for the robotic arm
3* @param [in] limitNegative Negative joint limits, in degrees
4* @return Error code
5**/
6ARMErrorCode SetLimitNegative(double limitNegative[7]);
3.1.65. Obtain joint soft limit angles
1/**
2* @brief Gets the soft limit angles of the robotic arm joints.
3* @param [out] limitNegative Negative joint limits, in degrees.
4* @param [out] limitPositive Positive joint limits, in degrees.
5* @return Error code.
6**/
7ARMErrorCode GetJointSoftLimitDeg(double limitNegative[7], double limitPositive[7]);
3.1.66. Retrieve the robotic arm firmware version
1/**
2* @brief Gets the robotic arm firmware version.
3* @param [out] driver1version Firmware version of driver 1.
4* @param [out] driver2version Firmware version of driver 2.
5* @param [out] driver3version Firmware version of driver 3.
6* @param [out] driver4version Firmware version of driver 4.
7* @param [out] driver5version Firmware version of driver 5.
8* @param [out] driver6version Firmware version of driver 6.
9* @param [out] driver7version Firmware version of driver 7.
10* @return Error code.
11**/
12ARMErrorCode GetFirmwareVersion(char driver1version[128], char driver2version[128], char driver3version[128], char driver4version[128], char driver5version[128], char driver6version[128], char driver7version[128]);
3.1.67. Robot Control Authority Settings
1/**
2* @brief Robot Control Authority Setting
3* @param [in] controlMode 0-SDKControl 1-ROS2Control
4* @return Error Code
5**/
6ARMErrorCode SetControlAuthority(uint8_t controlMode);
3.1.68. Acceleration Smooth Start
1/**
2* @brief Acceleration Smoothing Enabled
3* @return Error Code
4**/
5ARMErrorCode AccSmoothStart();
3.1.69. Acceleration smoothing disabled
1/**
2* @brief Acceleration Smoothing Off
3* @return Error Code
4**/
5ARMErrorCode AccSmoothEnd();
3.1.70. Specify joint to enter drag / position mode
1/**
2* @brief Specify joint to enter drag / position mode
3* @param [in] joint_id joint ID, range :1~7
4* @param [in] flag 0- position mode, 1- drag mode
5* @return error code
6**/
7ARMErrorCode SetJointDrag(uint8_t joint_id, uint8_t flag);
3.1.71. Set Workpiece Coordinate System
1/**
2* @brief Set Workpiece Coordinate System
3* @param [in] corrd Pose of Workpiece Coordinate System, Unit:[mm, deg]
4* @return Error Code
5**/
6ARMErrorCode SetWObjCorrd(double corrd[6]);
3.1.72. Set Joint Torque Sensor Drag Teaching Parameters
1/**
2* @brief Set Joint Torque Sensor Drag Teaching Parameters
3* @param [in] drag_level 0-Soft, 1-Medium, 2-Hard
4* @return Error Code
5**/
6ARMErrorCode SetJointSensorTeachModeParam(uint8_t drag_level);
3.1.73. Get Joint Actuator Temperature
1/**
2* @brief Get Joint Actuator Temperature
3* @param [out] temperature Joint actuator temperature, unit: °C
4* @return Error code
5**/
6ARMErrorCode GetJointDriverTemperature(double temperature[7]);
3.1.74. Return to Safe Point
1/**
2* @brief Return to Safe Point
3* @param [in] safePoint Safe Point Joint Position, Unit: : deg
4* @param [in] velocity Speed Percentage, Range: [0, 100]
5* @param [in] acc Acceleration Percentage, Range: [0, 100]
6* @return Error Code
7**/
8ARMErrorCode MoveToSafePoint(double safePoint[7], double velocity, double acc);
3.1.75. Force Sensor Activated
1/**
2* @brief Force Sensor Activated
3* @param [in] onOff 0-Reset 1-Activate
4* @return Error Code
5**/
6ARMErrorCode FT_Activate(uint8_t onOff);
3.1.76. Force Sensor Zeroing
1/**
2* @brief Force Sensor Zero Calibration
3* @param [in] joints Zero Calibration Joint Position, Unit: : deg
4* @param [in] velocity Speed Percentage, Range: [0, 100]
5* @param [in] acceleration Acceleration Percentage, Range: [0, 100]
6* @return Error Code
7**/
8ARMErrorCode FT_SetZero(double joints[7], double velocity, double acceleration);
3.1.77. Force Sensor Load Identification
1/**
2* @brief Force Sensor Load Identification
3* @param [in] joints Load Identification Position, Unit: deg
4* @param [in] velocity Speed Percentage, Range:[0, 100]
5* @param [in] acceleration Acceleration Percentage, Range:[0, 100]
6* @return Error Code
7**/
8ARMErrorCode FT_PdCogIden(double joints[3][7], double velocity, double acceleration);
3.1.78. Force Sensor Safety Inspection
1/**
2* @brief Force Sensor Safety Detection
3* @param [in] onOff Safety Detection Switch
4* @param [in] safeTime Safety Detection Time, Unit: ms
5* @return Error Code
6**/
7ARMErrorCode SetForceSensorSafetyInspection(uint8_t onOff, uint8_t safeTime);
3.1.79. Force Sensor Safety Detection Trigger Strategy
1/**
2* @brief Force Sensor Safety Detection Trigger Strategy
3* @param [in] tragger Safety Detection Trigger Strategy 0-Stop 1-Gravity Torque Mode
4* @return Error Code
5**/
6ARMErrorCode SetForceSensorSafetyTriggerStrategy(uint8_t tragger);
3.1.80. Set Force Sensor Coordinate System
1/**
2* @brief Set Force Sensor Coordinate System
3* @param [in] corrd Sensor coordinate system pose, unit:[mm, deg]
4* @return Error code
5**/
6ARMErrorCode SetForceSensorCorrd(double corrd[6]);
3.1.81. Set Force Sensor Safety Detection Threshold
1/**
2* @brief Set Force Sensor Safety Detection Threshold
3* @param [in] threshold Sensor Detection Threshold, Unit:
4* @return Error Code
5**/
6ARMErrorCode SetForceSensorThreshold(double threshold[6]);
3.1.82. Weak load identification initialization settings
1/**
2* @brief No force load identification initialization settings
3* @param [in] onOff Load identification switch,0-Off,1-On
4* @param [in] forceSource Source of force,0-Joint current,1-Torque sensor
5* @param [in] loadFlag 0-No load,1-With load
6* @return Error code
7**/
8ARMErrorCode LoadIdentifyInit(uint8_t onOff, uint8_t forceSource, uint8_t loadFlag);
3.1.83. Unpowered Load Identification Main Program
1/**
2* @brief No-force load identification main program
3* @param [in] joints Load identification point,unit: deg
4* @param [in] velocity Speed percentage,range:[0, 100]
5* @param [in] acceleration Acceleration percentage,range:[0, 100]
6* @param [in] loadFlag 0-No load,1-With load
7* @return Error code
8**/
9ARMErrorCode LoadIdentifyMain(double joints[9][7], double velocity, double acceleration, uint8_t loadFlag);
3.1.84. Get powerless load identification result
1/**
2* @brief obtain forceless payload identification result
3* @param [in] result payload identification result,result[0]: payload mass(kg) result[1]: payload centroidx(mm) result[2]: payload centroidy(mm) result[3]: payload centroidz(mm)
4* @return error code
5**/
6ARMErrorCode LoadIdentifyGetResult(double result[4]);
3.1.85. Activate gripper
1/**
2* @brief Activate gripper
3* @return Error code
4**/
5ARMErrorCode ActGripper();
3.1.86. Control gripper movement
1/**
2* @brief Control gripper movement
3* @param [in] position Position percentage
4* @param [in] speed Speed percentage
5* @param [in] force Force percentage
6* @return Error code
7**/
8ARMErrorCode MoveGripper(double position, double speed, double force);
3.1.87. Get whether gripper motion is completed
1/**
2* @brief Get whether gripper movement is completed
3* @param [out] motiontate 0-Moving,1-Movement completed
4* @return Error code
5**/
6ARMErrorCode GetGripperMotionDone(uint8_t &motionState);
3.1.88. Get Gripper Activation Status
1/**
2* @brief Get gripper activation status
3* @param [out] act 0-Not activated,1-Activated
4* @return Error code
5**/
6ARMErrorCode GetGripperActivateStatus(uint8_t &actState);
3.1.89. Get Gripper Position
1/**
2* @brief Get gripper position
3* @param [out] position Percentage
4* @return Error code
5**/
6ARMErrorCode GetGripperCurPosition(double &position);
3.1.90. Joint Space Impedance Control Enabled
1/**
2* @brief Joint space impedance control enabled
3* @param [in] forceSource 0-joint current 1-torque sensor
4* @param [in] forceThreshold trigger force threshold[30-150], unit: N
5* @param [in] m mass parameter
6* @param [in] b damping parameter
7* @param [in] k stiffness parameter
8* @param [in] maxVel maximum joint velocity
9* @param [in] maxAcc maximum joint acceleration
10* @param [in] maxAng maximum adjustment angle(Add)
11* @param [in] maxTor maximum limit torque(Add)
12* @return error code
13**/
14ARMErrorCode ImpedanceControlJointStart(int forceSource, double forceThreshold[7], double m[7], double b[7], double k[7], double maxVel[7], double maxAcc[7], double maxAng[7], double maxTor[7]);
3.1.91. Joint Space Impedance Control Off
1/**
2* @brief Joint space impedance control disabled
3* @return Error code
4**/
5ARMErrorCode ImpedanceControlJointEnd();
3.1.92. Cartesian Space Impedance Control Enabled
1/**
2* @brief Cartesian space impedance control enabled
3* @param [in] forceSource 0-six-axis force sensor 1-joint current
4* @param [in] forceThreshold trigger force threshold[30-150],unit: N
5* @param [in] m mass parameter
6* @param [in] b damping parameter
7* @param [in] k stiffness parameter
8* @param [in] maxV maximum linear velocity
9* @param [in] maxVA maximum linear acceleration
10* @param [in] maxW maximum angular velocity
11* @param [in] maxWA maximum angular acceleration
12* @param [in] maxDix maximum adjustment distance(Add)
13* @param [in] maxForce maximum force limit(Add)
14* @return error code
15**/
16ARMErrorCode ImpedanceControlCartStart(int forceSource, double forceThreshold[7], double m[7], double b[7], double k[7], double maxV, double maxVA, double maxW, double maxWA, double maxDix[6], double maxForce[6]);
3.1.93. Cartesian Space Impedance Control Off
1/**
2* @brief Cartesian space impedance control disabled
3* @return Error code
4**/
5ARMErrorCode ImpedanceControlCartEnd();
3.1.94. Variable Parameter Admittance Control Enabled
1/**
2* @brief Variable parameter admittance control enabled
3* @param [in] openDir Admittance function enabled direction[x y z rx ry rz] (0-not enabled,1-enabled) (rx ry rzAdmittance function temporarily not enabled,parameters are0)
4* @param [in] targetForce Desired force
5* @param [in] m Mass parameter
6* @param [in] b Damping parameter
7* @param [in] k Stiffness parameter
8* @param [in] maxDis Maximum adjustment distance, Range: (0, 1000],unit: mm
9* @param [in] maxAng Maximum adjustment angle, Range: (0, 90],unit: deg
10* @return Error code
11**/
12ARMErrorCode AdmittanceControlStart(uint8_t openDir[6], double targetForce[6], double m[6], double b[6], double k[6], double maxDis, double maxAng);
3.1.95. Variable Parameter Admittance Control Off
1/**
2* @brief Variable parameter admittance control disabled
3* @return Error code
4**/
5ARMErrorCode AdmittanceControlEnd();
3.1.96. Set Variable-Parameter Admittance Control Parameters
1/**
2* @brief Set variable parameter admittance control parameters
3* @param [in] m Mass parameter
4* @param [in] b Damping parameter
5* @param [in] k Stiffness parameter
6* @return Error code
7**/
8ARMErrorCode SetAdmittanceControlParam(double m[6], double b[6], double k[6]);
3.1.97. Contact Detection Enabled
1/**
2* @brief Contact detection enabled
3* @param [in] minVal Contact force lower limit(Relative value), range: (0 50](x, y, z), (0, 3](rx, ry, rz)
4* @param [in] maxVal Contact force upper limit(Relative value), range: (0 50](x, y, z), (0, 3](rx, ry, rz)
5* @return Error code
6**/
7ARMErrorCode ForceSensorContactDetectStart(double minVal[6], double maxVal[6]);
3.1.98. Contact Detection Off
1/**
2* @brief Contact detection off
3* @return Error code
4**/
5ARMErrorCode ForceSensorContactDetectEnd();
3.1.99. Configure Contact Detection Trigger Policy
1/**
2* @brief Set contact detection trigger strategy
3* @param [in] strategy contact detection strategy,0-Stop 1-Enter gravity torque mode
4* @return Error code
5**/
6ARMErrorCode SetContactDetectStrategy(uint8_t strategy);
3.1.100. Get Contact Detection Trigger Status
1/**
2* @brief Get contact detection trigger status
3* @param [out] state Contact detection status, 0-Not triggered 1-Triggered
4* @return Error code
5**/
6ARMErrorCode GetContactDetectState(uint8_t& state);
3.1.101. Speed feedforward function setting
1/**
2* @brief Speed feedforward function setting
3* @param [in] enable 0-Function disabled,1-Function enabled
4* @param [in] axis Axisid 1-Set 0-Not set
5* @return Error code
6**/
7ARMErrorCode SetVelForwardFeed(uint8_t enable, uint8_t axis[7]);
3.2. Introduction to Waist SDK Functions (When the Waist Joint Exists)
3.2.1. Instantiate waist
1/**
2 * @brief Instantiate the waist module
3 **/
4RobotWaist();
3.2.2. Close waist
1/**
2 * @brief Close the waist
3 **/
4~RobotWaist();
3.2.3. Joint-space motion
1/**
2* @brief Joint-space motion
3* @param [in] destJointPos Target joint positions in degrees
4* @param [in] velocity Velocity percentage, range [0–100]
5* @param [in] acceleration Acceleration percentage, range [0–100]; currently not supported
6* @param [out] errMsg Error message string
7* @return Error code
8**/
9ARMErrorCode MoveJ(double* destJointPos, double velocity, double acceleration, char errMsg[1024]);
3.2.4. Stop exercising
1/**
2* @brief Stop motion
3* @return Error code
4**/
5ARMErrorCode StopMotion();
3.2.5. Get current joint position (angle)
1/**
2* @brief Gets the current joint position (angle).
3* @param [out] joint_pos: Joint position in degrees [deg].
4* @return Error code.
5**/
6ARMErrorCode GetActualJointPosDegree(double* joint_pos);
3.2.6. Check whether the motion is completed
1/**
2@brief Query whether the motion is completed.
3* @param [out] state: 0 - not completed, 1 - completed
4* @return Error code
5**/
6ARMErrorCode GetRobotMotionDone(uint8_t& state);
3.2.7. Joint Enable
1/**
2* @brief Enables a joint.
3* @param [in] joint_id Joint index: 0 enables all waist joints; 1, 2, ... enable the corresponding waist joints.
4* @return Error code.
5**/
6ARMErrorCode AxisEnable(int joint_id);
3.2.8. Joint Disable
1/**
2* @brief Disables a joint.
3* @param [in] joint_id Joint index: 0 - disables all waist joints; 1, 2, ... - disables the corresponding waist joint.
4* @return Error code.
5**/
6ARMErrorCode AxisDisable(int joint_id);
3.2.9. Joint Zero Calibration
1/**
2* @brief Perform joint zero calibration
3* @param [in] joint_id Joint index: 0 - enable all waist joints; 1, 2, ... - corresponding waist joints
4* @return Error code
5**/
6ARMErrorCode AxisZeroing(int joint_id);
3.2.10. Clear Controller Errors
1/**
2* @brief Clears controller errors
3* @return Error code
4**/
5ARMErrorCode AxisResetError();
3.2.11. Set waist positive limit
1/**
2* @brief Sets the positive limit for the waist joint.
3* @param [in] limitPositive Positive joint limit, in degrees.
4* @return Error code.
5**/
6ARMErrorCode SetLimitPositive(double* limitPositive);
3.2.12. Set waist negative limit
1/**
2* @brief Sets the negative limit for the waist joint
3* @param [in] limitNegative Negative joint limit, in degrees
4* @return Error code
5**/
6ARMErrorCode SetLimitNegative(double* limitNegative);
3.2.13. Obtain joint soft limit angles
1/**
2* @brief Gets the soft limit angles of the waist joint.
3* @param [out] limitNegative Negative joint limit, in degrees.
4* @param [out] limitPositive Positive joint limit, in degrees.
5* @return Error code.
6**/
7ARMErrorCode GetJointSoftLimitDeg(double* limitNegative, double* limitPositive);
3.2.14. Set Waist Acceleration Percentage
1/**
2* @brief Sets the waist acceleration scale factor.
3* @param [in] scale Acceleration scale factor (as a percentage).
4* @return Error code.
5**/
6ARMErrorCode SetAccScale(double scale);
3.2.15. Set Waist Global Speed Percentage
1/**
2* @brief Sets the global speed percentage of the waist.
3* @param [in] speed Speed percentage.
4* @return Error code.
5**/
6ARMErrorCode SetSpeed(double speed);
3.2.16. Retrieve the robotic arm firmware version
1/**
2* @brief Retrieve Robotic Arm Firmware Version
3* @param [out] driverversion Driver1Firmware Version
4* @return Error Code
5**/
6ARMErrorCode GetFirmwareVersion(char driverversion[][128]);
3.2.17. Get Joint Actuator Temperature
1/**
2* @brief Get Joint Actuator Temperature
3* @param [out] temperature Joint actuator temperature, unit: °C
4* @return Error code
5**/
6ARMErrorCode GetJointDriverTemperature(double* temperature);
3.3. SDK Function Introduction for the Tool Section
3.3.1. Instantiate the utility class
1/**
2* @brief Instantiates the utility class
3**/
4RobotTool();
3.3.2. Close utility class
1/**
2* @brief Destroys the tool class object
3**/
4~RobotTool();
3.3.3. Establish communication with the robot controller
1/**
2 * @brief Establishes communication with the robot controller; default IP is 192.168.58.1
3 **/
4ARMErrorCode RPC(const char *ip, int port);
3.3.4. Disconnect communication with the robot controller
1/**
2 * @brief Closes the communication with the robot controller.
3 * @return Error code
4 */
5ARMErrorCode CloseRPC();
3.3.5. Obtain the communication status between the SDK and the robot
1/**
2 * @brief Gets the communication status between the SDK and the robot.
3 * @param [out] state 0 - Initializing; 1 - Connected; 2 - Disconnected.
4 * @return Error code.
5 */
6ARMErrorCode GetSDKComState(uint8_t& state);
3.3.6. Configure Robot
1/**
2* @brief Sets the robot configuration for the FAIRINO-ARTPlugin upgrade.
3* @param [in] mode 0 - Single-arm, 7-axis configuration; 1 - Dual-arm, 14-axis configuration; 2 - Dual-arm plus waist, 16-axis configuration.
4* @return Error code.
5**/
6ARMErrorCode RobotFrConfig(int mode);
3.3.7. Log Export
1/**
2* @brief Export logs
3* @return Error code
4**/
5ARMErrorCode RobotPackLog();
3.3.8. Data Recording
1/**
2* @brief Data recording
3* @param [in] state 1 - Start recording; 0 - Stop recording and export
4* @return Error code
5**/
6ARMErrorCode RobotRecordData(int state);
3.3.9. SDK Server Deployment
1/**
2* @brief SDK server-side deployment
3* @param [in] filepath Full path of the update package
4* @return Error code
5**/
6ARMErrorCode UpdateSDKServer(std::string filepath);
3.3.10. Retrieve SDK version information
1/**
2 * @brief Gets the SDK version information.
3 * @param [out] version The SDK version number.
4 * @return Error code.
5 **/
6ARMErrorCode GetSDKVersion(std::string& version);
3.3.11. SDK Server Deployment
1/**
2* @brief SDK server-side deployment
3* @param [in] filepath Full path of the update package
4* @return Error code
5**/
6ARMErrorCode UpdateSDKServer(std::string filepath);
3.3.12. Retrieve robot software version information
1/**
2* @brief Retrieves the robot software version information
3* @param [out] pluginVersion Plugin version
4* @param [out] sdkServerVersion SDK server version
5* @return Error code
6**/
7ARMErrorCode GetSoftwareVersion(std::string& pluginVersion, std::string& sdkServerVersion);
3.3.13. Restart Robot Operating System
1/**
2 * @brief Reboot the robot operating system
3 * @return Error code
4 **/
5ARMErrorCode robotSystemReboot();
3.3.14. Shut down Robot Operating System
1/**
2* @brief Shut down the robot operating system
3* @return Error code
4**/
5ARMErrorCode robotSystemShutDown();