top of page
6. Common Settings
6.1. Set Tool Reference Point - Six-Point Method
/**
* @brief Set tool reference point - six-point method
* @param [in] point_num Point number, range [1~6]
* @return Error code
*/
errno_t SetToolPoint(int point_num);
6.2. Calculate Tool Coordinate System
/**
* @brief Calculate tool coordinate system
* @param [out] tcp_pose Tool coordinate system
* @return Error code
*/
errno_t ComputeTool(DescPose *tcp_pose);
6.3. Set Tool Reference Point - Four-Point Method
/**
* @brief Set tool reference point - four-point method
* @param [in] point_num Point number, range [1~4]
* @return Error code
*/
errno_t SetTcp4RefPoint(int point_num);
6.4. Calculate Tool Coordinate System
/**
* @brief Calculate tool coordinate system
* @param [out] tcp_pose Tool coordinate system
* @return Error code
*/
errno_t ComputeTcp4(DescPose *tcp_pose);
6.5. Calculate Tool Coordinate System from Points
New in version C++SDK-v2.1.8-3.7.8.
/**
* @brief Calculate tool coordinate system from point data
* @param [in] method Calculation method: 0-four-point method; 1-six-point method
* @param [in] pos Joint position array (4 points for four-point method, 6 points for six-point method)
* @param [out] coord Resulting tool coordinate system
* @return Error code
*/
errno_t ComputeToolCoordWithPoints(int method, JointPos pos[], DescPose& coord);
6.6. Set Tool Coordinate System
Changed in version C++SDK-v2.1.5.0.
/**
* @brief Set tool coordinate system
* @param [in] id Coordinate system ID, range [0~14]
* @param [in] coord Tool center point pose relative to end flange center
* @param [in] type 0-tool coordinate system, 1-sensor coordinate system
* @param [in] install Installation position: 0-robot end, 1-external to robot
* @param [in] toolID Tool ID
* @param [in] loadNum Load number
* @return Error code
*/
errno_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.
/**
* @brief Set tool coordinate system list
* @param [in] id Coordinate system ID, range [0~14]
* @param [in] coord Tool center point pose relative to end flange center
* @param [in] type 0-tool coordinate system, 1-sensor coordinate system
* @param [in] install Installation position: 0-robot end, 1-external to robot
* @param [in] loadNum Load number
* @return Error code
*/
errno_t SetToolList(int id, DescPose *coord, int type, int install, int loadNum);
6.8. Get Current Tool Coordinate System
/**
* @brief Get current tool coordinate system
* @param [in] flag 0-blocking, 1-non-blocking
* @param [out] desc_pos Tool coordinate system pose
* @return Error code
*/
errno_t GetTCPOffset(uint8_t flag, DescPose *desc_pos);
6.9. Robot Tool Coordinate System Operation Example
int TestTCPCompute(void)
{
ROBOT_STATE_PKG pkg = {};
FRRobot robot;
robot.LoggerInit();
robot.SetLoggerLevel(1);
int rtn = robot.RPC("192.168.58.2");
if (rtn != 0)
{
return -1;
}
robot.SetReConnectParam(true, 30000, 500);
DescPose p1Desc(186.331, 487.913, 209.850, 149.030, 0.688, -114.347);
JointPos p1Joint(-127.876, -75.341, 115.417, -122.741, -59.820, 74.300);
DescPose p2Desc(69.721, 535.073, 202.882, -144.406, -14.775, -89.012);
JointPos p2Joint(-101.780, -69.828, 110.917, -125.740, -127.841, 74.300);
DescPose p3Desc(146.861, 578.426, 205.598, 175.997, -36.178, -93.437);
JointPos p3Joint(-112.851, -60.191, 86.566, -80.676, -97.463, 74.300);
DescPose p4Desc(136.284, 509.876, 225.613, 178.987, 1.372, -100.696);
JointPos p4Joint(-116.397, -76.281, 113.845, -128.611, -88.654, 74.299);
DescPose p5Desc(138.395, 505.972, 298.016, 179.134, 2.147, -101.110);
JointPos p5Joint(-116.814, -82.333, 109.162, -118.662, -88.585, 74.302);
DescPose p6Desc(105.553, 454.325, 232.017, -179.426, 0.444, -99.952);
JointPos p6Joint(-115.649, -84.367, 122.447, -128.663, -90.432, 74.303);
ExaxisPos exaxisPos(0, 0, 0, 0);
DescPose offdese(0, 0, 0, 0, 0, 0);
JointPos posJ[6] = { p1Joint , p2Joint , p3Joint , p4Joint , p5Joint , p6Joint };
DescPose coordRtn = {};
rtn = robot.ComputeToolCoordWithPoints(1, posJ, coordRtn);
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);
robot.MoveJ(&p1Joint, &p1Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetToolPoint(1);
robot.MoveJ(&p2Joint, &p2Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetToolPoint(2);
robot.MoveJ(&p3Joint, &p3Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetToolPoint(3);
robot.MoveJ(&p4Joint, &p4Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetToolPoint(4);
robot.MoveJ(&p5Joint, &p5Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetToolPoint(5);
robot.MoveJ(&p6Joint, &p6Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetToolPoint(6);
rtn = robot.ComputeTool(&coordRtn);
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);
robot.SetToolList(1, &coordRtn, 0, 0, 0);
robot.MoveJ(&p1Joint, &p1Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetTcp4RefPoint(1);
robot.MoveJ(&p2Joint, &p2Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetTcp4RefPoint(2);
robot.MoveJ(&p3Joint, &p3Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetTcp4RefPoint(3);
robot.MoveJ(&p4Joint, &p4Desc, 0, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetTcp4RefPoint(4);
rtn = robot.ComputeTcp4(&coordRtn);
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);
robot.SetToolCoord(2, &coordRtn, 0, 0, 1, 0);
DescPose getCoord = {};
rtn = robot.GetTCPOffset(0, &getCoord);
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);
robot.CloseRPC();
return 0;
}
6.10. Set External Tool Reference Point - Six-Point Method
/**
* @brief Set external tool reference point - six-point method
* @param [in] point_num Point number, range [1~4]
* @return Error code
*/
errno_t SetExTCPPoint(int point_num);
6.11. Calculate External Tool Coordinate System
/**
* @brief Calculate external tool coordinate system
* @param [out] tcp_pose External tool coordinate system
* @return Error code
*/
errno_t ComputeExTCF(DescPose *tcp_pose);
6.12. Set External Tool Coordinate System
Changed in version C++SDK-v2.1.2.0.
/**
* @brief Set external tool coordinate system
* @param [in] id Coordinate system ID, range [0~14]
* @param [in] etcp Tool center point pose relative to end flange center
* @param [in] etool To be determined
* @return Error code
*/
errno_t SetExToolCoord(int id, DescPose *etcp, DescPose *etool);bottom of page