TOnMonitoringRobotSystemCB
This callback is executed when the robot operation system changes in the robot controller. It allows you to monitor transitions between the Real Robot and Virtual Robot system modes.
See Rules for callback functions.
Defined in: DRFLEx.h
// typedef (DRFLEx.h)
typedef void (*TOnMonitoringRobotSystemCB)(const ROBOT_SYSTEM);
// internal definition
DRFL_API void _set_on_monitoring_robot_system(LPROBOTCONTROL pCtrl, TOnMonitoringRobotSystemCB pCallbackFunc);
// user-callable wrapper
void set_on_monitoring_robot_system(TOnMonitoringRobotSystemCB pCallbackFunc)
{
_set_on_monitoring_robot_system(_rbtCtrl, pCallbackFunc);
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
eRobotSystem |
Indicates the current robot operation system (ROBOT_SYSTEM_REAL or ROBOT_SYSTEM_VIRTUAL). |
Return
None
Example
#include "DRFLEx.h"
#include <iostream>
#include <thread>
#include <chrono>
using namespace DRAFramework;
using namespace std;
// Callback executed when robot operation system changes
void OnMonitoringRobotSystemCB(const ROBOT_SYSTEM eSystem)
{
cout << "[ROBOT SYSTEM STATE UPDATED]" << endl;
switch (eSystem)
{
case ROBOT_SYSTEM_REAL:
cout << "Robot system: REAL ROBOT — connected to physical hardware." << endl;
break;
case ROBOT_SYSTEM_VIRTUAL:
cout << "Robot system: VIRTUAL ROBOT — operating in virtual mode." << endl;
break;
default:
cout << "Robot system: UNKNOWN (" << (int)eSystem << ")" << endl;
break;
}
}
int main()
{
CDRFLEx drfl;
// Connect to robot controller
if (!drfl.open_connection("192.168.137.100")) {
cout << "Failed to connect to controller." << endl;
return -1;
}
// Register callback for robot system monitoring
drfl.set_on_monitoring_robot_system(OnMonitoringRobotSystemCB);
// Keep monitoring loop alive
while (true)
std::this_thread::sleep_for(std::chrono::seconds(1));
drfl.close_connection();
return 0;
}
Notes
Triggered when the controller changes between:
- Real Robot (ROBOT_SYSTEM_REAL)
- Virtual Robot (ROBOT_SYSTEM_VIRTUAL)Common uses:
- Displaying current system mode in UI
- Logging system transitions
- Automatically adapting control logic to match system type