Go to Post so this is going to sound really dumb but remember that i am a mechanical guy. - Greg Needel [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-02-2007, 12:06
Spencer E.'s Avatar
Spencer E. Spencer E. is offline
Android junkie
FRC #1305 (NNSRI Ice3 (cubed))
Team Role: Alumni
 
Join Date: Apr 2005
Rookie Year: 2004
Location: Ontario, Canada
Posts: 91
Spencer E. has a spectacular aura aboutSpencer E. has a spectacular aura about
Send a message via MSN to Spencer E.
How do YOU find the distance from the light?

I'm currently using a tan table I compiled from a C program I wrote and stuck that in my robo code. Then I use the angle between the camera and the light and use my look up array to find the tan value of that angle. Then, my code will subtract the height of the camera from the height of the light and that number will be divided by the tan value. Voila, distance from the rack! I was just wondering how every one else finds the distance. Maybe something more creative?
  #2   Spotlight this post!  
Unread 23-02-2007, 12:22
Samuel H. Samuel H. is offline
Registered User
no team
 
Join Date: Dec 2005
Rookie Year: 1000
Location: World
Posts: 40
Samuel H. has a spectacular aura aboutSamuel H. has a spectacular aura about
Re: How do YOU find the distance from the light?

I don't find the distance, I just use a PD loop on the tilt angle to home in on the correct distance.
__________________
Team 931 Alumni
Freshman
South Dakota School of Mines and Technology
  #3   Spotlight this post!  
Unread 23-02-2007, 13:00
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: How do YOU find the distance from the light?

if(TILT_SERVO > 20)
{
// drive towards the light
}
else
{
// score
}


K.I.S.S.
__________________
http://www.mikesorrenti.com/
  #4   Spotlight this post!  
Unread 23-02-2007, 14:21
Chris_Elston's Avatar
Chris_Elston Chris_Elston is online now
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 746
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: How do YOU find the distance from the light?

The CMU camera reports a blob or size.

If the object is far away the blob size value will be small. If the object is close to you, the blob will be a large value. A blob is the green light.

Since the green light is a fixed object size, and your camera FOV (field of view) is a fixed size, you can mark out calibration points on the floor to determine a relationship of depth perception.

For example setup your camera and light, look at the size number the camera reports.

If your ten feet away, record the size of the blob, mark out set distances on the floor with masking tape. 0 feet, 1, 2, 3, 5, 10, 20 feet. Move camera to each distance. Record camera values.

You should get a fairly linear relationship in distance to size of blob the camera is reporting back to the RC.

Once you have this distance calibrated, you now can convert these values to a distance measurement.

Example maybe 100 "blob size" values equal 5 feet, you should also be able to calculate your cameras resolution value.

1 pixel = so many inches... This will be your robot accuracy.

Word of caution. Calibration with this procedure will change if you:

1. reteach the camera to a different color or RGB signature.
2. re focus the camera lens be twisting the lens.

If you do any of the above, you must repeat your calibration procedure to obtain this highest point of accuracy.
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #5   Spotlight this post!  
Unread 23-02-2007, 14:58
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: How do YOU find the distance from the light?

If tilt_servo < 220
drive
else
at rack
  #6   Spotlight this post!  
Unread 23-02-2007, 15:27
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,112
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: How do YOU find the distance from the light?

We have a short lookup table that turns camera tilt into desired travel distance. If the tilt is too close to horizontal for the range of the table input, we know we're "very far" and pretend the destination is six feet in front of the robot. If the tilt is too close to vertical, we know we're "too near" and pretend the destination is six inches *behind* the robot.

The table was filled in empirically, by placing the robot exactly where we wanted and putting zero in the table for that tilt angle. Then we moved it back until the tilt angle changed and put the measured distance in the table. Repeat as desired, with some interpolation and lazy entries at the extremes. There's actually a range of about five tilt angles that we call "close enough" to score; they all have zeros in their associated table entries.
  #7   Spotlight this post!  
Unread 23-02-2007, 16:19
Bongle's Avatar
Bongle Bongle is offline
Registered User
FRC #2702 (REBotics)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Waterloo
Posts: 1,069
Bongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond repute
Send a message via MSN to Bongle
Re: How do YOU find the distance from the light?

Quote:
Originally Posted by Chris_Elston View Post
The CMU camera reports a blob or size.

If the object is far away the blob size value will be small. If the object is close to you, the blob will be a large value. A blob is the green light.
This is how 1281 did it last year. It was accurate to about +-5cm for us. We calibrated just like you did. We got blob sizes at various known distances, then figured out a matching function.

Nitpick: The blob size decreases proportional to an inverse quadratic, not linearly. Although I suppose for a range of distances it can be approximated by a linear decrease.

Last edited by Bongle : 23-02-2007 at 16:23.
  #8   Spotlight this post!  
Unread 20-03-2007, 16:46
Red Mage's Avatar
Red Mage Red Mage is offline
Owner of Holistic Omniscience
FRC #1546 (Chaos Inc)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: New York
Posts: 35
Red Mage is on a distinguished road
Send a message via AIM to Red Mage
Re: How do YOU find the distance from the light?

I haven't used it yet, but I think the formula works out like this
We take a cross-section of the field
The camera is looking at a light
We know that angle, it's the tilt of the camera.
We also know the height of the light compared to the height of the camera, it's a constant.
The tan(camera_tilt_angle) = height_of_light / distance_from_rack

that's it.

I think...
__________________
Don't Blink. Blink and you're dead. Don't turn your back. Don't look away. And don't Blink. Good Luck.
  #9   Spotlight this post!  
Unread 21-03-2007, 17:52
Vogel648 Vogel648 is offline
Student Programming Leader
FRC #0648 (QC Elite)
Team Role: Student
 
Join Date: Mar 2007
Rookie Year: 2004
Location: Sherrard
Posts: 64
Vogel648 is on a distinguished road
Re: How do YOU find the distance from the light?

finding the distance is a bit unnessisary, and just provides extra load for your program. We just use the angle the camera is pointing as mentioned earlier in this thread.
  #10   Spotlight this post!  
Unread 21-03-2007, 18:01
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: How do YOU find the distance from the light?

if (pid_isDone(&robot_dist) == 1) {
auto_subr = rsm_scoring;
}
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY
  #11   Spotlight this post!  
Unread 22-03-2007, 12:51
marccenter's Avatar
marccenter marccenter is offline
Registered User
FRC #3548 (RoboRavens2)
Team Role: Coach
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Royal Oak
Posts: 406
marccenter has a spectacular aura aboutmarccenter has a spectacular aura about
Re: How do YOU find the distance from the light?

Team 1286 never really used a distance table, just the tilt angle position in counts (0 to 254). I found that the tilt angle position was about 170 counts at the starting position. Near the rack, with the camera locked on the counts increased to about 192 counts. So, the main part of the program drove forward, slowly, let's say 160 forward pwm counts (we have a tank tread design and lot's of friction) the entire 15 seconds. Next , a lookup table was used to subtract from the pwm counts as tilt angle changed. So, let's say the table at 170 counts gave 0 (no change) and at 192 counts gave 15 counts (enough to stop the robot).
As the robot moves forward, the tilt angle position in counts subtracts more and more from the forward pwm counts (160, 159, 158 to 145) which stops the robot.
__________________
Marc Center
FIRST FRC Mentor/Coach - Team 3548 Royal Oak RoboRavens#2 - on Sabbatical 2017 season
marc.center@gmail.com
Mobile: 248-255-7377
  #12   Spotlight this post!  
Unread 24-03-2007, 08:40
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: How do YOU find the distance from the light?

BTW, you can use the location of the light in the raster to adjust the servo position to be more accurate. That is, if you take the servo positions, you can add or subtract the pixel location of the light (scaled) to have a real value.

You can even do this without trig, although this becomes less accurate as you get closer to the edge of the screen.

I did the research last year. I don't have the code in front of me, so I can't give details.
  #13   Spotlight this post!  
Unread 24-03-2007, 08:56
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: How do YOU find the distance from the light?

How do we find the distance from the rack? Our driver observes the light rays being bounced off the robot, field, and rack, and reacts based on this information.

But seriously, I tried a tan lookup and had no luck; it kept returning very negative numbers, and it was ship date when I started working on it, so I didn't bother to troubleshoot--I scrapped it.

Auton doesn't seem that important anyhow.

JBot
__________________
Aren't signatures a bit outdated?
  #14   Spotlight this post!  
Unread 24-03-2007, 20:44
mluckham's Avatar
mluckham mluckham is offline
Registered User
FRC #0758 (Sky Robotics)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Ontario, Canada
Posts: 116
mluckham will become famous soon enoughmluckham will become famous soon enough
Re: How do YOU find the distance from the light?

Quote:
If tilt_servo < 220
drive
else
at rack
Ha-Ha! Thanks for distilling a what appears to be complicated thing to understand down to it's essence!
Closed Thread


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 wire the team light coolguybigt Robot Showcase 2 21-02-2007 22:18
How to make the camera search the light instead of only follow when targeted? jesusescobar Programming 4 18-02-2007 16:56
where can i find how the ringer is deployed by the ...... waialua359 Rules/Strategy 7 08-02-2007 10:39
camera trouble,cant tell the green-light from regular white light Nimmy Programming 26 14-01-2007 14:53
How do I get distance between Camera and the target? sjung9442 Programming 5 27-01-2006 09:44


All times are GMT -5. The time now is 10:59.

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