Go to Post Joining a FIRST team is the beginning of "smart," not the culmination. - klrswift [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
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 01-02-2009, 21:47
Steelix4532 Steelix4532 is offline
Registered User
AKA: Daniel Gradinjan
FRC #0269 (CooneyTech)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Wisconsin
Posts: 3
Steelix4532 is an unknown quantity at this point
Question how to find distance using two color servo camera?

i am having trouble calculating distance using two color servo camera example, i can do it just fine with one color but not with two. i am using labview. any help at all would be great!
Reply With Quote
  #2   Spotlight this post!  
Unread 01-02-2009, 22:30
a3aperez's Avatar
a3aperez a3aperez is offline
Registered User
no team
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Puerto Rico
Posts: 9
a3aperez is an unknown quantity at this point
Re: how to find distance using two color servo camera?

Team 330's BETA code calculates distance between the camera and the gimbal using PIDs. Perhaps you can modify it to your needs.

http://forums.usfirst.org/showthread.php?t=11298&page=2
Reply With Quote
  #3   Spotlight this post!  
Unread 01-02-2009, 23:11
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: how to find distance using two color servo camera?

Are you referring to calculating distance using a method similar to the one described here (by Kevin Watson)? It seems like it should be fairly easy to use the same tracking algorithm as you did for one color, but just find an average of the green and pink positions to find the center of the target, and then run your tracking algorithms off of that. You say you can do it with one color, so I won't bother going into the details of the visual servoing or distance calculation tasks.

However, this seems trivial enough that I'm wondering if you are referring to something else. Can you provide more detail?

--Ryan
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
Reply With Quote
  #4   Spotlight this post!  
Unread 01-02-2009, 23:11
nathanww nathanww is offline
Hacker
FRC #1678 (Citrus Circuits)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2007
Location: Davis, CA
Posts: 224
nathanww is just really nicenathanww is just really nicenathanww is just really nicenathanww is just really nice
Re: how to find distance using two color servo camera?

There are a couple of ways to calculate distance with a camera. The ones I can think of off the top of my head are:
  1. Figure out what part of the visual field the object occupies, and assume that higher=farther
  2. Use relative size--based on the law of perspective, the farther an object is, the fewer pixels it will occupy
  3. If the object isn't moving, you can use the laws of parallax to calculate the distance based on apparent movement at a given robot speed.
__________________
Get yer robot source code here!
Reply With Quote
  #5   Spotlight this post!  
Unread 06-02-2009, 17:20
nheft nheft is offline
Registered User
FTC #0533 (Psichotics)
Team Role: Engineer
 
Join Date: Jan 2006
Rookie Year: 1999
Location: Lindenhurst HS
Posts: 35
nheft is a jewel in the roughnheft is a jewel in the roughnheft is a jewel in the roughnheft is a jewel in the rough
Re: how to find distance using two color servo camera?

Here's what Team 533 did to get distance from the camera:

We started with the 2 color tracker sample project supplied by FIRST.

Once we got the tracker working, the top level VI for the 2-color camera code displayed some calculated parameters including "percentage of area".

This number is the ratio of the size of the target as seen by the camera divided by the area of the camera's entire field of view. The farther away the target, the smaller this ratio is. The percentage of area ratio is approximately proportional to the reciprocal of the square of the distance. So distance is approximately proportional to the reciprocal of the square root of the "percentage of area" value:

DISTANCE = K / SQRT(% OF AREA)

(there is a more exact relationship that involves trigonometric functions but the above simple approximation is good enough to judge distances to within a few inches)

We placed the target exactly 4 feet away from the camera and measured the % of area value, then solved for K:

K = (4 feet) * SQRT(Measured % of area when target is at 4 feet).

Next we programmed the formula DISTANCE = K / SQRT(% OF AREA) with the
K value we measured and added an indicator to the fromt panel.

Finally, we tested the revised code at various distances. Since the equation is only an approximation, there is some error but we were able to obtain distance measurements within a few inches using this method.

Neil
Advisor, Team 533
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do YOU find the distance from the light? Spencer E. Programming 13 24-03-2007 20:44
how do i find the camera with labview? CompMaster NI LabVIEW 0 16-02-2006 12:52
How do I get distance between Camera and the target? sjung9442 Programming 5 27-01-2006 09:44
How many teams are using the Camera? Matt Goulart Programming 5 06-02-2005 15:06
How many teams are using the Camera? Matt Goulart Electrical 3 30-01-2005 09:29


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

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