You're reading the documentation for an older, but still supported version (1.33.4).
For information on the latest version, please have a look at 1.33.5.
For information on the latest version, please have a look at 1.33.5.
TOnMasteringNeedCB
This callback function is used to check whether the robot’s axes have been twisted or misaligned by an external force. When this event occurs, the robot requires re-mastering (axis alignment) through homing. The alignment completion can then be verified using the TOnHommingCompletedCB callback.
See Rules for callback functions.
Defined in: DRFLEx.h
// typedef (DRFL.h)
typedef void (*TOnMasteringNeedCB)();
// registration API (internal + wrapper)
DRFL_API void _set_on_mastering_need(LPROBOTCONTROL pCtrl, TOnMasteringNeedCB pCallbackFunc);
void set_on_mastering_need(TOnMasteringNeedCB pCallbackFunc)
{
_set_on_mastering_need(_rbtCtrl, pCallbackFunc);
};
Parameter
None
Return
None
Example
#include "DRFLEx.h"
#include <iostream>
#include <atomic>
#include <thread>
#include <chrono>
using namespace DRAFramework;
using namespace std;
std::atomic<bool> g_bNeedHoming(false);
// Callback triggered when robot mastering (axis alignment) is required
void OnMasteringNeedCB()
{
cout << "[MASTERING] Axis misalignment detected. Requesting homing sequence..." << endl;
// Request homing from the main loop; do not call move_home here
g_bNeedHoming = true;
}
int main()
{
CDRFLEx drfl;
// Connect to the robot controller
if (!drfl.open_connection("192.168.137.100")) {
cout << "Failed to connect to controller." << endl;
return -1;
}
// Register mastering-needed callback
drfl.set_on_mastering_need(OnMasteringNeedCB);
// Main loop: start homing outside the callback
while (true)
{
if (g_bNeedHoming) {
g_bNeedHoming = false;
// Initiate homing mode for re-alignment of robot axes
drfl.move_home(MOVE_HOME_MECHANIC, 1);
}
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
drfl.close_connection();
return 0;
}
Notes
This callback is invoked when the controller detects axis offset that requires re-mastering.
Use this event to trigger an automatic homing or alignment process.
Use TOnHommingCompletedCB to confirm when re-alignment finishes.