Go to Post Aww, but I ENJOY getting all up in arms about something that's ultimately inconsequential! - Cothron Theiss [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-01-2012, 13:33
frankthelyon frankthelyon is offline
Registered User
FRC #2557
 
Join Date: Jan 2012
Location: Tacoma
Posts: 23
frankthelyon is an unknown quantity at this point
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)
Reply With Quote
  #2   Spotlight this post!  
Unread 23-01-2012, 17:30
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 26-01-2012, 15:12
frankthelyon frankthelyon is offline
Registered User
FRC #2557
 
Join Date: Jan 2012
Location: Tacoma
Posts: 23
frankthelyon is an unknown quantity at this point
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 26-01-2012, 15:55
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #5   Spotlight this post!  
Unread 26-01-2012, 16:56
frankthelyon frankthelyon is offline
Registered User
FRC #2557
 
Join Date: Jan 2012
Location: Tacoma
Posts: 23
frankthelyon is an unknown quantity at this point
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?
Reply With Quote
  #6   Spotlight this post!  
Unread 26-01-2012, 20:16
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #7   Spotlight this post!  
Unread 26-01-2012, 22:24
frankthelyon frankthelyon is offline
Registered User
FRC #2557
 
Join Date: Jan 2012
Location: Tacoma
Posts: 23
frankthelyon is an unknown quantity at this point
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?
Reply With Quote
  #8   Spotlight this post!  
Unread 27-01-2012, 07:46
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #9   Spotlight this post!  
Unread 27-01-2012, 13:26
frankthelyon frankthelyon is offline
Registered User
FRC #2557
 
Join Date: Jan 2012
Location: Tacoma
Posts: 23
frankthelyon is an unknown quantity at this point
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?
Reply With Quote
  #10   Spotlight this post!  
Unread 27-01-2012, 14:36
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2012-01-27 at 1.34.05 PM.png
Views:	47
Size:	12.9 KB
ID:	11597  
Reply With Quote
  #11   Spotlight this post!  
Unread 27-01-2012, 15:48
frankthelyon frankthelyon is offline
Registered User
FRC #2557
 
Join Date: Jan 2012
Location: Tacoma
Posts: 23
frankthelyon is an unknown quantity at this point
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.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:32.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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