RobotStudio event

How to get the controller object ?

Hello,

I am trying to synchronize from the controller to the station so I followed this page and update it to not use the obsolete function.

So my code is like this : 
Controller controller = Controller.Connect(new Guid(rsIrc5Controller.SystemId.ToString()), ConnectionType.Standalone);

but when I debug and look at my controller variable it say  : 
Unable to evaluate the expression because evaluating the function requires all threads to execute.
An image of the debug can be found here

Can you help find what I miss ?  
Thank you in advance 

Best Answer

  • Nils Olofsson
    Answer ✓
    Hello,
    So i did not read the original post properly, sorry for that.
    When requesting mastership when the controller is in manual mode it will request something called RMMP. This basically mean that you will have to allow the client mastership from the flexpendant, i am sure you have seen this when trying to edit rapid code from RobotStudio on a real controller.
    So to solve this, either allow your client mastership from the flexpendant or make sure you have set the controller to auto mode when you run your code. 
    And yes, this should work on a VC.

    Nils Olofsson
    PC Software Support Engineer

Answers


  • Nils Olofsson
    PC Software Support Engineer

  • Thank you for your help. I tried to launch my smartcomposant directly in RS but I don't think it work either. It tell me that
    the RMMP request was not granted within the timeout limit. 
    To debug I tried to print the controller name and it give me the name of my computer.

  • It seems like you request RMMP and that's where it fails, not when connecting to the controller.
    Do you need RMMP?

    Nils Olofsson
    PC Software Support Engineer

  • It seems like you request RMMP and that's where it fails, not when connecting to the controller.
    Do you need RMMP?
    Hello,
    To be honest I don't know what is RMMP. I only try to follow the guide here. But I tried without connecting, only with this code below and it works.

    <div>result = await task.SyncPathProcedureAsync(moduleName + "/" + routineName,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SyncDirection.ToStation,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; messages);</div>

    The drawback of this method is that the module need to exist in the station. If we need to access a module that doesn't exist in the station we will need to access the controller if I understand correctly this page

    My question is : Is it working with the virtual controller ?

    Best regards and thanks in advance

  • Hello,
    So i did not read the original post properly, sorry for that.
    When requesting mastership when the controller is in manual mode it will request something called RMMP. This basically mean that you will have to allow the client mastership from the flexpendant, i am sure you have seen this when trying to edit rapid code from RobotStudio on a real controller.
    So to solve this, either allow your client mastership from the flexpendant or make sure you have set the controller to auto mode when you run your code. 
    And yes, this should work on a VC.
    Thank you ! It works now. I didn't think to look at the controller while requesting mastership --'