|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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)
|
|
#2
|
|||||
|
|||||
|
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. |
|
#3
|
|||
|
|||
|
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.
|
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
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?
|
|
#6
|
|||
|
|||
|
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 |
|
#7
|
|||
|
|||
|
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?
|
|
#8
|
|||
|
|||
|
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 |
|
#9
|
|||
|
|||
|
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? |
|
#10
|
|||
|
|||
|
Re: Square recognition in Labview
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 |
|
#11
|
|||
|
|||
|
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|