LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ Vision: Not An Image Error when using Producer/Consumer

Solved!
Go to solution

Hi veryone

I have used Vision Express to solve Patern Machine problem.

I want to put Assistant and Aquistion in 2 parallel loop. So I have used Producer/Consumer to transfer data

After Running VI, I have pressed Stop button and I met this error

I think Obtain Queue has a problem. I  changed Image Control to Contant and wire it to Element data type. I think this way is correct.

So when error occur, it address to IMAQ Coppy in Assistant. So I think I have used Queue Comunication not correctly.

How can I fix it

thank

error.png

you can see more detail in follow video: https://www.youtube.com/watch?v=i6FOQ2jypXc&feature=youtu.be

0 Kudos
Message 1 of 9
(4,839 Views)

Remove "Overlay Pattern Matching Results.vi" temporarily, see if you still get the error message.

It doesn't belong to the producer loop anyway.

 

 

George Zou
0 Kudos
Message 2 of 9
(4,827 Views)

You are disposing of the Image Queue twice, once when the Producer exits, and a second time when the Consumer exits.  Try deleting the Release Queue function after the lower loop exits (and delete the Queue wire after the Dequeue Element).  Note that you don't need (and probably don't want) the Get Queue Status in the Consumer -- instead, put the Dequeue Element there, wire a Timeout value (say 10 milliseconds) and wire the Timeout to the Case Statement (if it times out, just "do nothing").  Note that when the Producer releases the Queue, the Dequeue Element will error out, stopping the Consumer.

 

Bob Schor

0 Kudos
Message 3 of 9
(4,816 Views)

Hi

I have use your way. But I met this error when I pressed STOP button

Screenshot_7.png

error.png

 

How can I fix it?

0 Kudos
Message 4 of 9
(4,802 Views)

I have tried your way, But No Change

Do you have the other ideal?

0 Kudos
Message 5 of 9
(4,800 Views)
Anyone help me? How to fix error 1 with dequeue function?
0 Kudos
Message 6 of 9
(4,775 Views)
Solution
Accepted by topic author xaxa9ztb

Try this:

 

original2.png

 

You should put the image process in the consumer loop, and release it properly.

 

 

George Zou
Message 7 of 9
(4,768 Views)

I don't understand the "solution".  How does the Consumer loop exit?  The Stop is wired to the Error Line, which means that the Consumer Loop will stop when there is an error.  What is the error?  Well, the code you developed following my suggestion did the right thing -- when you stopped the Producer loop, you (correctly) released the Queue, which then (correctly) caused Error 1 on the Consumer Loop (since there was no Queue), which (correctly) stopped the Consumer loop.  The only "problem" with this code is that an Error 1 is reported from the Consumer loop.  Since you are expecting this error, you can use the Exception input on the General Error Handler to "Ignore Error on Match" and wire 1 into the Exception code.

 

The post you accepted as the "solution" should never exit.  When you press the Stop button, the Producer loop will exit, but will wait at the Merge Error function for the Consumer to stop.  The Consumer is waiting for an Error (Queue released), which hasn't yet come, so will just hang.  If, by some miracle, it did exit because of some other error, the errors would be merged, the Release Queue function would release the Queue, then the General Error Handler should (still) report an error.

 

Did you actually test this "solution"?  Did it really work?  Did it exit without reporting any error?

 

BS

0 Kudos
Message 8 of 9
(4,731 Views)

HI xaxa9ztb,

 

I believe that Bob is correct. The queue is not being destroyed by the the Queue Release function, and so the Consumer loop never errors out. You can pass a queue reference around the Producer loop so that the queue will be destroyed and release the Consumer. If you go to File -> New ... then you can use the premade application templates.

 

ProducerConsumerSnippet.png

0 Kudos
Message 9 of 9
(4,705 Views)