Emergency Stop Button Monitoring APIs
The emergency stop button monitoring APIs are implemented by the following class. You can find the corresponding header file in the c++/include/sensor directory to access the complete set of APIs.
| Header File | Class Name | Description |
|---|---|---|
sensor_emergency_stop_monitor.h | EStopMonitor | Emergency stop button monitor that provides active querying of the emergency stop button state and supports setting event callbacks. |
Constructor
Section titled “Constructor”-
Method:
EStopMonitor(const EStopMConfig& cfg = EStopMConfig()) -
Parameter:
ParameterTypeDescription cfgInput Configuration parameter. For details, please refer to EStopMConfig.
Start Monitoring
Section titled “Start Monitoring”If EStopMConfig::auto_start_ is set to true (default), the monitoring process will start automatically, and there is no need to manually call run().
Calling run() multiple times has no effect.
Once monitoring is started, the registered event callback functions may be triggered.
-
Method:
bool run() -
Return Value:
trueif started successfully,falseotherwise.
Pause Monitoring
Section titled “Pause Monitoring”After monitoring is paused, the registered event callback functions will not be triggered.
Calling pause() multiple times has no effect.
-
Method:
bool pause() -
Return Value:
trueif paused successfully,falseotherwise.
Check if Monitoring Is Running
Section titled “Check if Monitoring Is Running”-
Method:
bool is_running() -
Return Value:
trueif monitoring is running,falseotherwise.
Get Current Emergency Stop Button State
Section titled “Get Current Emergency Stop Button State”-
Method:
ESState get_state() -
Return Value:
The emergency stop button state. For details, please refer to ESState.
Register Emergency Stop Button Pressed Callback Function
Section titled “Register Emergency Stop Button Pressed Callback Function”-
Method:
int set_pressed_event_callback(std::function<void()> f) -
Parameter:
ParameterTypeDescription fInput Callback function triggered when the emergency stop button is pressed. Multiple callback functions are allowed if EStopMConfig::allow_multicb_istrue. -
Return Value:
0or1indicates success (where1means an existing callback was replaced, which only occurs when only one callback is allowed).-1indicates failure.
Register Emergency Stop Button Released Callback Function
Section titled “Register Emergency Stop Button Released Callback Function”-
Method:
int set_released_event_callback(std::function<void()> f) -
Parameter:
ParameterTypeDescription fInput Callback function triggered when the emergency stop button is released. Multiple callback functions are allowed if EStopMConfig::allow_multicb_istrue. -
Return Value:
0or1indicates success (where1means an existing callback was replaced, which only occurs when only one callback is allowed).-1indicates failure.