Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQdx with JAI and a hardware trigger

Hello,

We are working with two 'JAI AD-080' cameras and IMAQdx, and have two problems regarding the triggering and frame grabbing:

1)  We are unable to change the trigger source through IMAQdx property node or the Vision Acquisition Express; Vision Acquisition block.

2)  When we manually edit the trigger source property using the NI Measurement and Automation Explorer (MAX) to its correct value, we can't get all four of the CCD's to run at a time without resulting in bad packets, e.g. horizontal black lines across the images.

 

Our goal is to obtain the images from the 4 CCD's at a rate of 5 Hz using our hardware trigger.  We can already connect and obtain all four images at full speed, but the 5 Hz trigger is not being used by the cameras in that case.

 

Details of the setup:

NI 2011, Windows 7 

Two (2) JAI AD-080 cameras (with 2 CCD's each), GigE cameras connected over Ethernet

Hardware triggering at 5 Hz, on pin:  'Line 7 - TTL In 1'

 

Details of the problem:

 

(1)  Setting the trigger source not possible in Vision Express or IMAQdx property node

In order to use our hardware trigger, we have to set the camera property 'CameraAttributes::AcquisitionControl::TriggerSource' to a specific pin (Line 7 - TTL In 1).  This property is available in MAX, but is not usable in the Vision Express Block.  The property is present, but the values are invalid.  Here is what I think is happening:  the list of properties are read from the camera, but LabVIEW does not know what the valid values are for that property and it populates the value drop-down menu with whatever was loaded last.  This can be seen in figures 1 and 2 where the values in the drop down menu change.

Similarly, this property of 'Trigger Source' cannot be changed programmatically using the IMAQdx property node shown here: http://digital.ni.com/public.nsf/allkb/E50864BB41B54D1E8625730100535E88
I
 have tried all numeric values from 0 to 255, and most give me a value out of range error, but the ones that do work result in no change to the camera.

 

(2)  Lost packets in image during triggering

If I set the 'Trigger Source' property in MAX to the correct pin, save the configuration, and then use the Vision Acquisition Express block to connect to the camera, the triggering works properly (the hardware trigger is used and the images are received by LabVIEW at 5 Hz).  However, this only works for one CCD:  If i use the same code for all four CCD's at the same time, I get black bars on the images, and at least one of the CCD's result in an error in 'IMAQdx Get Image.vi'  (code -1074360308, -1074360316)

I tested this by using the configuration attributes created by the Vision Express Block, (The string used in the 'IMAQdx Read Attributes From String.vi'),  in the code we have been developing as well as a very simplified version which I have attached.  Those configuration attributes are saved in the text files:  JAI_Config_TrigON.txt and JAI_Config_TrigOFF.txt for using triggering or not respectively.  

 

 

 

So my final questions are:

 

Is there a problem with the IMAQdx because it doesn't recognize the trigger source value?

Do you have any suggestions for why there are bad packets and trouble connecting to the cameras when I load them with the trigger on attributes?

 

 

Thank you for your time - 

 

 

 

 

 

0 Kudos
Message 1 of 5
(5,167 Views)

Further Attachments:

Download All
0 Kudos
Message 2 of 5
(5,166 Views)

Further attachments:

Download All
0 Kudos
Message 3 of 5
(5,165 Views)

Hi,

 

1) Setting the trigger source not possible in Vision Express or IMAQdx property node

 

I'll have to do some checking. it is possible Vision Acquisition Express might have a bug that is causing it to not populate the drop downs properly for some reason. Do you know what version of IMAQdx you are using? Is it possible to download the latest version and see if that fixes this issue? In general Vision Acquisition Express's UI works the same as MAX's does so I would not expect different behavior.

 

As for setting it via the property node, please keep in mind that the Trigger Source is a feature that is "selected for" by another feature, Trigger Selector. This means that you have to first set the "context" of which trigger you wish to configure (generally "Frame Start") by setting the "Trigger Selector" attribute to a specific value, then you can set the Trigger Source to a certain value.

 

Another possible way you could do this is to just remove any configuration load inside your code and rely on the settings you saved in MAX (this is what is loaded when you open the camera). This simplifies your code and makes tweaking your camera configuration not require changing/rebuilding code. You can simply remove the "IMAQdx Read Attributes From String" VI from your code and it will use the settings from MAX.

 

2) Lost packets in image during triggering

I assume you have all 4 cameras connected to a switch that is then connected to your computer. The reason you are seeing missing data is likely due to dropped packets, probably because all 4 cameras are each trying to use the full 1000Mbit of bandwidth. The problem likely becomes more severe when you trigger them simultaneously because then all of them are sending their images at the exact same time rather than at independent rates. The simplest solution is to adjust the "Peak Dandwidth Desired" attribute in MAX (switch the attribute tree to "Show all attributes" and find it under the Acquisition Attributes->Advanced Ethernet section). If you set each camera to use no more then 250Mbit of bandwidth then they will all share the 1000Mbit bandwidth you have total. You can also solve this by putting a 4-port GigE Vision card so each camera has dedicated bandwidth.

 

Eric

0 Kudos
Message 4 of 5
(5,156 Views)

Hello,

Thank you for your response; especially the speed in which you responded and the level of detail.  

I have not solved the problem fully in LabVIEW yet, but I was able remove the black lines and apparitions from the images using different camera parameters.  

Since this was a significant victory I wanted to update:

 

 

1)  Version of IMAQdx?

I have IMAQdx 4.0, but the problem persists.

 

 

2)  Setting configuration files

Your suggestion to pay attention to the order in which the properties are set as well as using the MAX settings is very helpful.  I have not explored this feature fully, but I was able to successfully use MAX to set the default settings and then open the cameras programmatically without loading a new configuration file.  

 

 

3)  Bandwidth limitations

I modified the CCD's to only use 250 Mbits/second, but the lost packets (or missing lines/ apparitions) were still present.  

 

 

4)  JAI AD-080GE Specifics

I am using the JAI AD-080GE; and there are two settings for this camera that I want to mention:  


JAI Acquisition Control>> Exposure Mode (JAI)>>Edge pre-select
JAI Acquisition Control>> Exposure Mode (JAI)>>Delayed readout EPS trigger

The "Edge pre-select" mode uses an external trigger to initiate the capture, and then the video signal is read out when the image is done being exposed.

 

The "Delayed readout EPS trigger" can delay the transmission of a captured image in relation to the frame start.  It is recommended by JAI to prevent network congestion if there are several cameras triggered simultaneously on the same GigE interface.  The frame starts when the 'trigger 0' is pulsed, then stored on the camera, then is transmitted on 'trigger 1'.  

 

The default selection is the "Delayed readout EPS trigger", however, I do not know how to set the 'trigger 1' properly yet and I only have one connection available on my embedded board that is handling the triggering right now (I don't know if 'trigger 1' needs to be on a separate line or not).  Incidentally, the system does not work on this setting and gives me the black lines (aka lost packets/ apparitions).

 

I was able remove the black lines and apparitions using the "Edge pre-select" option on all 4 images with a 5 Hz simultaneous trigger.  I confirmed this using the "JAI Control Tool" that ships with the cameras.  I am unable to make this happen in MAX though, as the trigger mode is automatically switched to 'off' if I use the mode:  JAI Acquisition Control>> Exposure Mode (JAI)>>Edge pre-select

i.e. when manually switching the trigger mode to 'on' in MAX, "JAI Acquisition Control>> Exposure Mode (JAI)>>Delayed readout EPS trigger" option is forced by MAX.  The vise-versa is also forced so that if EPS mode is chosen, "Trigger Mode Off" is forced.

 

Additionally, there is a setting called:

Image Format Control>>Sync Mode>>Sync     &     Image Format Control>>Sync Mode>>Async

When the "Sync" option is chosen the NIR CCD uses the trigger of the VIS CCD.  In addition to using the "Edge pre-select" option, the "Sync" option improves the triggering results significantly.  

 

 

5)  Future troubleshooting

Since I cannot set the camera parameters manually in MAX (due to MAX forcing different combinations of parameters in 4), I am going to explore manually editing the configuration file and loading those parameters at startup.  This can be tricky since a bad combination will stall the camera, but I can verify the settings in JAI Control Tool first.  There is also an SDK that is shipped with the cameras, so I may be able to use those commands.  I haven't learned C/C++ yet, but I have teammates who have.

0 Kudos
Message 5 of 5
(5,125 Views)