RobotStudio event

help

Hey, guys, can anybody help me to deal with the following problems?

I am using PC SDK to develop a windows applcation. I created a robot system of 5.06.0095 by RS online. I used VC test to open this robot system and also used RS online to connect it. I set the UAS grant to Full Access for default user!

After that, I ran my app. The code piece are listed, but in debug window, the count of UAS is 0, thus, no grant is given to robot system!

What may be the cause of this problem? Any suggestions or solutions are wellcomed, thanks!

code piece below:

@static = new Controller( ControllerFactory.FormatControllerId( new Guid( "12B3A1F5-A992-4FF2-9FAE-C8666B64943C" ) ) );

Grant[] allgrant = @static.AuthenticationSystem.GetCurrentGrants();
Debug.WriteLine(@static.s.ToString());
Debug.WriteLine(allgrant.Length.ToString());
foreach(Grant g in allgrant)
{
Debug.WriteLine(g.ToString());
}
thanks a lot!

Comments

  • RobotStudio Online and a PC SDK App cannot share mastership and logon. You need to log on and request mastership as well.

    Example code
    Controller      _ctrl;
    ControllerInfo  _info;
    NetworkScanner  _scanner = new NetworkScanner();

    How to scan the network what IRC5 controllers that are connected.
    This example is searching for the virtual controller  
    bool Scan()
        {
          ControllerInfo[] ctrls = _scanner.GetControllers();
          foreach( ControllerInfo info in ctrls )
          {
            if( info.IsVirtual )
            {
              _info = info;
              break;
            }
         
    }
          return _info != null;
        }

    Then you create an Controller instance
    void Create()
        {
          _ctrl = ControllerFactory.CreateFrom( _info );
        }

    Then you need to log on, with a valid user.
       void Logon()
        {
          _ctrl.Logon( UserInfo.DefaultUser );
        }

    Then you request mastership
    void RequestMaster()
        {
          using( Mastership m = Mastership.Request( _ctrl.Rapid ) )
          {
            Console.WriteLine( "Got master" );
            Thread.Sleep( 2000 );
          }
        }

    And then you can check your grants.