Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Square recognition in Labview (http://www.chiefdelphi.com/forums/showthread.php?t=100956)

frankthelyon 23-01-2012 13:33

Square recognition in Labview
 
How can I get Labview to recognize the retroreflective squares of tape, and then perform an action? (Using the axis camera)

Alan Anderson 23-01-2012 17:30

Re: Square recognition in Labview
 
Look at the 2011 Vision Example project. It seeks the reflective rectangles and provides an array of information about each target it finds.

How you use that information is up to you. Two obvious things are to use the measured X coordinate to determine which direction to turn in order to line up with the hoop, and use the computed distance either to determine how far to drive or how hard to shoot.

frankthelyon 26-01-2012 15:12

Re: Square recognition in Labview
 
Okay. How can I, for example, implement the example code into teleop? Also, where is the X coordinate of the rectangle in the example code? I cannot find an X coordinate output.

Greg McKaskle 26-01-2012 15:55

Re: Square recognition in Labview
 
There is a tutorial that explains how to integrate the vision code into the framework code. In the end, it publishes the target info to a global, and the X and Y and distance are in that global array with values per target.

Greg McKaskle

frankthelyon 26-01-2012 16:56

Re: Square recognition in Labview
 
THANK YOU SO MUCH!!! I got the global.vi working, but how do I get the X and Y values into my teleop code?

Greg McKaskle 26-01-2012 20:16

Re: Square recognition in Labview
 
Drop the global into the teleop code and read the element about the targets. Then you can index the elements from the array and cluster as needed.

Greg McKaskle

frankthelyon 26-01-2012 22:24

Re: Square recognition in Labview
 
Okay, I dropped the front panel code into the teleop front panel, but there is no block diagram for the global. Can you provide some example code?

Greg McKaskle 27-01-2012 07:46

Re: Square recognition in Labview
 
There are two globals at the top of the Robot Main loop. They have a small globe on them and a name of the element they will read or write. I think you likely dragged the control on the global to the teleop VI, and it is somewhat confusing, I agree, that this copies the control, not the global.

Instead, drag the icon in the upper right, or duplicate one of the already existing global read/write nodes, place it where you want, and choose the new element by deselecting it and then clicking on it.

Greg McKaskle

frankthelyon 27-01-2012 13:26

Re: Square recognition in Labview
 
Okay, thank you. Now how do I connect the "target info" to an array? I want to have something like this:
if x-coordinate value of middle rectangle > ___: turn robot y-direction

How might I go about this?

Greg McKaskle 27-01-2012 14:36

Re: Square recognition in Labview
 
1 Attachment(s)
To read an element from an array, you use an Index Array node found in the array palette. To loop through each element in an array, simply have the wire cross the boundary of a loop, and if necessary, set the loop tunnel to index automatically. Once you find the target element you want, unbundle its X value and do the comparison or decision making and potentially set the motor speeds or update Robot Drive as shown in the attachment.

Keep in mind that controlling how much the robot turns, how fast, or for how long is often when teams will introduce a control loop and possibly another sensor such as a gyro. There are examples for some of these concepts that may help out.

Greg McKaskle

frankthelyon 27-01-2012 15:48

Re: Square recognition in Labview
 
Awesome, I got it working. Thank you so much for all your help, it has been very useful to our team.


All times are GMT -5. The time now is 11:44.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi