PDA

View Full Version : inevitably restart LabVIEW after unplugging the camera during a program run



SLcroc
August 11, 2016, 23:28:29
Hi,

After an error due to ESD or the unplug of the camera, the camera didnt stop correctly (i.e. without using the "IC_clear.vi").
If i reload the Vi program, it no longer works (camera not recognized + a bunch or errors, even if my Vi starts with the "IC_clear.vi"), and i have to inevitably close/restart LabVIEW, probably to reload in memory the ActiveX (or other IC driver/file ?).

is there any way to reload this directly in my program, without close/reload LabVIEW (and all NI programs) ?
maybe a call to a close/open activex, or something like that ?

in advance, thx for your help !

Stefan Geissler
August 12, 2016, 09:45:32
Hello

I am very sorry, but LabVIEW can not reload an ActiveX. As far as I know this. You may ask the LABView support about this.

I suppose, you use a USB or FireWire camera.
If a camera is unplugged, the Windows Device Manager will recognize this and send a message to the running programs. IC Imaging Control has the Device Lost event, which is fired in such a situation, so you can handle that.

I guess a little bit more, because I do not know, what you are doing with the camera.
The IC_Grab*.VIs use the IC.MemorySnapImage. If there was not time out set (IC.MemorySnapTimeout) this function will wait for inifinity for an image, even if the camera was disconnected. This will block your entire LabVIEW VI and you must restart LabVIEW to recover. So you may set a timeout at the beginning of your vi.

SLcroc
August 12, 2016, 22:44:20
Hi, thx for your reply.

Yes, it is USB camera.


The IC_Grab*.VIs use the IC.MemorySnapImage. If there was not time out set (IC.MemorySnapTimeout) this function will wait for inifinity for an image, even if the camera was disconnected. This will block your entire LabVIEW VI and you must restart LabVIEW to recover. So you may set a timeout at the beginning of your vi.
right, this is exactly what happens. i'll take a look on this timeout, and also on the Device Lost event sent to IC Imaging Control.

many thx.

SLcroc
August 13, 2016, 23:45:35
Hi,

i did a test.

With IMAQdx (vision acquisition software of NI) :
- i start the acquisition,
- unplug the camera while the Vi is running,
- wait in a loop for reinitialization until the re-plug,
- then reinitialize the camera, and continue the acquisition without any crash/bug/force to close NI environment.


The re-detection is almost immediate, and is working fine.
Why is it impossible with the IC Imaging Control ??


i'm confused

Bye.

Stefan Geissler
August 15, 2016, 12:44:26
Yes, it is. IC fires the DeviceLost event, it a used device is disconnected. After that happens, you can setup a time and in the timer event, you can check, whether the camera came back and use it again.
http://www.theimagingsource.com/support/documentation/ic-imaging-control-activex/event_descICImagingControl_DeviceLost.htm