RobotStudio event

Controller creation

Options

Hi,

This might seam like a strange question, but I am quite new to PC-SDK.

I have no problems with creating a controller with controllerFactory if I have made a scan and then look through the list of found controllers.

But in my case I know the IP of my three controllers, and would like to directly connect to them with ControllerFactory. I've tried this in several ways also using the Optional argument for IP. But it still seams like I need to have the ControllerInfo for that particular controller.

How do I get that without making a scan.

Lets se if someone has some suggestions.

/PerM

Comments

  • Marcel
    Options

    Hi PerM

    We have done it like this:


    public frmMain()
    {
    InitializeComponent();
    startGerberController(
    "66-57568"); // virtueller Roboter
    }
     
    private void startGerberController(string tag)
    {
    this._scanner.Scan();
    ControllerInfoCollection controllers = _scanner.Controllers;
    foreach (ControllerInfo ctr in controllers)
    {
    if (ctr.SystemName == tag)
    {
    if (ctr.Availability != Availability.Available)
    {
    return;
    }
    Logoff();
    this.controller = ControllerFactory.CreateFrom(ctr);
    Logon();
    }
    }
    }
    private void Logon()
    {
    this.controller.Logon(UserInfo.DefaultUser);
    }
    public void Logoff()
    {
    if (this.controller != null)
    {
    this.controller.Logoff();
    this.controller.Dispose();
    this.controller = null;
    }
    }
    I hope this will help you.
    Best regards
    Marcel
  • PerM
    Options

    Thanks Marcel,

    After I wrote my question I have done something similar to what you show. I Make a scan, and then look through the found controllers to find the IP numbers I know that my controllers will have. Like this:

    image

    After this I can continue and log on to the controllers as I wish. I will change the IP# into string variables so that they can be changed by the user.

    This actually works fine.

    It would however be nice if it would be possible to create a controller instance with "ControllerFactory" directly from the IP# or the Controller ID as a string, without having to do a scan.

    /PerM
  • Hello

    It is possible to create a Controller instance without performing a scan operation.


    All .NET Winform applications read configuration data from an App.config file in the application directory. It is not mandatory to use an App.config file in a PC SDK application, but it is sometimes a convenient way to add application flexibility. Therefore, an App.config file that you can use is included in the RAB installation.
    Start by copying the App.config file at C:Program FilesABB Industrial ITRobotics ITRobot Application BuilderPC SDK to the application directory. Then add the file to the project by right-clicking the project icon, pointing to Add and selecting Existing Item.
    To modify application behavior you thus need to change the values of the attributes of this file.

    If there is a controller in the network that you connect to often (or if the PC application is supposed to work with a single controller) it can be specified in the
    <defaultSystem> tag. It has an id attribute containing a GUID string embraced by curly brackets.



    <defaultSystem id="{469F56DF-938E-4B06-B036-AABBB3E61F83}" />

    Using this mechanism enables you to use the default constructor to create a
    Controller object for the specified controller:



    VB:
    Dim aController As Controller = New Controller()
    C#:
    Controller aController = new Controller();

     

     

    Best regards,

    Ingela Brorsson
    Software Engineer
    ABB Robotics, Sweden
  • Thanks Ingela,

    I will give this a try.

    Iv'e looked through the "app.config" file.

    There is a few "?" that pops up when I read the above.

    - The GUID, "{xxxx...}"? Do I have to do a scan and then read the GUID's of the found controllers(Manually once, I mean)? Or can I get it in the real controller? Or have I missunderstood the GUID completely :-) ??

    - In my case it is always three controllers available, they are always to be logged on to. Can I still use this tecnique? In that case how?

    The way I do now works, so this is not critical, but it would be nice to understand how to do.

    /Per M

  • Hello again,

    Maybe I was too quick to answer the question. You actually do need to perform a scan operation by using NetworkScanner.Scan in your application. The PC SDK uses it to log you on to the controller. The NetworkScanner.Find(Guid) method should be possible to use as well.

    The GUID belongs to the system. You can read it from the system.guid file in the INTERNAL folder of the robot system file system.

    The defaultSystem id tag is used to specify ONE system as the default one (created with parameterless constructor). If you need to log on to three different controllers there is an overloaded Controller constructor method, which takes a GUID.

    Best regards,

    Ingela Brorsson
    Software Engineer
    ABB Robotics, Sweden