08-02-2023 11:27 AM
Hello.
I have a 3D Camera with an SDK to get the point cloud data. I would like to call this function in LabVIEW.
So far i have build up the Application with connection to the camera, setting all values. But the "GET DATA" Subvi, which calls the SDK Sensor3D_GetPointCloud, gets a error -3 (timeout).
Now im unsure: Is it correct how I build the values in this VI and is the "Call Libary function" set with the correct parameters? Im not sure how this structure of pointers is handled.
I'm thankful for any helpful tips.
With best regards. Marcel.
Solved! Go to Solution.
08-02-2023 02:14 PM
I can't really look at your VIs as I don't have LabVIEW 2022 installed, in fact no version beyond 2020 currently.
However from looking at your code.c file that you probably created from the Call Library Node it is almost certain that what you do is not right.
Basically there is no easy way in LabVIEW to create a structure containing C pointers, but that is exactly what your API expects.
The most "easy" way would be actually to change your Call Library Node to contain all the necessary data elements, create the according code.c file from that and then fill in the according C functions to translate between the LabVIEW datatypes and the according C data structure and pointers. Yes it means C programming and creating an intermediate DLL, but you need to do that adaptation either in C or in LabVIEW by creating the pointers yourself, copying data to and from those pointers back into LabVIEW data, etc. Possible? Yes. But you need to know at least as much about how memory pointers work and how to convert them as you would when writing the same in C and then a little bit more as you also need to know how C compilers specifically align data in memory, which when written in C is taken care of automatically.
08-03-2023 02:35 AM
Thank you for your suggestion.
Is there a way in LabVIEW to create this structure or is it not possible?
Are there any examples anywehre for the intermediated dll?
08-03-2023 02:55 AM
@Valduril wrote:
Thank you for your suggestion.
Is there a way in LabVIEW to create this structure or is it not possible?
Sure it's possible!
Easy? Hell no! It's a nightmare to do, a pain in the ass and a sure way to create a maintenance disaster.
Are there any examples anywehre for the intermediated dll?
How much C programming experience do you have? Without that experience no example will help. With serious C programming experience no example would really give you much new information.
Are there examples to do intermediate DLLs? Yes lots and lots, if you look for posts from me on here and over on lavag.org you will find probably several dozen. Do they do exactly what you want to do? No, unfortunately not. You still need to know about LabVIEW memory manager functions and how to call them, about C pointers, C structure alignment and proper C memory management rules.