PCSDK: Why am I getting a 'no authenticated user' exception?
sammye
✭
Why do I receive the below error when I attempt to update a group signal within another group signal's event?
Exception text: 'The controller has no authenticated user, call Logon( ) to authenticate a user.'
The connection code did not throw any errors when logging on as the default user to a virtual robot and I am able to update the value right after logging in, but I sometimes get an exception within a group signal's event handler when updating another group signal's value. Worked code with a virtual controller:
...
ControllerInfo controllerInfo = controllers[1];
if (controllerInfo.Availability == Availability.Available)
{
if (_controller != null)
{
_controller.Logoff();
_controller.Dispose();
_controller = null;
}
_controller = ControllerFactory.CreateFrom(controllerInfo);
UserInfo userInfo;
if (_controller.IsVirtual)
userInfo = UserInfo.DefaultUser;
else
{
userInfo = new UserInfo("abc", "abc123");
}
_controller.Logon(userInfo);
}
Signal signal = _controller.IOSystem.GetSignal("myVariable");
signal.Value= Convert.ToSingle(2);
...
The area where the exception occurs is within an event handler raised when another group signal is set. This makes me wonder if this is a threading issue since the event gets fired on its own worker thread, but I have declared the controller and signal as 'static' so they should be accessible by all threads - please feel free to correct me on anything sounding fishy. Code throwing exception:
protected override void handleSignalUpdates(object sender, ABB.Robotics.Controllers.IOSystemDomain.SignalChangedEventArgs e)
{
...
_groupSignals[mySignal].Value = Convert.ToSingle(Value); // exception here !!!
Note: The signal causing the event is different from the one being updated within the handler.
Exception text: 'The controller has no authenticated user, call Logon( ) to authenticate a user.'
The connection code did not throw any errors when logging on as the default user to a virtual robot and I am able to update the value right after logging in, but I sometimes get an exception within a group signal's event handler when updating another group signal's value. Worked code with a virtual controller:
...
ControllerInfo controllerInfo = controllers[1];
if (controllerInfo.Availability == Availability.Available)
{
if (_controller != null)
{
_controller.Logoff();
_controller.Dispose();
_controller = null;
}
_controller = ControllerFactory.CreateFrom(controllerInfo);
UserInfo userInfo;
if (_controller.IsVirtual)
userInfo = UserInfo.DefaultUser;
else
{
userInfo = new UserInfo("abc", "abc123");
}
_controller.Logon(userInfo);
}
Signal signal = _controller.IOSystem.GetSignal("myVariable");
signal.Value= Convert.ToSingle(2);
...
The area where the exception occurs is within an event handler raised when another group signal is set. This makes me wonder if this is a threading issue since the event gets fired on its own worker thread, but I have declared the controller and signal as 'static' so they should be accessible by all threads - please feel free to correct me on anything sounding fishy. Code throwing exception:
protected override void handleSignalUpdates(object sender, ABB.Robotics.Controllers.IOSystemDomain.SignalChangedEventArgs e)
{
...
_groupSignals[mySignal].Value = Convert.ToSingle(Value); // exception here !!!
Note: The signal causing the event is different from the one being updated within the handler.
0
Answers
-
The error I was encountering was cleared up by running the robot controller object in its own thread with a message queue to issue commands. I am still uncertain why making the objects static did not work or if I really got to the root of the problem, but it works for now. I also got to have a lot of fun with semaphores so that was educational.0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings