I am observing sporadic behavior of this “Operation is illegal in current execution state” error when running a C# application written using the PC SDK. I make sure to check that the ‘TaskExecutionStatus’ is stopped so that the program pointer is not moved while the program is executing, however the error still occurs. How can I tell what is going to cause this error since it seems to be happening randomly?
This is the error output, followed by the C# code snippet of how I am executing routines:
ABB.Robotics.GenericControllerException occurred
ExtendedErrorInformation=“”
HResult=-1073442809
Message=C0049007 : Operation is illegal in current execution state.
ERROR: rdh_rapid.cpp[7215]: org_code: -4503 new_code: 0xc0049007;
Url:/RAPID/T_ROB_R Cmd:SET Prop:PP Args:-ExLev N -RoutineURL /RAPID/T_ROB_R/MainModule/EmptyRoutine Elapsed:0 CurrentCmds:0
History:
-00:00:00.5445383 [787536] SendCommand url:/RAPID cmd:Get prop:Childs arg:-mark 0 -noelts -1 -cc 0
-00:00:00.5415381 [787536] status:294912 data:-noelts,all,mark,cc 2,1, 21, …
-00:00:00.5415381 [787537] SendCommand url:/RAPID/T_ROB_R cmd:SET prop:PP arg:-ExLev N -RoutineURL /RAPID/T_ROB_R/IoModule/GetVacuumPressure
-00:00:00.5180297 [787537] status:294912 data:
-00:00:00.5180297 [787538] SendCommand url:/RAPID cmd:SET prop:Start arg:-RegainMode Clear -ExecMode Continous -Cycle AsIs -Condition None
-00:00:00.0430038 [787538] status:294912 data:
-00:00:00.0419938 [787539] SendCommand url:/RAPID cmd:Get prop:Childs arg:-mark 0 -noelts -1 -cc 0
-00:00:00.0370044 [787539] status:294912 data:-noelts,all,mark,cc 2,1, 21, …
-00:00:00.0370044 [787540] SendCommand url:/RAPID/T_ROB_R cmd:Get prop:ExecutionState arg:
-00:00:00.0350017 [787540] status:294912 data:-ExecutionState Started
-00:00:00.0340022 [787541] SendCommand url:/RAPID cmd:Get prop:Childs arg:-mark 0 -noelts -1 -cc 0
-00:00:00.0280013 [787541] status:294912 data:-noelts,all,mark,cc 2,1, 21, …
-00:00:00.0280013 [787542] SendCommand url:/RAPID/T_ROB_R cmd:Get prop:ExecutionState arg:
-00:00:00.0250037 [787542] status:294912 data:-ExecutionState Started
-00:00:00.0140031 [787543] SendCommand url:/RAPID cmd:Get prop:Childs arg:-mark 0 -noelts -1 -cc 0
-00:00:00.0130003 [787543] status:294912 data:-noelts,all,mark,cc 2,1, 21, …
-00:00:00.0130003 [787544] SendCommand url:/RAPID/T_ROB_R cmd:Get prop:ExecutionState arg:
-00:00:00.0120031 [787544] status:294912 data:-ExecutionState Stopped
-00:00:00.0009889 [787545] SendCommand url:/RAPID/T_ROB_R cmd:SET prop:PP arg:-ExLev N -RoutineURL /RAPID/T_ROB_R/MainModule/EmptyRoutine
00:00:00 [787545] status:-1073442809 data:ERROR: rdh_rapid.cpp[7215]: org_code: -4…
Source=ABB.Robotics.Controllers.PC
StackTrace:
at Adapters.Task.SetPCPToRoutineByUrl(String routineUrl)
at ABB.Robotics.Controllers.RapidDomain.Task.SetProgramPointer(String module, String routine)
at Msei.Fsd.MpxRobot.AbbRobotArm.RunRoutine(String moduleName, String routineName, Boolean checkComplete) in C:\Users\floorp\Documents\mpxmic\Msei.Fsd.MpxRobot\AbbRobotArm.cs:line 868
InnerException:
HResult=-1073442809
Message=C0049007 : Operation is illegal in current execution state.
ERROR: rdh_rapid.cpp[7215]: org_code: -4503 new_code: 0xc0049007;
Url:/RAPID/T_ROB_R Cmd:SET Prop:PP Args:-ExLev N -RoutineURL /RAPID/T_ROB_R/MainModule/EmptyRoutine Elapsed:0 CurrentCmds:0
History:
-00:00:00.5445383 [787536] SendCommand url:/RAPID cmd:Get prop:Childs arg:-mark 0 -noelts -1 -cc 0
-00:00:00.5415381 [787536] status:294912 data:-noelts,all,mark,cc 2,1, 21, …
-00:00:00.5415381 [787537] SendCommand url:/RAPID/T_ROB_R cmd:SET prop:PP arg:-ExLev N -RoutineURL /RAPID/T_ROB_R/IoModule/GetVacuumPressure
-00:00:00.5180297 [787537] status:294912 data:
-00:00:00.5180297 [787538] SendCommand url:/RAPID cmd:SET prop:Start arg:-RegainMode Clear -ExecMode Continous -Cycle AsIs -Condition None
-00:00:00.0430038 [787538] status:294912 data:
-00:00:00.0419938 [787539] SendCommand url:/RAPID cmd:Get prop:Childs arg:-mark 0 -noelts -1 -cc 0
-00:00:00.0370044 [787539] status:294912 data:-noelts,all,mark,cc 2,1, 21, …
-00:00:00.0370044 [787540] SendCommand url:/RAPID/T_ROB_R cmd:Get prop:ExecutionState arg:
-00:00:00.0350017 [787540] status:294912 data:-ExecutionState Started
-00:00:00.0340022 [787541] SendCommand url:/RAPID cmd:Get prop:Childs arg:-mark 0 -noelts -1 -cc 0
-00:00:00.0280013 [787541] status:294912 data:-noelts,all,mark,cc 2,1, 21, …
-00:00:00.0280013 [787542] SendCommand url:/RAPID/T_ROB_R cmd:Get prop:ExecutionState arg:
-00:00:00.0250037 [787542] status:294912 data:-ExecutionState Started
-00:00:00.0140031 [787543] SendCommand url:/RAPID cmd:Get prop:Childs arg:-mark 0 -noelts -1 -cc 0
-00:00:00.0130003 [787543] status:294912 data:-noelts,all,mark,cc 2,1, 21, …
-00:00:00.0130003 [787544] SendCommand url:/RAPID/T_ROB_R cmd:Get prop:ExecutionState arg:
-00:00:00.0120031 [787544] status:294912 data:-ExecutionState Stopped
-00:00:00.0009889 [787545] SendCommand url:/RAPID/T_ROB_R cmd:SET prop:PP arg:-ExLev N -RoutineURL /RAPID/T_ROB_R/MainModule/EmptyRoutine
00:00:00 [787545] status:-1073442809 data:ERROR: rdh_rapid.cpp[7215]: org_code: -4…
RawMessage=ERROR: rdh_rapid.cpp[7215]: org_code: -4503 new_code: 0xc0049007;
InnerException:
C# Snippet
private void RunRoutine(string moduleName, string routineName, bool checkComplete = true)
{
Task task = Controller.Rapid.GetTask(Task);
task.SetProgramPointer(moduleName, routineName);
Controller.Rapid.Start(true);
TaskExecutionStatus status = Controller.Rapid.GetTask(Task).ExecutionStatus;
while (status != TaskExecutionStatus.Stopped && status != TaskExecutionStatus.Ready)
{
status = Controller.Rapid.GetTask(Task).ExecutionStatus;
Thread.Sleep(10);
}
// Set the program pointer to an empty routine so that if this task is run again, nothing will happen.
task.SetProgramPointer(ModuleDefinitions.MainModuleName, "EmptyRoutine");
if (checkComplete == false)
{
return;
}
bool isComplete = ReadBool(ModuleDefinitions.MainModuleName, ModuleDefinitions.CompleteFlagName);
if (isComplete == false)
{
throw new RobotException(
$"Robot task did not complete successfully. module:{moduleName} routine:{routineName}");
}