我正在尝试使用C#代码将BNO055 USB_STICK连接到我的电脑。经过搜索,最后,我找到了一本有关GENERIC API的Bosch手册。大。因此,我将UserApplicationBoard.dll添加到了Visual Studio项目中,并尝试读取/写入IMU传感器。可悲的是,它在C#中不起作用。阅读手册后,我可以在IronPython和MatLab中使用这些API(我在IronPython中对其进行了测试,并且可以正常工作),但是当我尝试在C#中从此.dll调用方法时,出现此错误:
Non-invocable member UserApplicationBoard cannot be used like a method
虽然在IronPython中一切正常,但我可以读取/写入每个注册表。下面是我的简单代码:
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BST; //DLL FOR GENERIC API FROM BOSCH
namespace BNO055UsbStick
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Start BNO055 BST API");
BST.UserApplicationBoard board = BST.UserApplicationBoard();
}
}
}
有人知道如何解决此问题吗?
您必须先创建实例,然后才能使用它。就像塞尔文说的那样,您需要new
,如下所示:
BST.UserApplicationBoard board = new BST.UserApplicationBoard();