RobotStudio event

[PC SDK] Catching controller errors

Hi,

I'm trying to catch the errors from the controller in my external application using the PC SDK. For this, I subscribe my program to controller.EventLog.MessageWritten:

controller.EventLog.MessageWritten += new EventHandler<ABB.Robotics.Controllers.EventLogDomain.MessageWrittenEventArgs>(EventLog_MessageWritten);

In the handler, I try to filter the messages attending to its EventLogEntryType (type Error). I'm hitting with two issues trying this.

1) Not all events are caught in the handler: while Information and Warning are, the controller in my program is throwing a 50080 error (position not compatible) at some point and the handler is not launched.
2) Event log messages are empty (= null) when handler is launched. My code looks as follow:

void EventLog_MessageWritten(object sender, ABB.Robotics.Controllers.EventLogDomain.MessageWrittenEventArgs e)
{
EventLogMessage msg = e.Message;
if (msg.Type == ABB.Robotics.Controllers.EventLogDomain.EventLogEntry.Error)
{
OnEventLogMessage(EventArgs.Empty); // Notifies error
}
}

This code crashes when you try to acces msg.Type. Checking values received you can see that e.Message is null for any message received.

The thing is that I have this code working in another application developed with RS/PCSDK 5.15, and I'm pretty sure it worked. This one is under 5.61.

Any ideas/suggestions to solve this?
Thanks in advance,
HM

Comments