8. Status query
8.1. Get Current Joint Positions (Degrees)
1/**
2* @brief Get current joint positions (degrees)
3* @param [in] flag 0-Blocking, 1-Non-blocking
4* @param [out] jPos Six joint positions, unit deg
5* @return Error code
6*/
7errno_t GetActualJointPosDegree(uint8_t flag, JointPos *jPos);
8.2. Get Joint Feedback Speed
1/**
2 * @brief Get joint feedback speed - deg/s
3 * @param [in] flag 0-Blocking, 1-Non-blocking
4 * @param [out] speed Six joint speeds
5 * @return Error code
6 */
7errno_t GetActualJointSpeedsDegree(uint8_t flag, float speed[6]);
8.3. Get Joint Feedback Acceleration
1/**
2 * @brief Get joint feedback acceleration - deg/s^2
3 * @param [in] flag 0-Blocking, 1-Non-blocking
4 * @param [out] acc Six joint accelerations
5 * @return Error code
6 */
7errno_t GetActualJointAccDegree(uint8_t flag, float acc[6]);
8.4. Get TCP Command Composite Speed
1/**
2 * @brief Get TCP command composite speed
3 * @param [in] flag 0-Blocking, 1-Non-blocking
4 * @param [out] tcp_speed Linear speed
5 * @param [out] ori_speed Orientation speed
6 * @return Error code
7 */
8errno_t GetTargetTCPCompositeSpeed(uint8_t flag, float *tcp_speed, float *ori_speed);
8.5. Get TCP Feedback Composite Speed
1/**
2 * @brief Get TCP feedback composite speed
3 * @param [in] flag 0-Blocking, 1-Non-blocking
4 * @param [out] tcp_speed Linear speed
5 * @param [out] ori_speed Orientation speed
6 * @return Error code
7 */
8errno_t GetActualTCPCompositeSpeed(uint8_t flag, float *tcp_speed, float *ori_speed);
8.6. Get TCP Command Speed
1/**
2 * @brief Get TCP command speed
3 * @param [in] flag 0-Blocking, 1-Non-blocking
4 * @param [out] speed [x,y,z,rx,ry,rz] speed
5 * @return Error code
6 */
7errno_t GetTargetTCPSpeed(uint8_t flag, float speed[6]);
8.7. Get TCP Feedback Speed
1/**
2 * @brief Get TCP feedback speed
3 * @param [in] flag 0-Blocking, 1-Non-blocking
4 * @param [out] speed [x,y,z,rx,ry,rz] speed
5 * @return Error code
6 */
7errno_t GetActualTCPSpeed(uint8_t flag, float speed[6]);
8.8. Get Current Tool Pose
1/**
2* @brief Get current tool pose
3* @param [in] flag 0-Blocking, 1-Non-blocking
4* @param [out] desc_pos Tool pose
5* @return Error code
6*/
7errno_t GetActualTCPPose(uint8_t flag, DescPose *desc_pos);
8.9. Get Current Tool Frame Number
1/**
2* @brief Get current tool frame number
3* @param [in] flag 0-Blocking, 1-Non-blocking
4* @param [out] id Tool frame number
5* @return Error code
6*/
7errno_t GetActualTCPNum(uint8_t flag, int *id);
8.10. Get Current Work Object Frame Number
1/**
2* @brief Get current work object frame number
3* @param [in] flag 0-Blocking, 1-Non-blocking
4* @param [out] id Work object frame number
5* @return Error code
6*/
7errno_t GetActualWObjNum(uint8_t flag, int *id);
8.11. Get Current End Flange Pose
1/**
2* @brief Get current end flange pose
3* @param [in] flag 0-Blocking, 1-Non-blocking
4* @param [out] desc_pos Flange pose
5* @return Error code
6*/
7errno_t GetActualToolFlangePose(uint8_t flag, DescPose *desc_pos);
8.12. Get Current Joint Torque
1/**
2* @brief Get current joint torque
3* @param [in] flag 0-Blocking, 1-Non-blocking
4* @param [out] torques Joint torque
5* @return Error code
6*/
7errno_t GetJointTorques(uint8_t flag, float torques[6]);
8.13. Get System Time
1/**
2* @brief Get system time
3* @param [out] t_ms Unit ms
4* @return Error code
5*/
6errno_t GetSystemClock(float *t_ms);
8.14. Check If Robot Motion Is Complete
1/**
2* @brief Check if robot motion is complete
3* @param [out] state 0-Not complete, 1-Complete
4* @return Error code
5*/
6errno_t GetRobotMotionDone(uint8_t *state);
8.15. Query Robot Motion Queue Length
1/**
2 * @brief Query robot motion queue length
3 * @param [out] len Queue length
4 * @return Error code
5 */
6errno_t GetMotionQueueLength(int *len);
8.16. Get Robot Emergency Stop Status
1/**
2* @brief Get robot emergency stop status
3* @param [out] state Emergency stop status, 0-Normal, 1-Emergency stop
4* @return Error code
5*/
6errno_t GetRobotEmergencyStopState(uint8_t *state);
8.17. Get SDK-Robot Communication Status
1/**
2* @brief Get SDK-robot communication status
3* @param [out] state Communication status, 0-Normal, 1-Abnormal
4*/
5errno_t GetSDKComState(int *state);
8.18. Get Safety Stop Signal
1/**
2* @brief Get safety stop signal
3* @param [out] si0_state Safety stop signal SI0, 0-Invalid, 1-Valid
4* @param [out] si1_state Safety stop signal SI1, 0-Invalid, 1-Valid
5*/
6errno_t GetSafetyStopState(uint8_t *si0_state, uint8_t *si1_state);
8.19. Get Robot Joint Driver Temperature(℃)
Added in version C++SDK-v2.1.5.0.
1/**
2* @brief Get robot joint driver temperature(℃)
3* @return Error code
4*/
5errno_t GetJointDriverTemperature(double temperature[]);
8.20. Get Robot Joint Driver Torque(Nm)
Added in version C++SDK-v2.1.5.0.
1/**
2* @brief Get robot joint driver torque(Nm)
3* @return Error code
4*/
5errno_t GetJointDriverTorque(double torque[]);
8.21. Get Robot Real-time Status Structure
Added in version C++SDK-v2.1.3.0.
1/**
2* @brief Get robot real-time status structure
3* @param [out] pkg Robot real-time status structure
4* @return Error code
5*/
6errno_t GetRobotRealTimeState(ROBOT_STATE_PKG *pkg);
8.22. Robot Status Query Code Example
1int TestGetStatus(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 float yangle, zangle;
14 robot.GetRobotInstallAngle(&yangle, &zangle);
15 printf("yangle:%f,zangle:%f\n", yangle, zangle);
16 JointPos j_deg = {};
17 robot.GetActualJointPosDegree(0, &j_deg);
18 printf("joint pos deg:%f,%f,%f,%f,%f,%f\n", j_deg.jPos[0], j_deg.jPos[1], j_deg.jPos[2], j_deg.jPos[3], j_deg.jPos[4], j_deg.jPos[5]);
19 float jointSpeed[6] = { 0.0 };
20 robot.GetActualJointSpeedsDegree(0, jointSpeed);
21 printf("joint speeds deg:%f,%f,%f,%f,%f,%f\n", jointSpeed[0], jointSpeed[1], jointSpeed[2], jointSpeed[3], jointSpeed[4], jointSpeed[5]);
22 float jointAcc[6] = { 0.0 };
23 robot.GetActualJointAccDegree(0, jointAcc);
24 printf("joint acc deg:%f,%f,%f,%f,%f,%f\n", jointAcc[0], jointAcc[1], jointAcc[2], jointAcc[3], jointAcc[4], jointAcc[5]);
25 float tcp_speed = 0.0;
26 float ori_speed = 0.0;
27 robot.GetTargetTCPCompositeSpeed(0, &tcp_speed, &ori_speed);
28 printf("GetTargetTCPCompositeSpeed tcp %f; ori %f\n", tcp_speed, ori_speed);
29 robot.GetActualTCPCompositeSpeed(0, &tcp_speed, &ori_speed);
30 printf("GetActualTCPCompositeSpeed tcp %f; ori %f\n", tcp_speed, ori_speed);
31 float targetSpeed[6] = { 0.0 };
32 robot.GetTargetTCPSpeed(0, targetSpeed);
33 printf("GetTargetTCPSpeed %f,%f,%f,%f,%f,%f\n", targetSpeed[0], targetSpeed[1], targetSpeed[2], targetSpeed[3], targetSpeed[4], targetSpeed[5]);
34 float actualSpeed[6] = { 0.0 };
35 robot.GetActualTCPSpeed(0, actualSpeed);
36 printf("GetTargetTCPSpeed %f,%f,%f,%f,%f,%f\n", actualSpeed[0], actualSpeed[1], actualSpeed[2], actualSpeed[3], actualSpeed[4], actualSpeed[5]);
37 DescPose tcp = {};
38 robot.GetActualTCPPose(0, &tcp);
39 printf("tcp pose:%f,%f,%f,%f,%f,%f\n", tcp.tran.x, tcp.tran.y, tcp.tran.z, tcp.rpy.rx, tcp.rpy.ry, tcp.rpy.rz);
40 DescPose flange = {};
41 robot.GetActualToolFlangePose(0, &flange);
42 printf("flange pose:%f,%f,%f,%f,%f,%f\n", flange.tran.x, flange.tran.y, flange.tran.z, flange.rpy.rx, flange.rpy.ry, flange.rpy.rz);
43 int id = 0;
44 robot.GetActualTCPNum(0, &id);
45 printf("tcp num:%d\n", id);
46 robot.GetActualWObjNum(0, &id);
47 printf("wobj num:%d\n", id);
48 float jtorque[6] = { 0.0 };
49 robot.GetJointTorques(0, jtorque);
50 printf("torques:%f,%f,%f,%f,%f,%f\n", jtorque[0], jtorque[1], jtorque[2], jtorque[3], jtorque[4], jtorque[5]);
51 float t_ms = 0.0;
52 robot.GetSystemClock(&t_ms);
53 printf("system clock:%f\n", t_ms);
54 int config = 0;
55 robot.GetRobotCurJointsConfig(&config);
56 printf("joint config:%d\n", config);
57 uint8_t motionDone = 0;
58 robot.GetRobotMotionDone(&motionDone);
59 printf("GetRobotMotionDone :%d\n", motionDone);
60 int len = 0;
61 robot.GetMotionQueueLength(&len);
62 printf("GetMotionQueueLength :%d\n", len);
63 uint8_t emergState = 0;
64 robot.GetRobotEmergencyStopState(&emergState);
65 printf("GetRobotEmergencyStopState :%d\n", emergState);
66 int comstate = 0;
67 robot.GetSDKComState(&comstate);
68 printf("GetSDKComState :%d\n", comstate);
69 uint8_t si0_state, si1_state;
70 robot.GetSafetyStopState(&si0_state, &si1_state);
71 printf("GetSafetyStopState :%d %d\n", si0_state, si1_state);
72 double temp[6] = { 0.0 };
73 robot.GetJointDriverTemperature(temp);
74 printf("Temperature:%f,%f,%f,%f,%f,%f\n", temp[0], temp[1], temp[2], temp[3], temp[4], temp[5]);
75 double torque[6] = { 0.0 };
76 robot.GetJointDriverTorque(torque);
77 printf("torque:%f,%f,%f,%f,%f,%f\n", torque[0], torque[1], torque[2], torque[3], torque[4], torque[5]);
78 robot.GetRobotRealTimeState(&pkg);
79 robot.CloseRPC();
80 return 0;
81}
8.23. Inverse Kinematics Calculation
1/**
2* @brief Inverse kinematics calculation
3* @param [in] type 0-Absolute pose (base frame), 1-Incremental pose (base frame), 2-Incremental pose (tool frame)
4* @param [in] desc_pos Cartesian pose
5* @param [in] config Joint space configuration, [-1]-Calculate based on current joint position, [0~7]-Solve according to specific joint space configuration
6* @param [out] joint_pos Joint position
7* @return Error code
8*/
9errno_t GetInverseKin(int type, DescPose *desc_pos, int config, JointPos *joint_pos);
8.24. Inverse Kinematics Calculation (Reference Position)
1/**
2* @brief Inverse kinematics calculation, solve based on specified joint position
3* @param [in] type 0-Absolute pose (base frame), 1-Incremental pose (base frame), 2-Incremental pose (tool frame)
4* @param [in] desc_pos Cartesian pose
5* @param [in] joint_pos_ref Reference joint position
6* @param [out] joint_pos Joint position
7* @return Error code
8*/
9errno_t GetInverseKinRef(int type, DescPose *desc_pos, JointPos *joint_pos_ref, JointPos *joint_pos);
8.25. Inverse Kinematics Solution, Cartesian Space Including Extended Axis Position
1/**
2* @brief Inverse kinematics solution, Cartesian space including extended axis position
3* @param [in] type 0-absolute pose (base coordinate system), 1-incremental pose (base coordinate system), 2-incremental pose (tool coordinate system)
4* @param [in] desc_pos Cartesian pose
5* @param [in] exaxis Extended axis position
6* @param [in] tool Tool number
7* @param [in] workPiece Workpiece number
8* @param [out] joint_pos Joint position
9* @param [in] config Joint space configuration, [-1] - solve based on the current joint position reference, [0~7] - solve according to specific joint space configuration
10* @return Error code
11*/
12errno_t GetInverseKinExaxis(int type, DescPose desc_pos, ExaxisPos exaxis, int tool, int workPiece, JointPos& joint_pos, int config = -1);
8.26. Example Code for Inverse Kinematics Solution Including Extended Axis Position
1int TestInverseKinExaxis()
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 DescPose desc(99.957, -0.002, 29.994, -176.569, -6.757, -167.462);
14 ExaxisPos exaxis(100.0, 0.0, 0.0, 0.0);
15 JointPos jointPos = {};
16 DescPose offsetPos = {};
17 robot.GetRobotRealTimeState(&pkg);
18 int toolnum = pkg.tool;
19 int workPcsNum = pkg.user;
20 robot.GetInverseKinExaxis(0, desc, exaxis, toolnum, workPcsNum, jointPos);
21 printf("GetInverseKinExaxis joint is %f, %f, %f, %f, %f, %f\n", jointPos.jPos[0], jointPos.jPos[1], jointPos.jPos[2], jointPos.jPos[3], jointPos.jPos[4], jointPos.jPos[5]);
22 robot.ExtAxisMove(exaxis, 100, -1);
23 robot.MoveJ(&jointPos, &desc, toolnum, workPcsNum, 100.0, 100.0, 100.0, &exaxis, -1, 0, &offsetPos);
24 robot.CloseRPC();
25 robot.Sleep(9999999);
26 return 0;
27}
8.27. Check If Inverse Kinematics Has Solution
1/**
2* @brief Inverse kinematics calculation, check if solution exists based on specified joint position
3* @param [in] type 0-Absolute pose (base frame), 1-Incremental pose (base frame), 2-Incremental pose (tool frame)
4* @param [in] desc_pos Cartesian pose
5* @param [in] joint_pos_ref Reference joint position
6* @param [out] result 0-No solution, 1-Solution exists
7* @return Error code
8*/
9errno_t GetInverseKinHasSolution(int type, DescPose *desc_pos, JointPos *joint_pos_ref, uint8_t *result);
8.28. Forward Kinematics Calculation
1/**
2* @brief Forward kinematics calculation
3* @param [in] joint_pos Joint position
4* @param [out] desc_pos Cartesian pose
5* @return Error code
6*/
7errno_t GetForwardKin(JointPos *joint_pos, DescPose *desc_pos);
8.29. Robot Kinematics Calculation Code Example
1int TestInverseKin(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 JointPos j1(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
14 DescPose desc_pos1(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
15 JointPos inverseRtn = {};
16 robot.GetInverseKin(0, &desc_pos1, -1, &inverseRtn);
17 printf("dcs1 GetInverseKin rtn is %f %f %f %f %f %f \n", inverseRtn.jPos[0], inverseRtn.jPos[1], inverseRtn.jPos[2], inverseRtn.jPos[3], inverseRtn.jPos[4], inverseRtn.jPos[5]);
18 robot.GetInverseKinRef(0, &desc_pos1, &j1, &inverseRtn);
19 printf("dcs1 GetInverseKinRef rtn is %f %f %f %f %f %f \n", inverseRtn.jPos[0], inverseRtn.jPos[1], inverseRtn.jPos[2], inverseRtn.jPos[3], inverseRtn.jPos[4], inverseRtn.jPos[5]);
20 uint8_t hasResut = 0;
21 robot.GetInverseKinHasSolution(0, &desc_pos1, &j1, &hasResut);
22 printf("dcs1 GetInverseKinRef result %d\n", hasResut);
23 DescPose forwordResult = {};
24 robot.GetForwardKin(&j1, &forwordResult);
25 printf("jpos1 forwordResult rtn is %f %f %f %f %f %f \n", forwordResult.tran.x, forwordResult.tran.y, forwordResult.tran.z, forwordResult.rpy.rx, forwordResult.rpy.ry, forwordResult.rpy.rz);
26 robot.CloseRPC();
27 return 0;
28}
8.30. Query Robot Teaching Point Data
1/**
2 * @brief Query robot teaching point data
3 * @param [in] name Point name
4 * @param [out] data Point data
5 * @return Error code
6 */
7errno_t GetRobotTeachingPoint(char name[64], float data[20]);
8.31. Get Robot DH Parameter Compensation Values
Added in version C++SDK-v2.1.1.0.
1/**
2* @brief Get robot DH parameter compensation values
3* @param [out] dhCompensation Robot DH parameter compensation values(mm) [cmpstD1,cmpstA2,cmpstA3,cmpstD4,cmpstD5,cmpstD6]
4* @return Error code
5*/
6errno_t GetDHCompensation(double dhCompensation[6]);
8.32. Get Controller SN Code
Added in version C++SDK-v2.2.1-3.8.1.
1/**
2* @brief Get controller SN code
3* @param [out] SNCode Controller SN code
4* @return Error code
5*/
6errno_t GetRobotSN(std::string& SNCode);
8.33. Query Robot Teaching Point Data Code Example
1int TestGetTeachPoint(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 char name[64] = "P1";
14 float data[20] = { 0 };
15 rtn = robot.GetRobotTeachingPoint(name, data);
16 printf(" %d name is: %s \n", rtn, name);
17 for (int i = 0; i < 20; i++)
18 {
19 printf("data is: %f \n", data[i]);
20 }
21 int que_len = 0;
22 rtn = robot.GetMotionQueueLength(&que_len);
23 printf("GetMotionQueueLength rtn is: %d, queue length is: %d \n", rtn, que_len);
24 double dh[6] = { 0 };
25 int retval = 0;
26 retval = robot.GetDHCompensation(dh);
27 cout << "retval is: " << retval << endl;
28 cout << "dh is: " << dh[0] << " " << dh[1] << " " << dh[2] << " " << dh[3] << " " << dh[4] << " " << dh[5] << endl;
29 string SN = "";
30 robot.GetRobotSN(SN);
31 cout << "robot SN is " << SN << endl;
32 robot.CloseRPC();
33 return 0;
34}
8.34. Get Tool Coordinate System by ID
Changed in version C++SDK-v3.9.8.
1/**
2* @brief Get tool coordinate system by ID
3* @param [in] id Tool coordinate system number
4* @param [out] coord Coordinate system values
5* @param [out] type Tool type: 0-tool; 1-sensor
6* @param [out] install Installation position: 0-robot end; 1-external to robot
7* @param [out] toolID Tool ID
8* @param [out] loadNo Load number
9* @return Error code
10*/
11errno_t GetToolCoordWithID(int id, DescPose& coord, int& type, int& install, int& toolID, int& loadNo);
8.35. Get Workpiece Coordinate System by ID
Changed in version C++SDK-v3.9.8.
1/**
2* @brief Get workpiece coordinate system by ID
3* @param [in] id Workpiece coordinate system number
4* @param [out] coord Coordinate system values
5* @param [out] refFrame Reference coordinate system
6* @return Error code
7*/
8errno_t GetWObjCoordWithID(int id, DescPose& coord, int& refFrame);
8.36. Get External Tool Coordinate System by ID
Changed in version C++SDK-v3.9.8.
1/**
2* @brief Get external tool coordinate system by ID
3* @param [in] id External tool coordinate system number, 20-39 correspond to external tool coordinate systems 0-19
4* @param [out] coord TCP pose of the fixed external tool on the robot
5* @param [out] tcoord Workpiece coordinate system pose mounted on the robot end
6* @return Error code
7*/
8errno_t GetExToolCoordWithID(int id, DescPose& coord, DescPose& tcoord);
8.37. Get Extended Axis Coordinate System by ID
Changed in version C++SDK-v3.9.8.
1/**
2* @brief Get extended axis coordinate system by ID
3* @param [in] id External tool coordinate system number
4* @param [out] coord Coordinate system values
5* @param [out] axisCoordNum Extended axis number; bit0-bit3 correspond to extended axis 1-extended axis 4; e.g., axisCoordNum value 3 corresponds to extended axes [1, 2]
6* @param [out] calibFlag Calibration flag; 0-not calibrated; 1-calibrated
7* @return Error code
8*/
9errno_t GetExAxisCoordWithID(int id, DescPose& coord, int& axisCoordNum, int& calibFlag);
8.38. Get Payload Mass and Center of Gravity by ID
Added in version C++SDK-v3.8.6.
1/**
2* @brief Get Payload Mass and Center of Gravity by ID
3* @param [in] id Payload ID
4* @param [out] weight Payload mass
5* @param [out] cog Payload center of gravity
6* @return Error code
7*/
8errno_t GetTargetPayloadWithID(int id, double& weight, DescTran& cog);
8.39. Get Current Tool Coordinate System
Added in version C++SDK-v3.8.6.
1/**
2* @brief Get Current Tool Coordinate System
3* @param [out] coord Coordinate system values
4* @return Error code
5*/
6errno_t GetCurToolCoord(DescPose& coord);
8.40. Get Current Work Object Coordinate System
Added in version C++SDK-v3.8.6.
1/**
2* @brief Get Current Work Object Coordinate System
3* @param [out] coord Coordinate system values
4* @return Error code
5*/
6errno_t GetCurWObjCoord(DescPose& coord);
8.41. Get Current External Tool Coordinate System
Added in version C++SDK-v3.8.6.
1/**
2* @brief Get Current External Tool Coordinate System
3* @param [out] coord Coordinate system values
4* @return Error code
5*/
6errno_t GetCurExToolCoord(DescPose& coord);
8.42. Get Current Extended Axis Coordinate System
Added in version C++SDK-v3.8.6.
1/**
2* @brief Get Current Extended Axis Coordinate System
3* @param [out] coord Coordinate system values
4* @return Error code
5*/
6errno_t GetCurExAxisCoord(DescPose& coord);
8.43. Get Robot Coordinate Systems and Payload Code Example
Added in version C++SDK-v3.8.6.
1int TestCoord()
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 robot.Sleep(2000);
14 int id = 1;
15 DescPose toolCoord = {};
16 DescPose extoolCoord = {};
17 DescPose exworkpieceCoord = {};
18 DescPose wobjCoord = {};
19 DescPose exAxisCoord = {};
20 int type = 0, install = 0, toolID = 0, loadNo = 0;
21 robot.GetToolCoordWithID(id, toolCoord, type, install, toolID, loadNo);
22 printf("GetToolCoordWithID %d, %f %f %f %f %f %f, type = %d, install = %d, toolID = %d, loadNo = %d\n", id,
23 toolCoord.tran.x, toolCoord.tran.y, toolCoord.tran.z,
24 toolCoord.rpy.rx, toolCoord.rpy.ry, toolCoord.rpy.rz, type, install, toolID, loadNo);
25 int refFrame = 0;
26 robot.GetWObjCoordWithID(id, wobjCoord, refFrame);
27 printf("GetWObjCoordWithID %d, %f %f %f %f %f %f, refFrame = %d\n", id,
28 wobjCoord.tran.x, wobjCoord.tran.y, wobjCoord.tran.z,
29 wobjCoord.rpy.rx, wobjCoord.rpy.ry, wobjCoord.rpy.rz, refFrame);
30 robot.GetExToolCoordWithID(21, extoolCoord, exworkpieceCoord);
31 printf("GetExToolCoordWithID %d, %f %f %f %f %f %f\n", id,
32 extoolCoord.tran.x, extoolCoord.tran.y, extoolCoord.tran.z,
33 extoolCoord.rpy.rx, extoolCoord.rpy.ry, extoolCoord.rpy.rz,
34 exworkpieceCoord.tran.x, exworkpieceCoord.tran.y, exworkpieceCoord.tran.z,
35 exworkpieceCoord.rpy.rx, exworkpieceCoord.rpy.ry, exworkpieceCoord.rpy.rz);
36 int axisCoordNum = 0, calibFlag = 0;
37 robot.GetExAxisCoordWithID(id, exAxisCoord, axisCoordNum, calibFlag);
38 printf("GetExAxisCoordWithID %d, %f %f %f %f %f %f, axisCoordNum = %d, calibFlag = %d\n", id,
39 exAxisCoord.tran.x, exAxisCoord.tran.y, exAxisCoord.tran.z,
40 exAxisCoord.rpy.rx, exAxisCoord.rpy.ry, exAxisCoord.rpy.rz, axisCoordNum, calibFlag);
41 double weight = 0.0;
42 DescTran cog = {};
43 robot.GetTargetPayloadWithID(id, weight, cog);
44 printf("GetTargetPayloadWithID %d, %f %f %f %f\n", id, weight,
45 cog.x, cog.y, cog.z);
46 robot.GetCurToolCoord(toolCoord);
47 printf("GetCurToolCoord %f %f %f %f %f %f\n",
48 toolCoord.tran.x, toolCoord.tran.y, toolCoord.tran.z,
49 toolCoord.rpy.rx, toolCoord.rpy.ry, toolCoord.rpy.rz);
50 robot.GetCurWObjCoord(wobjCoord);
51 printf("GetCurWObjCoord %f %f %f %f %f %f\n",
52 wobjCoord.tran.x, wobjCoord.tran.y, wobjCoord.tran.z,
53 wobjCoord.rpy.rx, wobjCoord.rpy.ry, wobjCoord.rpy.rz);
54 robot.GetCurExToolCoord(extoolCoord);
55 printf("GetExToolCoordWithID %f %f %f %f %f %f\n",
56 extoolCoord.tran.x, extoolCoord.tran.y, extoolCoord.tran.z,
57 extoolCoord.rpy.rx, extoolCoord.rpy.ry, extoolCoord.rpy.rz);
58 robot.GetCurExAxisCoord(exAxisCoord);
59 printf("GetCurExAxisCoord %f %f %f %f %f %f\n",
60 exAxisCoord.tran.x, exAxisCoord.tran.y, exAxisCoord.tran.z,
61 exAxisCoord.rpy.rx, exAxisCoord.rpy.ry, exAxisCoord.rpy.rz);
62 float weightT = 0.0;
63 DescTran cogT = {};
64 robot.GetTargetPayload(0, &weightT);
65 robot.GetTargetPayloadCog(0, &cogT);
66 printf("GetTargetPayload %f %f %f %f\n", weightT,
67 cogT.x, cogT.y, cogT.z);
68 DescPose coordSet(0, 1, 2, 3, 4, 5);
69 robot.SetToolCoord(1, &coordSet, 0, 0, 1, 0);
70 robot.SetWObjCoord(1, &coordSet, 0);
71 robot.SetLoadWeight(1, 1.3);
72 //DescTran cog = {};
73 cog.x = 10;
74 cog.y = 20;
75 cog.z = 30;
76 robot.SetLoadCoord(1, &cog);
77 DescPose etcp(0, 0, 100, 0, 0, 0);
78 DescPose etool(0, 0, 50, 0, 0, 0);
79 rtn = robot.SetExToolCoord(21, &etcp, &etool);
80 printf("SetExToolCoord rtn is %d\n", rtn);
81 robot.ExtAxisActiveECoordSys(1, 1, coordSet, 1);
82 robot.CloseRPC();
83 return 0;
84}