get_robot_mode (Manual Mode)
This section describes how to use get_robot_mode during Manual (Teach) operations. Returns the mode stored in this CDRFLEx instance (initially ROBOT_MODE_MANUAL). set_robot_mode stores the requested mode. Calls that send a safety mode to the controller also store the mode when the controller accepts it: drl_stop stores Manual mode, set_safety_mode and the initialization and recovery options of set_robot_control store the safety mode they send, and multi_jog, motion and force-control commands store the current safety mode. The stored mode starts as Manual and is not read from the controller; call set_robot_mode(ROBOT_MODE_AUTONOMOUS) before Auto-only functions, even if the controller is already in Auto mode. To confirm that the controller accepted a mode change, check the return value of set_robot_mode.
Typical usage
Verify the robot’s current operation mode before sending jog or motion commands.
Automatically adjust GUI or input permissions depending on mode.
Prevent unintended auto commands when in manual state.
Note
Typical values:
ROBOT_MODE_MANUAL: Teach pendant or manual control.ROBOT_MODE_AUTONOMOUS: Program or external control.In manual teaching, this should return ROBOT_MODE_MANUAL.
Caution
set_robot_mode stores the requested mode even when it returns false. get_robot_mode then returns the requested mode, and functions that require Auto or Manual mode accept calls although the controller did not change mode. If set_robot_mode returns false, do not use mode-gated functions until a later set_robot_mode call returns true.
Example: Ensure Robot is in Manual Mode
ROBOT_MODE mode = drfl.get_robot_mode();
if (mode == ROBOT_MODE_MANUAL) {
printf("Robot is in Manual mode. Jogging enabled.\n");
drfl.jog(JOG_AXIS_TASK_Y, MOVE_REFERENCE_BASE, 10.0f);
} else {
printf("Robot is not in Manual mode. Jogging disabled.\n");
}
Tips
Always confirm Manual mode before manual motion or teaching.
For safety, restrict jog or multi_jog commands when in Auto mode.
Integrate this check into any teaching GUI or remote jog control application.