RobotStudio event

Getting signal from robot

I use this code to try getting a signal state from a robot:
Controller aController = new Controller();

Signal _doorClose= aController.IOSystem.GetSignal("Do02_RollingDoorClose") as DigitalSignal;

DigitalSignal doorClosed = (DigitalSignal)_doorClose;

int val_doorClose = doorClosed.Get();

listBox2.Items.Add(Convert.ToString(val_doorClose));

 



When i do this i get a error message saying that "the controller was not present in NetScan".

 

Does any one no what is the problem?

 

I also want to change the value of a robot input, how do i do it? (On robotstudio offline only).

Thanks
tmgaspar2012-01-27 13:28:27
--
Tiago Gaspar

Comments

  • Hi Tiago,
     

    you are using PC SDK right?

    Then you have to decide which controller on the network (or virtual controller on your machine) that you would like to communicate with.

     

    The default constructor of Controller(), takes no parameters and assumes that you would like to communicate with the "defaultController id" as specified in the capi section of the App.config file.

     

    If that is what you want to do, but still get this error, it means that this controller is not reachable for the moment.

     

    To find available controllers on the network use the NetworkScanner class.

     

    Have a nive weekend!

    Best Regards, Niklas Skoglund
    ABB Robotics

    Developer Center
    RobotStudio Blog