top of page
6.45. Obtain wide voltage control box temperature and fan current monitoring parameters
/**
* @brief Obtain wide voltage control box temperature and fan current monitoring parameters
*@param [ in ] enable 0-do not enable monitoring; 1-enable monitoring
*@param [ in ] period (s) , range 1-100
*@return error code
*/
errno_t GetWideBoxTempFanMonitorParam(int &enable, int &period);
6.46. Wide voltage control box temperature and fan current state acquisition code example
int TestWideVoltageCtrlBoxtemp(void)
{
ROBOT_STATE_PKG pkg = {};
FRRobot robot;
robot.LoggerInit();
robot.SetLoggerLevel(1);
int rtn = robot.RPC("192.168.58.2");
printf("robot rpc rtn is %d\n", rtn);
if (rtn != 0)
{
return -1;
}
robot.SetReConnectParam(true, 30000, 500);
robot.SetWideBoxTempFanMonitorParam(1, 2);
int enable = 0;
int period = 0;
robot.GetWideBoxTempFanMonitorParam(enable, period);
printf("GetWideBoxTempFanMonitorParam enable is %d period is %d\n", enable, period);
for (int i = 0; i < 100; i++)
{
robot.GetRobotRealTimeState(&pkg);
printf("robot ctrl box temp is %f, fan current is %d\n", pkg.wideVoltageCtrlBoxTemp, pkg.wideVoltageCtrlBoxFanCurrent);
robot.Sleep(100);
}
rtn = robot.SetWideBoxTempFanMonitorParam(0, 2);
printf("SetWideBoxTempFanMonitorParam rtn is %d\n", rtn);
enable = 0;
period = 0;
robot.GetWideBoxTempFanMonitorParam(enable, period);
printf("GetWideBoxTempFanMonitorParam enable is %d period is %d\n", enable, period);
for (int i = 0; i < 100; i++)
{
robot.GetRobotRealTimeState(&pkg);
printf("robot ctrl box temp is %f, fan current is %d\n", pkg.wideVoltageCtrlBoxTemp, pkg.wideVoltageCtrlBoxFanCurrent);
robot.Sleep(100);
}
robot.CloseRPC();
robot.Sleep(2000);
return 0;
}
6.47. Calculate Focus Calibration Results
/**
* @brief Calculate focus calibration results
* @param [in] pointNum Number of calibration points
* @param [out] resultPos Calibration result XYZ
* @param [out] accuracy Calibration accuracy error
* @return Error code
*/
errno_t ComputeFocusCalib(int pointNum, DescTran& resultPos, float& accuracy);
6.48. Set Focus Position
/**
* @brief Set focus position
* @param [in] pos Focus position XYZ
* @return Error code
*/
errno_t SetFocusPosition(DescTran pos);
6.49. Enable Focus Following
/**
* @brief Enable focus following
* @param [in] kp Proportional parameter (default: 50.0)
* @param [in] kpredict Feedforward parameter (default: 19.0)
* @param [in] aMax Maximum angular acceleration limit (default: 1440°/s²)
* @param [in] vMax Maximum angular velocity limit (default: 180°/s)
* @param [in] type X-axis locking mode (0-reference input vector; 1-horizontal; 2-vertical)
* @return Error code
*/
errno_t FocusStart(double kp, double kpredict, double aMax, double vMax, int type);
6.50. Disable Focus Following
/**
* @brief Disable focus following
* @return Error code
*/
errno_t FocusEnd();
6.51. Robot Focus Following Code Example
int TestFocus()
{
ROBOT_STATE_PKG pkg = {};
FRRobot robot;
robot.LoggerInit();
robot.SetLoggerLevel(1);
int rtn = robot.RPC("192.168.58.2");
if (rtn != 0)
{
return -1;
}