For information on the latest version, please have a look at 1.33.5.
get_program_state (Auto Mode)
This section explains how to use get_program_state during Auto (Run) operations to monitor the execution state of the currently running DRL (Doosan Robotics Language) program.
This function is essential for building robust automation logic, allowing external applications to determine whether the robot is running, paused, or stopped and respond accordingly.
Returns the state of the program started by this CDRFLEx instance: DRL_PROGRAM_STATE_LAST after connecting, DRL_PROGRAM_STATE_PLAY after drl_start, DRL_PROGRAM_STATE_HOLD and DRL_PROGRAM_STATE_PLAY after drl_pause and drl_resume, DRL_PROGRAM_STATE_STOP when the controller reports that the program stopped. Programs started from the teach pendant or another client are not reflected. DRL_PROGRAM_STATE_PLAY does not confirm that the controller started the program.
Typical usage
Check whether the robot is actively executing a DRL task.
Detect when a program has paused and trigger inspection or operator workflows.
Determine when a program has stopped due to completion or interruption.
Build branching logic using drl_pause, drl_resume, and drl_stop.
Note
Typical states include: - DRL_PROGRAM_STATE_STOP - DRL_PROGRAM_STATE_PLAY - DRL_PROGRAM_STATE_HOLD
When no DRL program is active, the state is usually STOP.
Example: Responding to Current Program Execution State
DRL_PROGRAM_STATE state = drfl.get_program_state();
switch (state) {
case DRL_PROGRAM_STATE_PLAY:
// If a program is running, stop it
drfl.drl_stop(0);
printf("Program was running. Requested stop.\n");
break;
case DRL_PROGRAM_STATE_HOLD:
// If paused, resume execution
drfl.drl_resume();
printf("Program was paused. Resumed execution.\n");
break;
case DRL_PROGRAM_STATE_STOP:
default:
printf("No active DRL program.\n");
break;
}
In this example, the external application checks the current DRL program state and performs an appropriate action—stopping, resuming, or simply acknowledging that no program is running.
Tips
Useful for implementing “smart” automation flows that adapt to robot state.
Helps synchronize external systems (vision, conveyors, sensors) with robot execution.
Call periodically during Auto mode for real-time program tracking.
Combine with get_last_alarm to understand why a program transitioned to STOP.