RobotStudio event

How to use CallServiceRoutine ?

Options
Hello,

I would like to use the method CallServiceRoutine of the class Task in FPSDK 5.10.

I have severals PROC in a system module (for examples : GoToHomePosition, GoToMaintenancePosition, ...) and I would to call this PROC using CallServiceRoutine because it should be easier than change the program pointer, start, wait the end of the proc and reset the program pointer to the previous position.
But often, I have some problems :
- sometimes, the program pointer is moved on the first line of my service routine, but the execution doesn't start (even if I push Start button manually).
- sometimes, I have 0xC0048407 error.
- sometimes, I have 0xC004900A error.
And sometimes, it works...

Before to call CallServiceRoutine method, I always wait that my ExecutionState is stopped, and that my ControllerState is MotorsOn.

Is there a good way (that I don't know) to use this function ?

Thanks!
Herv?.




Comments


  • Hello,<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />


    CallServiceRoutine is a bit tricky to use, and this piece of functionality has been improved for FP SDK 5.11, which will soon be released.

    In 5.11 CallServiceRoutine is marked as obsolete and you are instead recommended to use the new method CallRoutine/CancelRoutine, which returns a StartResult, which will help you take action depending on how the start went: 5.10 public void CallServiceRoutine (string routine)5.11 public StartResult CallRoutine (string routine) & public StartResult CallRoutine (string routine, RegainMode regainMode)Valid routines for CallRoutine are service routines and ordinary routines that do not take any parameters.Any previous execution stack will be kept and after the routine is executed the program pointer will be restored to its previous location.Using the method requires special attention due to the fact that the routine might be stopped before it is finished. To enable normal execution again CancelRoutine() must be called. See the FlexPendant Program Editor for an idea about how this can be implemented.This is the same as for CallServiceRoutine in 5.10, where the possible need for CancelServiceRoutine must be handled somehow. (This is poorlydocumented in 5.10)If the start does not suceed, one reason may be that the mechanical unit is not on path. If so start must be ordered with a Regain parameter. Or else it can be motors off, or that mastership is held by another client (in auto mode). The error code 0xC004900A indicates wrong execution level (pp may already be inside a service routine, which was stopped before it was ready.) If this is the case CancelServiceRoutine must be called before it is possible to continue.In the FP SDK 5.11 Reference the description on how to use CallRoutine/CancelRoutine is better. I suggest you take a look at it, even if you will still be using 5.10 CallServiceRoutine. It will be available next week at the latest.It will (hopefully) help you understand how this works.By the way, the error codes that you can get from the controller are listed in User's Guide.You get a hint as to what may have gone wrong by the error descriptions :
    0xC0048407  Operation rejected by the controller safety access restriction mechanism.        
    0xC004900A Operation is illegal at current execution level.
    Ingela2008-9-16 11:54:32
    Best regards,

    Ingela Brorsson
    Software Engineer
    ABB Robotics, Sweden