如何将ABB的PC SDK集成到Unity中?

问题描述 投票:0回答:1

对于我的一个项目,我需要使用Unity应用程序与ABB机器人进行通信。这可以通过使用ABB的PC SDK来完成。

链接到SDK:http://developercenter.robotstudio.com/pcsdk

在VS中的C#项目中,实现起来非常简单,但是我在Unity实现方面有些挣扎。

统一版本:(2018.3.8f1)

我试图通过将.dll文件(ABB.Robotics.Controllers.PC / RobotStudio.Services.RobApi.Desktop / RobotStudio.Services.RobApi)添加到Unity程序文件夹中。当我放入dll时,有两个错误表明没有引用Google.Protobuf和tar-cs。我在互联网上找到了dll,并将其放入了项目中。之后,没有错误出现。

然后在我尝试过的代码中:

NetworkScanner scanner = new NetworkScanner(); //Scans the network or robot controllers

我收到此错误。

NullReferenceException: Object reference not set to an instance of an object
System.Threading.Tasks.Task`1[TResult].InnerInvoke () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Threading.Tasks.Task.Execute () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
Rethrow as AggregateException: One or more errors occurred.
System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Threading.Tasks.Task`1[TResult].GetResultCore (System.Boolean waitCompletionNotification) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Threading.Tasks.Task`1[TResult].get_Result () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
RobotStudio.Services.RobApi.Desktop.RobPlatformDesktop+<>c.<.cctor>b__2_1 () (at <901697530f6a4ba88a60f7c648717fba>:0)
System.Threading.Tasks.Task`1[TResult].InnerInvoke () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Threading.Tasks.Task.Execute () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
Rethrow as AggregateException: One or more errors occurred.
System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Threading.Tasks.Task`1[TResult].GetResultCore (System.Boolean waitCompletionNotification) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Threading.Tasks.Task`1[TResult].get_Result () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
RobotStudio.Services.RobApi.Desktop.RobPlatformDesktop.GetNetscan () (at <901697530f6a4ba88a60f7c648717fba>:0)
RobotStudio.Services.RobApi.Internal.RobApiProviderManager.AddProvider (System.String providerId, RobotStudio.Services.RobApi.Internal.IRobApiProvider provider) (at <8d4f5d48ee63449dbb1112cb5a802708>:0)
RobotStudio.Services.RobApi.Desktop.RobPlatformDesktopInit.Initialize () (at <901697530f6a4ba88a60f7c648717fba>:0)
ABB.Robotics.Controllers.Discovery.NetworkScanner..cctor () (at <e27eeaf9f4444392aac382e4960f38fe>:0)
Rethrow as TypeInitializationException: The type initializer for 'ABB.Robotics.Controllers.Discovery.NetworkScanner' threw an exception.
ButtonScript.SimpleOutput () (at Assets/ButtonScript.cs:39)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Threading.ThreadHelper.ThreadStart () (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Object:__icall_wrapper_mono_generic_class_init()
ButtonScript:SimpleOutput() (at Assets/ButtonScript.cs:39)
System.Threading.ThreadHelper:ThreadStart()

我不确定方法本身是否有问题,或者我没有正确实现PC SDK。

我的问题是将PC SDK实施到Unity中的更好方法吗?

谢谢你。

c# unity3d dll
1个回答
0
投票

我不确定Mono是否可以支持ABB的dll

© www.soinside.com 2019 - 2024. All rights reserved.