ControllerFactory.CreateFrom causing Object Reference Error
Newbe
✭
When the Controller is in a System Failure state and I try and do the command
controller = ControllerFactory.CreateFrom(controllerInfo)
when connecting to controller it gives me a error "Ojbect reference not set to an instance of an object" How can I check if the controller is in SF before I try and execute the command?
Thanks
controller = ControllerFactory.CreateFrom(controllerInfo)
when connecting to controller it gives me a error "Ojbect reference not set to an instance of an object" How can I check if the controller is in SF before I try and execute the command?
Thanks
Post edited by John Wiberg on
0
Comments
-
I don't think you can. If the controller is in Sysfail then RobAPI will not be able to communicate properly and then PC SDK cannot create a controller object.
Now if you had a controller which you were already connected to you would get the ControllerState:SystemFailure, but not when using the factory.
Now if you just scanned it you might get something from the controllerinfo.availability property, but I haven't tested what result that would get.
John
Developer Center0 -
Hi,let me start to say that RobotStudio can connect to a controller in System Failure State, in order to make it possible to fix the errors that caused System Failure.There are however some limitations to what you can do. You cannot edit RAPID, but you can edit CFG, for example.So from the underlying protocol point of view, there is nothing stopping PC SDK from connecting to a controller in System Failure state.There may be a "good reason" that it is not allowed in PC SDK.In that case what you have experienced is simply an example of lacking error handling. If the operation is not supported, you deserve a more informative exception.I'll ask a colleague to help me look into it.Another thing that I realized is that the ControllerFactory.Create or "new Controller(...)"by calling the ControllerFactory.CreateFrom() or new Controller(...)" seems to assume that controller is always connected.For example, looking at the ControllerState for example, there is no value that corresponds to "not connected".As a controller can become disconnected at any point in time, the Controller object needs to handle that it can happen, and in that case it should also be able to handle that the controller is "disconnected" when the Controller object is constructed.Post edited by Niklas Skoglund on0
-
Niklas,
Chances are that if the controller goes into SF state it is because I have just loaded a EIO.cfg file and rebooted the controller and when it boots up it does not like the EIO.cfg file. I would want to connect to the controller so I could load the changed EIO.cfg file that I looked at and found my mistake. So in this situation I would need to be able to connect to the controller and load the EIO.cfg file from the PC SDK. How can you connect to the controller if it will not allow you to connect when you do the ControllerFactory.CreateFrom() method?
0
Categories
- All Categories
- 5.5K RobotStudio
- 395 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings