Go to Post Dean: We encourage kids to learn about science, technology.... Colbert: And does that include creation science? Dean: .... Well we teach kids to be very creative..... - Kevin Sevcik [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 26-01-2006, 21:12
sjung9442 sjung9442 is offline
Student Mentor
FRC #0122 (NASA Knights)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Hampton, VA
Posts: 17
sjung9442 is an unknown quantity at this point
How do I get distance between Camera and the target?

How do I get the distance between Camera and the green light?
Is it in the code? or do I have to use some other program to get the data?
I really don't understand it...
  #2   Spotlight this post!  
Unread 26-01-2006, 21:30
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: How do I get distance between Camera and the target?

Math.

If the target is centered, then:

(goal_height - camera_height) / tan(camera_tilt) = range

The problem is implementing a tan() function on the PIC - check the Whitepapers on Delphi for a few ways to do this (search for CORDIC).

Also, if the target is not centered, then you have to convert the vertical pixel error into an angle and add that to the camera_tilt value. This requires that you know the field of view angle of the camera lens.
  #3   Spotlight this post!  
Unread 26-01-2006, 21:34
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 I get distance between Camera and the target?

Quote:
Originally Posted by Abwehr
Math.

If the target is centered, then:

(goal_height - camera_height) / tan(camera_tilt) = range

The problem is implementing a tan() function on the PIC - check the Whitepapers on Delphi for a few ways to do this (search for CORDIC).

Also, if the target is not centered, then you have to convert the vertical pixel error into an angle and add that to the camera_tilt value. This requires that you know the field of view angle of the camera lens.
tan() is included in the latest version of C18 compiler (2.4 I believe)

It has been this way since (at least) last year.
__________________
http://www.mikesorrenti.com/
  #4   Spotlight this post!  
Unread 26-01-2006, 21:37
Unsung FIRST Hero
Greg Marra Greg Marra is offline
[automate(a) for a in tasks_to_do]
FRC #5507 (Robotic Eagles)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2005
Location: San Francisco, CA
Posts: 2,031
Greg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond repute
Re: How do I get distance between Camera and the target?

Quote:
Originally Posted by Mike
tan() is included in the latest version of C18 compiler (2.4 I believe)

It has been this way since (at least) last year.
The only problem with the trig functions on the RC is they take a very long time to execute (relatively speaking). If you try to do this often, you're going to create problems for the rest of your code.
  #5   Spotlight this post!  
Unread 26-01-2006, 21:41
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: How do I get distance between Camera and the target?

Quote:
Originally Posted by Mike
tan() is included in the latest version of C18 compiler (2.4 I believe)

It has been this way since (at least) last year.
I should have said a tan() that executes in a reasonable time. The PIC has no native floating point support - using your own integer-valued library can speed things up tenfold easily.
  #6   Spotlight this post!  
Unread 27-01-2006, 09:44
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: How do I get distance between Camera and the target?

Instead of doing the math, it might be simpler just to implement a lookup table. Put the robot 50 feet from the goal and measure the camera tilt angle. Move it a foot closer at a time and repeat. Put the answers in the program.

If you have an adjustable shooter, you can put the required barrel tilt/wheel speed/catapult stop bar location in the table instead of the distance.
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
Judging The Animations stevek 3D Animation and Competition 1 18-03-2003 07:57
stolen camera during team party at EPCOT archiver 2000 2 23-06-2002 22:51
Webcast camera angle... Joe Johnson Regional Competitions 13 11-03-2002 16:35
Baker Baby Pool Andy Baker Chit-Chat 56 18-07-2001 14:58


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

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