RobotStudio event

Aquiring Mastership of Virtual Controller

I am currently developing a new simulation in RS for an upcoming machine. For this system I have a VB app simulating remote vision systems to feed positional data back into the controller. For this I have a camera trigger output on the virtual station which I am able to capture and respond to in my VB app. I have a vision result (bool) and position (pos) variable on the controller that I need to write vision data to in return but am unable to acquire master from the VB app to write the vision data back to the virtual controller. When I request mastership from the VB app I get an exception stating that the requested resource is held by someone else. Is it possible for an external app to acquire mastership in a simulation?
image

Comments



  • Yes. Most of everyone's testing and debugging is done in the virtual environment. So that is the norm.
     
    Your most likely issue is that when the controller is in manual mode the FlexPendant itself has mastership. Test by going to Auto and try again.
    Or that your app is taking multiple logins. Test by restarting the controller and then step through your code with breakpoints in debugging.
     
    If you look at the samples provided, the best practice is to use the "using" command:
    [code]Try
      If controller.OperatingMode = ControllerOperatingMode.Auto Then
        Using m As Mastership = Mastership.Request(controller.Rapid)
        'Perform operation 
        End Using
      Else
        MessageBox.Show("Automatic mode is required to start execution from a remote client.")
      End If
    Catch ex As System.Exception
      MessageBox.Show(ex.Message)
    End Try[/code]
  • I wasn't running the virtual controller at the time, just hitting the play button on the simulator tab, though it did work fine when the VC was open and I was running the rapid program from there. What I'm finding is when using the play button on the simulator screen I will run fine until I hit stop, on the next start my VB app will no longer be able to gain mastership. Switching the controller to manual then back to auto seems to release whatever it is that's being held by the simulator when I hit stop.
    image