Go to Post Have you ever found yourself staring at a physics problem, not understanding it, then connected it to a past FRC game and suddenly felt the light bulb start shining? - StephLee [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 09-01-2013, 02:51
nickcvet89 nickcvet89 is offline
Registered User
FRC #1228 (RoboTribe)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2003
Location: Rahway,NJ
Posts: 99
nickcvet89 will become famous soon enough
Send a message via AIM to nickcvet89
Shooter Targeting with Camera

Hey guys, my team is interested in programming our robot to track the rectangles. As of right now we plan to use mecanum wheels, so we are only programming to track the rectangles to give us height to adjust our shooter. We figure with the mecanum wheels, we will be able to rotate towards the target on our own. How would we be able to use the camera to adjust the height of our shooter during teleop? Let's say for example we plan to use a motor like window motor for this function. We want to program our shooter to be a turret only the left to right would be left out of the program. I have no experience with the any of the camera programming from years past. Can someone please help with how to begin this program?
__________________
Reply With Quote
  #2   Spotlight this post!  
Unread 09-01-2013, 07:24
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: Shooter Targeting with Camera

The camera defaults to using a coordinate system where 0,0 is in the top right of the image and the sizeX,sizeY is in the bottom right. Since this is pretty meaningless for driving a robot, the example code scales it to be 0,0 in the center with negative 1 at the top edge and positive 1 at the bottom edge.

Since this is somewhat like a joystick, it or the inverse of it should work better to move motors or servos.

The first thing I'd do is hold it by hand and plot the position on a chart or at least display it on the screen. Get a sense of what it outputs. Then pretend to be the motor, moving it according to the output number. This helps you to learn the relative magnitude, directions, and numeric signs of the values involved.

To control the motor, you have several options.
Bang-bang control- Your camera is either above, below, or on target. If below, turn motor at a fixed speed to move it up. If above, move the other way at a fixed speed. If on target (generally less than delta away), leave it there.

Proportional- Similar, but you use the distance away from the target to scale your motor speed to get there faster and slow down as you approach.

PID and other variations - An even more complex method of approaching the target faster but trying not to overshoot and trying to overcome nonlinear elements like stiction. I don't think it is necessary here.

My recommendation is to choose a slow to moderate speed and start with bang-bang or proportional.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 10-01-2013, 21:33
nickcvet89 nickcvet89 is offline
Registered User
FRC #1228 (RoboTribe)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2003
Location: Rahway,NJ
Posts: 99
nickcvet89 will become famous soon enough
Send a message via AIM to nickcvet89
Re: Shooter Targeting with Camera

Thanks Greg, will try this soon.
__________________
Reply With Quote
  #4   Spotlight this post!  
Unread 11-01-2013, 00:37
propionate's Avatar
propionate propionate is offline
Team co-lead and LabVIEW programmer
AKA: Stephen
FRC #1732 (Hilltopper Robotics)
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Milwaukee
Posts: 93
propionate is on a distinguished road
Re: Shooter Targeting with Camera

Even though your original question was answered, I would like to take this time to point out that the camera's ability to track improves dramatically with the addition of an LED ring around the camera's lens to illuminate the reflective tape. In addition, the website below provides some helpful walkthrough's if you have trouble setting up the camera:

http://wpilib.screenstepslive.com/s/3120/m/8731
Reply With Quote
  #5   Spotlight this post!  
Unread 11-01-2013, 19:12
nickcvet89 nickcvet89 is offline
Registered User
FRC #1228 (RoboTribe)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2003
Location: Rahway,NJ
Posts: 99
nickcvet89 will become famous soon enough
Send a message via AIM to nickcvet89
Re: Shooter Targeting with Camera

Thanks. Will order the LED ring this weekend.
__________________
Reply With Quote
  #6   Spotlight this post!  
Unread 11-01-2013, 22:37
propionate's Avatar
propionate propionate is offline
Team co-lead and LabVIEW programmer
AKA: Stephen
FRC #1732 (Hilltopper Robotics)
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Milwaukee
Posts: 93
propionate is on a distinguished road
Re: Shooter Targeting with Camera

Tip: Our team found blue and green to be the best colors to use in terms of LabVIEW being able to isolate the color/luminosity. They are relatively cheap however, and you may as well buy a number of different kinds.
Reply With Quote
  #7   Spotlight this post!  
Unread 12-01-2013, 08:59
Ido_Wolf's Avatar
Ido_Wolf Ido_Wolf is offline
LabVIEW Addict
AKA: Ido
FRC #2230 (General Angels)
Team Role: Alumni
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Israel
Posts: 42
Ido_Wolf is an unknown quantity at this point
Re: Shooter Targeting with Camera

Quote:
Originally Posted by propionate View Post
Tip: Our team found blue and green to be the best colors to use in terms of LabVIEW being able to isolate the color/luminosity. They are relatively cheap however, and you may as well buy a number of different kinds.
Kind of a stupid reason to mention that, but at least in my region, while the official competition is held in a close hall, the off-season events occur under blue sky So I'd generally go with green as it seems to be the safest choice in any case.

Either way, when you go with intensity in the Monochrome options of Vision processing, it'd usually be the most "intense" color in the arena one way or another...though it seems to me that choosing a specific color in the monochrome tab eliminates other colors in the frame much better than intensity.
Reply With Quote
  #8   Spotlight this post!  
Unread 14-01-2013, 13:16
BenGrapevine's Avatar
BenGrapevine BenGrapevine is offline
Head Programmer
AKA: Tony Simmering
FRC #2549 (Millerbots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Minneapolis, Minnesota
Posts: 46
BenGrapevine is an unknown quantity at this point
Re: Shooter Targeting with Camera

Quote:
Originally Posted by Ido_Wolf View Post
Kind of a stupid reason to mention that, but at least in my region, while the official competition is held in a close hall, the off-season events occur under blue sky So I'd generally go with green as it seems to be the safest choice in any case.

Either way, when you go with intensity in the Monochrome options of Vision processing, it'd usually be the most "intense" color in the arena one way or another...though it seems to me that choosing a specific color in the monochrome tab eliminates other colors in the frame much better than intensity.
A suggestion is a suggestion and I personally found it very helpful. I have been hounding vision topics to see if people actually recommend using them in the first place so color really doesnt matter to me (although it does appear from reading that cool colors work better).
__________________
Millerbots Team 2549
orange and blue
Reply With Quote
  #9   Spotlight this post!  
Unread 15-01-2013, 01:34
nickcvet89 nickcvet89 is offline
Registered User
FRC #1228 (RoboTribe)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2003
Location: Rahway,NJ
Posts: 99
nickcvet89 will become famous soon enough
Send a message via AIM to nickcvet89
Re: Shooter Targeting with Camera

I have noticed in some of the other threads here and on the vision proscessing section of the screensteps page that I should use the example "Rectangular Target- 2013.lvproj. The way I'm planning to track the center rectangle is to create what states the camera is at in the vision processing vi based on where it is located on the coordinate system (ex. center, above, below, notfound) and pass this info through the robot global data vi for use in my teleop or autonomous vi. I noticed from frcmastery.com videos that was the way they did vision processing in the past competitions. Am I right to think this way or is there an easier way of doing this?
__________________
Reply With Quote
  #10   Spotlight this post!  
Unread 15-01-2013, 01:53
propionate's Avatar
propionate propionate is offline
Team co-lead and LabVIEW programmer
AKA: Stephen
FRC #1732 (Hilltopper Robotics)
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Milwaukee
Posts: 93
propionate is on a distinguished road
Re: Shooter Targeting with Camera

Hopefully I'm getting your post correct: You are going to integrate the Rectangular Vision Tracking VI into your robot project, store the target coordinates in global variables, and then use those coordinates to adjust the shooter in Auton/Teleop?

Sounds like the correct approach to me! Good luck.
Reply With Quote
  #11   Spotlight this post!  
Unread 18-01-2013, 00:08
nickcvet89 nickcvet89 is offline
Registered User
FRC #1228 (RoboTribe)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2003
Location: Rahway,NJ
Posts: 99
nickcvet89 will become famous soon enough
Send a message via AIM to nickcvet89
Re: Shooter Targeting with Camera

yeah the one thing I noticed though, when I integrated the rectangular target example, the robot global data vi. in my project was overwritten with the one from the example. This created a problem in my code because the Robot Mode global variable no longer existed. Could I just copy the vision processing vi. from that example and overwrite the one in my project?
__________________
Reply With Quote
  #12   Spotlight this post!  
Unread 18-01-2013, 01:46
propionate's Avatar
propionate propionate is offline
Team co-lead and LabVIEW programmer
AKA: Stephen
FRC #1732 (Hilltopper Robotics)
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Milwaukee
Posts: 93
propionate is on a distinguished road
Re: Shooter Targeting with Camera

I don't have a cRIO to test this code on here at home, but here's what I did just now (to a new 2013 robot project) that seems to work:

(Create a back-up of your program before following these steps. If you want to give this thread another day or two to see if someone responds with a more elegant or more correct solution, feel free to do so)

1. Create a copy of the "Rectangular Target - 2013" folder that can be found in your LabVIEW program files (let me know if you need help finding it).
2. Move this copied version of the folder into your project folder
3. Open up your project
4. Right click on Vision Processing.vi and click "replace," then select the Vision Processing VI in the "Rectangular Target - 2013" folder that you just copied.
5. Follow the prompts. You'll be told that there are conflicts. For all of them, select the file that was in your original project - not the one that is in the "Rectangular Target" folder.
6. The final prompt will ask again if you want to use the new Vision Processing VI instead of your original one. Confirm that you want to use the one in the "Rectangular Target - 2013" folder.

Once you save the project, go into the new Vision Processing VI and search for the broken wires. You will have to create a new global variable to replace the one that you told it not to reference anymore.
Reply With Quote
  #13   Spotlight this post!  
Unread 18-01-2013, 06:44
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: Shooter Targeting with Camera

The steps you lay out sound similar to the Tutorial on LV's Getting Started screen that leads through the steps in incorporating the vision example.

Greg McKaskle
Reply With Quote
  #14   Spotlight this post!  
Unread 20-01-2013, 00:43
team3039 team3039 is offline
Registered User
FRC #3039
 
Join Date: Jan 2013
Location: Destrehan, LA
Posts: 34
team3039 is an unknown quantity at this point
Re: Shooter Targeting with Camera

I created a custom .vi based on the Rectangle Target Vision Processing example provided with LabVIEW to be incorporated into the dashboard. I'm currently working to put the controls on the dashboard to quickly change the settings of the vision processing on the go. If you want my custom .vi and experiment with it, I'd be happy to PM it to you with instructions on how to implement it.
Reply With Quote
  #15   Spotlight this post!  
Unread 20-01-2013, 15:22
joemost joemost is offline
Registered User
no team
Team Role: Engineer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: New Hampshire
Posts: 39
joemost will become famous soon enough
Re: Shooter Targeting with Camera

Has Anyone found any luck with tracking shapes other then rectangles. My team is looking to track objects like trapezoids and other shapes.

Any luck?
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 21:47.

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