LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PICAM SDK, Call Library Function, crashes LV

Solved!
Go to solution
@Zumbi wrote:

 

I am not sure if I clearly understand how I can pass out the array instead of the cluster. This seems to be going against the definition of the Picam_GetAcquisitionBuffer() function. What's the magic, Rolf? 🙂

The magic is that there is no rule that your VI interface that you present to your user has to strictly adhere to the C interface of your underlaying library. In fact you never should force C complications on the user of your VI library but make it as LabVIEW as possible even if you need to do a little work. It is much easier to do this work once in your library than forcing every user of your library to worry about useless information or worse, have to do C memory allocation stuff or similar.

 

That memory size does not provide any information to the user of your library beyond what the size of the array already contains. So there is no need to force that cluster on your library user but instead simply pass out the array directly through the connector pane of your VI.

 

Of course you will need to make sure that the configuration of any Call Library Node conforms strictly to the definition of the API, but your VI interface is free to deviate from that and in fact should if it makes the users life easier.

Rolf Kalbermatter
My Blog
0 Kudos
Message 81 of 89
(2,149 Views)

Right, now I see what you meant. Here is the snippet showing the way I modified the Get_AcquisitionBuffer.vi.

 

GetAcquisitionBuffer_vi_snippet.png

 

The 'InvalidHandle' error is sill there though. Would you have a vague clue what would it be? I know that you havent had much of experience with picam, but your overall experience is still much higher than average, so any of your inputs is always helpful.

0 Kudos
Message 82 of 89
(2,146 Views)

I just removed that Error-subvi in the end and everything started working without errors, but the Get_AcquisitionBuffer subvi returns zeros into the AcquisitionBuffer array.GetAcquisitionBuffer_vi_snippet.png

0 Kudos
Message 83 of 89
(2,131 Views)

I have got some clarification about the zero-buffer issue from the support team.

The main thing is that there is another open-camera procedure defined in picam_advanced.h file which provides another camera handle suitable for using advanced picam-functions. The example code 'acquisition_state.cpp' (attached earlier) shows how to do it.

0 Kudos
Message 84 of 89
(2,106 Views)

I didn’t have time to look into it but this was my first suspicion when reading your report about the invalid handle error. Ignoring errors as you did after, always gives me the jibes unless I fully understand the reason for it (e.g. communication timeout errors often are expected and don’t mean anything is wrong.

Rolf Kalbermatter
My Blog
0 Kudos
Message 85 of 89
(2,101 Views)

Hi Rolph, 

 

I have been trying to implement the function Picam_WaitForAcquisitionUpdate() using your previous tips and my current understanding of how to deal with pointers in LabView (also I looked into some examples that are already in SDK). The WaitForAcquisitionUpdate.vi appeared to be a bit cumbersome, and that's why I tend to think that there are things that are implemented incorrectly or not in a safe manner. Could you please take a glance?

 

Here is the screenshot (I also attach the current version of the SDK).

waitForAcquisitionUpdate.png

0 Kudos
Message 86 of 89
(2,082 Views)

i can’t really judge if the indexing of the buffer in the AvailableData cluster is safe. For that I would need to study the API documentation and the sample C code I guess.

Your second typedef definitely is wrong. There need to be no filler byres at all as the first is an int32 and the second is at most an uint32 (could be smaller but for now leave it as uint32). That makes the third value align nicely on an 8 byte boundary, without any fillers, as it should. And the 64 bit case should be really the same for this parameter.

Rolf Kalbermatter
My Blog
0 Kudos
Message 87 of 89
(2,068 Views)

Thanks Rolf! I have introduced the corrections that you suggested. Regarding indexing I took that part from the Picam_Acquire() case which Blokk has implemented in his initial SDK, so I decided to trust him 🙂 But you are right, I should rather double check on this.

0 Kudos
Message 88 of 89
(2,058 Views)

I have added the current version of the picam32.dll LabView SDK to the following GitHub repository: https://github.com/ZumbiAzul/picam32_LabView_SDK

 

Hopefully, the interested community will take on from there and develop it further!

Message 89 of 89
(1,962 Views)