top of page
6.13. Set External Tool Coordinate System List
Changed in version C++SDK-v2.1.2.0.
/**
* @brief Set external tool coordinate system list
* @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 SetExToolList(int id, DescPose *etcp, DescPose *etool);
6.14. Robot External Tool Coordinate System Operation Example
int TestExtCoord(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(-89.606, 779.517, 193.516, 178.000, 0.476, -92.484);
JointPos p1Joint(-108.145, -50.137, 85.818, -125.599, -87.946, 74.329);
DescPose p2Desc(-24.656, 850.384, 191.361, 177.079, -2.058, -95.355);
JointPos p2Joint(-111.024, -41.538, 69.222, -114.913, -87.743, 74.329);
DescPose p3Desc(-99.813, 766.661, 241.878, -176.817, 1.917, -91.604);
JointPos p3Joint(-107.266, -56.116, 85.971, -122.560, -92.548, 74.331);
ExaxisPos exaxisPos(0, 0, 0, 0);
DescPose offdese(0, 0, 0, 0, 0, 0);
DescPose posTCP[3] = { p1Desc , p2Desc , p3Desc };
DescPose coordRtn = {};
robot.MoveJ(&p1Joint, &p1Desc, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetExTCPPoint(1);
robot.MoveJ(&p2Joint, &p2Desc, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetExTCPPoint(2);
robot.MoveJ(&p3Joint, &p3Desc, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetExTCPPoint(3);
rtn = robot.ComputeExTCF(&coordRtn);
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);
robot.SetExToolCoord(1, &coordRtn, &offdese);
robot.SetExToolList(1, &coordRtn, &offdese);
robot.CloseRPC();
return 0;
}
6.15. Set Workpiece Reference Point - Three-Point Method
/**
* @brief Set workpiece reference point - three-point method
* @param [in] point_num Point number, range [1~3]
* @return Error code
*/
errno_t SetWObjCoordPoint(int point_num);
6.16. Calculate Workpiece Coordinate System
Changed in version C++SDK-v2.1.5.0.
/**
* @brief Calculate workpiece coordinate system
* @param [in] method Calculation method: 0-origin-x-axis-z-axis, 1-origin-x-axis-xy-plane
* @param [in] refFrame Reference coordinate system
* @param [out] wobj_pose Workpiece coordinate system
* @return Error code
*/
errno_t ComputeWObjCoord(int method, int refFrame, DescPose *wobj_pose);
6.17. Set Workpiece Coordinate System
Changed in version C++SDK-v2.1.5.0.
/**
* @brief Set workpiece coordinate system
* @param [in] id Coordinate system ID, range [0~14]
* @param [in] coord Workpiece coordinate system pose relative to end flange center
* @param [in] refFrame Reference coordinate system
* @return Error code
*/
errno_t SetWObjCoord(int id, DescPose *coord, int refFrame);
6.18. Set Workpiece Coordinate System List
Changed in version C++SDK-v2.1.5.0.
/**
* @brief Set workpiece coordinate system list
* @param [in] id Coordinate system ID, range [0~14]
* @param [in] coord Workpiece coordinate system pose relative to end flange center
* @param [in] refFrame Reference coordinate system
* @return Error code
*/
errno_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.
/**
* @brief Calculate workpiece coordinate system from point data
* @param [in] method Calculation method: 0-origin-x-axis-z-axis, 1-origin-x-axis-xy-plane
* @param [in] pos Three TCP position array
* @param [in] refFrame Reference coordinate system
* @param [out] coord Resulting workpiece coordinate system
* @return Error code
*/
errno_t ComputeWObjCoordWithPoints(int method, DescPose pos[], int refFrame, DescPose& coord);
6.20. Get Current Workpiece Coordinate System
/**
* @brief Get current workpiece coordinate system
* @param [in] flag 0-blocking, 1-non-blocking
* @param [out] desc_pos Workpiece coordinate system pose
* @return Error code
*/
errno_t GetWObjOffset(uint8_t flag, DescPose *desc_pos);
6.21. Robot Workpiece Coordinate System Operation Example
int TestWobjCoord(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(-89.606, 779.517, 193.516, 178.000, 0.476, -92.484);
JointPos p1Joint(-108.145, -50.137, 85.818, -125.599, -87.946, 74.329);
DescPose p2Desc(-24.656, 850.384, 191.361, 177.079, -2.058, -95.355);
JointPos p2Joint(-111.024, -41.538, 69.222, -114.913, -87.743, 74.329);
DescPose p3Desc(-99.813, 766.661, 241.878, -176.817, 1.917, -91.604);
JointPos p3Joint(-107.266, -56.116, 85.971, -122.560, -92.548, 74.331);
ExaxisPos exaxisPos(0, 0, 0, 0);
DescPose offdese(0, 0, 0, 0, 0, 0);
DescPose posTCP[3] = { p1Desc , p2Desc , p3Desc };
DescPose coordRtn = {};
rtn = robot.ComputeWObjCoordWithPoints(1, posTCP, 0, coordRtn);
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);
robot.MoveJ(&p1Joint, &p1Desc, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetWObjCoordPoint(1);
robot.MoveJ(&p2Joint, &p2Desc, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetWObjCoordPoint(2);
robot.MoveJ(&p3Joint, &p3Desc, 1, 0, 100, 100, 100, &exaxisPos, -1, 0, &offdese);
robot.SetWObjCoordPoint(3);
rtn = robot.ComputeWObjCoord(1, 0, &coordRtn);
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);
robot.SetWObjCoord(1, &coordRtn, 0);
robot.SetWObjList(1, &coordRtn, 0);
DescPose getWobjDesc = {};
rtn = robot.GetWObjOffset(0, &getWobjDesc);
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);
robot.CloseRPC();
return 0;
}
6.22. Set Global Speed
/**
* @brief Set global speed
* @param [in] vel Speed percentage, range [0~100]
* @return Error code
*/
errno_t SetSpeed(int vel);
6.23. Set Robot Acceleration
/**
* @brief Set robot acceleration
* @param [in] acc Robot acceleration percentage
* @return Error code
*/
errno_t SetOaccScale(double acc);bottom of page