TOnMonitoringSpeedModeCB
This callback function is used to check the current velocity (speed) mode of the robot controller.
See Rules for callback functions.
Defined in: DRFLEx.h
// typedef (DRFL.h)
typedef void (*TOnMonitoringSpeedModeCB)(const MONITORING_SPEED);
// registration API (internal + wrapper)
DRFL_API void _set_on_monitoring_speed_mode(LPROBOTCONTROL pCtrl, TOnMonitoringSpeedModeCB pCallbackFunc);
void set_on_monitoring_speed_mode(TOnMonitoringSpeedModeCB pCallbackFunc)
{
_set_on_monitoring_speed_mode(_rbtCtrl, pCallbackFunc);
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
eSpeedMode |
Current speed mode reported by the controller ( |
Return
None
Example
#include "DRFLEx.h"
#include <iostream>
#include <thread>
#include <chrono>
using namespace DRAFramework;
using namespace std;
// Callback triggered when the robot’s speed mode changes
void OnMonitoringSpeedModeCB(const MONITORING_SPEED eSpdMode)
{
switch (eSpdMode)
{
case SPEED_NORMAL_MODE:
cout << "[SPEED MODE] Normal-speed mode active." << endl;
break;
case SPEED_REDUCED_MODE:
cout << "[SPEED MODE] Reduced-speed mode active." << endl;
break;
default:
cout << "[SPEED MODE] Unknown speed mode: " << static_cast<int>(eSpdMode) << 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 speed mode monitoring callback
drfl.set_on_monitoring_speed_mode(OnMonitoringSpeedModeCB);
// Keep process alive to monitor speed mode events
while (true)
{
std::this_thread::sleep_for(std::chrono::seconds(1));
}
drfl.close_connection();
return 0;
}
Notes
The callback is invoked whenever the robot’s speed mode changes.
Use this callback to update UI indicators, safety overlays, or motion speed profiles.
Each callback receives the most recent data. If the callback takes longer than the data period (100 ms before DRCF 3.5, 20 ms from DRCF 3.5), intermediate samples are not delivered. Do not rely on receiving every sample (for example for integration or differentiation).