Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

where am I wrong using queue to control vision loop and motion control loop?

Hello,

 

Take a look again at the example that I originally posted which demonstrates how to use a queue. There is a note there explaining where the data type is set. The data type of your x position is a DBL which means that is what you should set the data type of the queue as. Also notice that in your current configuration, there is a red dot on the input terminal of the enqueue element. This red dot means that LabVIEW is casting the data types in order to make them match. Thus, when you dequeue the element, it is in the default data type that you originally set. You would either need to cast that data back to DBL or set your queue for DBL data types in the beginning.

 

-Zach

Message 11 of 17
(1,730 Views)

i hey,iZACHdx,

I didn't realize I can put the terminal of data type. I just try to create constant/control at data type input of  Obtain Queue. So, I cannot wire them.

Right now, I put DBL at input of Obtain Queue. It works. the red dot is still there. Anyway, is this right ?

Also, Do I really need set time wait, which likes the example you posted?

Thank you very much! 

 

queue.jpg 

0 Kudos
Message 12 of 17
(1,714 Views)

Hello,

 

If you turn on context help by clicking Help»Show Context Help, you can hover your mouse over a wire to determine its data type. I would check the data types of the wires in order to make sure you are setting the properly to avoid casting. The example that I posted has a wait in the loop to control the execution speed. If it was not there, the loop would run extremely fast which was not the effect that I wanted when generating a random number with every iteration. For you, this would not be necessary.

 

-Zach

Message 13 of 17
(1,697 Views)

hey,

Understand. I try what you said. Position x is SGL. So, I put SGL at input of Obtain Queue. there are still red dot. maybe they need convert.

I think that's fine. If I did like last screenshot, it's right?

Thank you!

Guangli 

0 Kudos
Message 14 of 17
(1,693 Views)

Hello,

 

Yes, things look ok as long as your loop isn't held up by anything else. The red dot shouldn't be there if all the data types match, but casting between different numeric types should be ok.

 

-Zach

0 Kudos
Message 15 of 17
(1,674 Views)

Hi, iZACHdx,

I'm back. I was so busy in last two weeks  that I cannot run the program. Yesterday, I try to use it to control my project.

 The motor doesn't move. And the image acquire loop cannot run continuously. I'm not sure how the queue effect the program. it shouldn't change the original structure, right? It should transform or swithc between two loop automatically, right?  Please feel free to take a look!

 

Thank you very much!

 

Guangli

0 Kudos
Message 16 of 17
(1,624 Views)

Hi Guangli,

 

If all that you've added to your program is the queue, it shouldn't cause it to run slower or not at all. Have you tried running your program in highlighted execution to see where it might be getting hung up? Or better yet, place some probes in your program to see what values are being queued and dequeued to make sure the motor portion is getting non-zero values.

0 Kudos
Message 17 of 17
(1,599 Views)