get_robot_state
This function returns the current operation state of the robot controller. It is used together with the TOnMonitoringStateCB callback function. For safety, change the operation state according to the current state using the set_robot_control() function.
Definition
DRFLEx.h within class CDRFLEx, public section
ROBOT_STATE get_robot_state() { return _get_robot_state(_rbtCtrl); };
Parameter
None
Return
Value |
Description |
|---|---|
Refer to the Definition of Enumeration Type |
Example
#include <thread>
#include <chrono>
if (drfl.get_robot_state() == STATE_STANDBY) {
if (drfl.get_robot_mode() == ROBOT_MODE_MANUAL) {
// Manual mode
drfl.jog(JOG_AXIS_JOINT_3, MOVE_REFERENCE_BASE, 10.0f); // start jog
std::this_thread::sleep_for(std::chrono::seconds(2));
drfl.jog(JOG_AXIS_JOINT_3, MOVE_REFERENCE_BASE, 0.0f); // stop jog
}
}
This example checks the robot’s state and mode before motion. When the robot is in standby and Manual mode, it performs a short jog motion on joint 3. No motion is executed otherwise, ensuring safe operation.