how to monitor signals from add in
johannes
✭
in RobotStudio
Dear all,
I have an issue about signal inside the add in ..
I wrote this code
why ain't this working .. (though i change the signal through the iosimulator )
btw . . if I invoke this code
station.VirtualSignals["userdo1"]
inside the addin .. i always get these following errors .
please note that I've added the signals in my vc ..
I have an issue about signal inside the add in ..
I wrote this code
station.VirtualSignals.VirtualSignalChanged +=
Logger.AddMessage(new LogMessage(e.Signal));
});
new VirtualSignalChangedEventHandler
(delegate(object obj, VirtualSignalChangedEventArgs e)
{(delegate(object obj, VirtualSignalChangedEventArgs e)
Logger.AddMessage(new LogMessage(e.Signal));
});
why ain't this working .. (though i change the signal through the iosimulator )
btw . . if I invoke this code
station.VirtualSignals["userdo1"]
inside the addin .. i always get these following errors .
please note that I've added the signals in my vc ..
Base exception:
System.Reflection.TargetInvocationException, mscorlib
System.Runtime.InteropServices.COMException, mscorlib
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at ABB.Internal.RobotStudio.API.APIHelper.ThrowApiExceptionIfBadHr(Int32 hr)
at ABB.Robotics.RobotStudio.Stations.VirtualSignalCollection.get_Item(String name)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
at Microsoft.VisualStudio.Tools.Applications.RemotePropertyInfoAdapter.System.AddIn.Contract.Automation.IRemotePropertyInfoContract.GetValue(IRemoteObjectContract target, BindingFlags bindingFlags, IRemoteArgumentArrayContract index, Int32 lcid)
Server stack trace:
at Microsoft.VisualStudio.Tools.Applications.RemoteMethodInfoAdapter.System.AddIn.Contract.Automation.IRemoteMethodInfoContract.Invoke(IRemoteObjectContract target, BindingFlags bindingFlags, IRemoteArgumentArrayContract arguments, Int32 lcid)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.AddIn.Contract.Automation.IRemoteMethodInfoContract.Invoke(IRemoteObjectContract target, BindingFlags bindingFlags, IRemoteArgumentArrayContract parameters, Int32 localeId)
at ABBInternal.VstaServices.VstaMacro.Execute()
System.Reflection.TargetInvocationException, mscorlib
System.Runtime.InteropServices.COMException, mscorlib
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at ABB.Internal.RobotStudio.API.APIHelper.ThrowApiExceptionIfBadHr(Int32 hr)
at ABB.Robotics.RobotStudio.Stations.VirtualSignalCollection.get_Item(String name)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
at Microsoft.VisualStudio.Tools.Applications.RemotePropertyInfoAdapter.System.AddIn.Contract.Automation.IRemotePropertyInfoContract.GetValue(IRemoteObjectContract target, BindingFlags bindingFlags, IRemoteArgumentArrayContract index, Int32 lcid)
Server stack trace:
at Microsoft.VisualStudio.Tools.Applications.RemoteMethodInfoAdapter.System.AddIn.Contract.Automation.IRemoteMethodInfoContract.Invoke(IRemoteObjectContract target, BindingFlags bindingFlags, IRemoteArgumentArrayContract arguments, Int32 lcid)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.AddIn.Contract.Automation.IRemoteMethodInfoContract.Invoke(IRemoteObjectContract target, BindingFlags bindingFlags, IRemoteArgumentArrayContract parameters, Int32 localeId)
at ABBInternal.VstaServices.VstaMacro.Execute()
johannes
0
Comments
-
Hi Johannes,
Please note that "station signals" (Station.VirtualSignals) are not the same thing as I/O signals in a VC. So you cannot directly subscribe to a VC signal using VirtualSignalChanged.
What you should do is to connect the VC signal to a station signal using the event manager, and subscribe to that station signal instead.
(Also note that you can subscribe to VC signals using the RAB, but that might not work with VSTA.)
regards,
Johannes
Johannes Weiman
Software Engineer
ABB Robotics0
Categories
- All Categories
- 5.5K RobotStudio
- 396 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)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings