Camera Target (x,y) Position

On the driver’s station, there’s the thing which shows whether the robot should turn left or right. I was wondering where in the LabVIEW 2010 default program I may be able to reference the coordinates of the ellipse the camera has found.

Code is being sifted through at this moment. I’ll re-post if you need more info or if we can find the variable. Thanks in advance.

I believe that the information you are looking for is within the TARGET INFO global variable.

Note that this can have more than one target within this array of clusters. The highest scoring target is always sorted to #0.

We extract the target info by first indexing the array with a “0”, then unbundling the cluster for the X and Y values

I have located said reference.

It was a pain going through all of the clusters and indecies, so I turned it into a vi. I have attached it to this post. It should work with any code that runs the standard vision processing. It spits out (x,y) coordinates to your program.

camTarPos.vi (7.04 KB)


camTarPos.vi (7.04 KB)

Once you get familiar with how clusters work and how to bundle and unbundle things by name, it’s a lot less painful. You did a whole bunch of work figuring out things in detail using simple “anonymous” unbundle steps. Here is something that does the same thing in fewer steps and with more built-in documentation using Unbundle by Name. It works a lot like structures in C, where you can drill down through multiple layers in one shot.

target position.jpg


target position.jpg

OK Alan … how’d you hack my computer? That’s the exact code we have in our targetting routines.

:yikes:

It is obviously the perfect code for the task. It does no more than is necessary.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.”
– Antoine de Saint Exupéry

Oh, C. How you were so perfect. Why is my team convinced that LabVIEW offers so many advantages?

Bah, no matter. Unbundle by name is quite superior to the mess I produced. Thank you.

Labview does not offer any hugely significant advantages over C (other than it being slightly easier to learn for complete coding newbies).

C does not really offer any hugely significant advantages over Labview. People enjoy arguing about it, but the simple fact is that you will always be more effective programming in a language you know.

I will say that as a labview programmer I envy the C teams and their lightening fast compile times compared to mine.