Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

one-shot acquisition AVT Guppy

Dear

I'm trying to acquire 1 one image using the trigger input of a AVT Gyppy F-080B camera.

In the manual of the Guppy I found the "One-shot" mode to acquire just one image from the camera using the trigger input.

So far I have the code attached that sets the registers of the camera, I think that's ok.

What I'm not so sure of is the sequence behind:

1) Do I need to start an acquisition using IMAQdx Start Acquisition.vi (I think yes since I don't get an image without this vi)

2) How do I retrieve the image from the camera? Using IMAQdx Get Image.vi or IMAQdx Grab.vi.

With both vi's I get an image out of the camera but... ...

I never gave a trigger pulse 😞

 

Using the max I was able to get an image on a trigger pulse

Acquisition attributes\Timeout set to 20000

Camera attributes\Trigge\Trigger Activation = High level

Camera attributes\Trigge\Trigger Mode = Mode 0

Camera attributes\Trigge\Trigger Parameter = 0 (no idea what this is)

When I then click the "Snap" button, nothing happens until I activate the trigger line of the camera.

Only at that time I get an image in the MAX.
If I wait more than 20 seconds I get an error message.

This is exactly what I need, but I can't translate it into LabVIEW code 😞

 

What am I doing wrong?
Thanks for any inputs!

Best regards

0 Kudos
Message 1 of 12
(5,722 Views)
You can hit "Save" in MAX and then just do a basic acquisition in LabVIEW and it will use the same settings as you were using in MAX. This avoids needing to code anything specific. You can also programmatically set the same attributes as you were using in MAX. You can't mix and match manual register settings that conflict with IMAQdx's own trigger settings unless you are careful, since they will stomp on each other.
Message 2 of 12
(5,713 Views)

Thanks for the input!

I got it working using the "Snap.vi" instead of "Grab.vi"

Setting the parameters in LV or MAX doesn't influence the result.

 

Now the "Snap vi" is waiting for a trigger, once it comes the picture is shown.
Is there a method to "kill" the snap vi while the waiting is ongoing?

 

0 Kudos
Message 3 of 12
(5,691 Views)
Calling Stop will cause VIs blocking on a wait to abort.
0 Kudos
Message 4 of 12
(5,689 Views)

Are you sure about that ?

Please see attached vi on how I implement it.
For sure there is something wrong there 😞

 

When you click the Stop button the "stop" loops stops the acquisition but the acquisition loop is still running because of the Snap.vi.

(green arrow in the snap.vi when "highlight execution" is turned on)

Only after the time out the acquisition loop stops also.

 

Anyway, thanks for the very quick reply!

Best regards

0 Kudos
Message 5 of 12
(5,683 Views)

Hi Alain, You have actually created a depency between your two while loops by wiring the boolean stop button like that. I didnt have IMAQdx installed so I made a very simple design just to show you how it should look.

 

You need to create a local variable for your stop button by right klicking the control>>create>>Local variable. Place the variable in the other while loop and right klick that one>>change to read. And wire it to the conditional terminal of that while loop. Also make sure to change boolean action of your button to switching otherwise you will have compile error. See my image for better understanding.

 

As your code looks now it wont even enter the while loop with acquisition before you press true on the stop button. I also changed from polling your start button to waiting on it very effectivly with the event structure. You have to configure a event for stop button value change.

Example.PNG

 

Best Regards
Jonas Mäki
Systems Developer
Novator Solutions
Message 6 of 12
(5,675 Views)

Dear Jonas,

Thanks for the input regarding the "dependency" between both loops.

This is for sure better LV programming but my problem regarding "killing" the Snap vi while waiting for a trigger is not solved with your architecture, right?

 

I changed the code as you suggest.

I can capture an image with each trigger pulse, no problem, nothing changed.

But when I click the Stop button the acquisition loop stops only with the next trigger pulse or with a time out error.

 

I expect the Stop loop to stop immediatley but the IMAQdx Stop Acquisition vi don't "kill" the Snap vi in the acquisition loop as was suggest by BlueCheese.

 

 

I also noticed with this setup that the "StopLoop" indicator doesn't increment, just like if the Stop Loop isn't running ?!!?

Why is that?

 

Best regards

0 Kudos
Message 7 of 12
(5,672 Views)

Hi Alain,

 

I wasn't sure if the stop would actually work. I trusted BlueCheese on that. But apperantly it doesn't.

 

Why you dont see the StopLoop indicator increasing are because it is waiting for an event. Hense the name of the structure. It will wait very efficient for a user event on the stop button. The while loop will iterate only once in my example code image. Leaving you with the value 0.

 

I have some suggestions how you can implement a stop button but this will include polling and only one loop.

 

If you set your timeout to 500ms or 1s your snap VI will timeout more often and when this happens you should chech the error code and clear the error if a timeout occures and then check if the stop button was pressed and if it was stop the loop otherwise just iterate again. Would look something like this.

Example.PNG

I had 500 as timeout and therefore constant 40 would be if the camera timeouts for 20 seconds in a row without the stop button being pressed I quit the application. I also quit it every 500ms on stop button press and also on error other than timeout. I don't know the timeout error number but set that instead of 1 and you will have a working code.

 

Best Regards
Jonas Mäki
Systems Developer
Novator Solutions
Message 8 of 12
(5,668 Views)

Dear Jonas,

Thanks for this work around.

To be honest I was looking for a vi like the "DAQmx Control Task.vi" where you can configure the "action" input as "abort".

That stops the DAQ unconditionally!

 

Apparently such vi doesn't exists for IMAQdx 😞

 

Thanks for helping!

Best regards

0 Kudos
Message 9 of 12
(5,655 Views)

Hi Alain,

 

Maybe you can call the close VI that destroys the referense to the camera. I'm not sure that the Snap VI will notice while waiting for the timeout that the resource is gone though. Otherwise the polling technique is probably the closest thing you have.

Best Regards
Jonas Mäki
Systems Developer
Novator Solutions
0 Kudos
Message 10 of 12
(5,652 Views)