英文:
How to use imported xsensdeviceapi64.dll classes and functions in Python code?
问题
From Xsens Device API documentation:
>The C++ interface is not available in compiled form but is provided as part of the SDK as source code that is incorporated in the C header files. This C++ interface code implements a convenience wrapper around the C API. This means that the developer does not have to deal with memory management (i.e. easy object-lifetime management) as the class implementation takes care of this.
>
>The API comprises of two C-interface libraries that are supplied for MS Windows (32 and 64 bit) and Linux. These are:
XsTypes that contains generic types (vectors, matrices, quaternions, etc.) and some basic operations on those types.Xsens Device API that contains the access to functionality as implemented in Xsens devices. The Xsens Device API library depends on the XsTypes, while XsTypes is an independent library.
So I import xsensdeviceapi64.dll
to my Python 3.8.10
code:
import os
xda = os.add_dll_directory(r'C:\path\xsensdeviceapi64.dll')
However, this line
class XdaCallback(xda.XsCallback):
throws an error when trying to create a class based on XsCallback Xsens Device API class:
builtins.AttributeError: '_AddedDllDirectory' object has no attribute 'XsCallback'
XsCallback is a clearly documented Xsens Device API class and I have a working code for Linux (Linux works with a Python wheel file, this code is for Windows) so there is no question about that. I tried also with xsensdeviceapi_csharp64.dll
and xsensdeviceapi_com64.dll
which come with the Software Development Kit Windows download, in addition to using an import of xstypes64.dll
with the api
imports, but it didn't make any difference. Also renaming the ...dll
files to ...pyd
did not help.
Why doesn't this work? How can I access the API classes and functions in Windows using Python 3.8.10?
英文:
From Xsens Device API documentation:
>The C++ interface is not available in compiled form but is provided as part of the SDK as source code that is incorporated in the C header files. This C++ interface code implements a convenience wrapper around the C API. This means that the developer does not have to deal with memory management (i.e. easy object-lifetime management) as the class implementation takes care of this.
>
>The API comprises of two C-interface libraries that are supplied for MS Windows (32 and 64 bit) and Linux. These are:
XsTypes that contains generic types (vectors, matrices, quaternions, etc.) and some basic operations on those types.Xsens Device API that contains the access to functionality as implemented in Xsens devices. The Xsens Device API library depends on the XsTypes, while XsTypes is an independent library.
So I import xsensdeviceapi64.dll
to my Python 3.8.10
code:
import os
xda = os.add_dll_directory(r'C:\path\xsensdeviceapi64.dll')
However, this line
class XdaCallback(xda.XsCallback):
throws an error when trying to create a class based on XsCallback Xsens Device API class:
builtins.AttributeError: '_AddedDllDirectory' object has no attribute 'XsCallback'
XsCallback is a clearly documented Xsens Device API class and I have a working code for Linux (Linux works with a Python wheel file, this code is for Windows) so there is no question about that. I tried also with xsensdeviceapi_csharp64.dll
and xsensdeviceapi_com64.dll
which come with the Software Development Kit Windows download, in addition to using an import of xstypes64.dll
with the api
imports, but it didn't make any difference. Also renaming the ...dll
files to ...pyd
did not help.
Why doesn't this work? How can I access the API classes and functions in Windows using Python 3.8.10?
答案1
得分: 0
在Movella MTi产品软件套件中有适用于Python的Wheel文件。我已经下载了MTw Awinda软件套件,因为我正在为的项目使用MTw传感器和Awinda Dongle。
https://www.movella.com/support/software-documentation
英文:
There are wheel files for Python in Movella MTi Products Software Suite. I had downloaded MTw Awinda Software Suite because the project I'm programming for uses MTw sensors and Awinda Dongle.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论