Go to Post I read every darn page of this thread. - Paul Copioli [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 15-01-2005, 00:33
russell's Avatar
russell russell is offline
Registered User
#1430 (WRONG)
Team Role: Electrical
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Anchorage AK
Posts: 402
russell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to all
Camera Range Finding

Ok I am new to programming, but I am supposed to be figuring out how we can use the camera this year. Now it looks easy enough to make the robot get to the vision tetra, but obviously it needs to know when it gets there. My first thought was to use one of the light sensors from last year and turn up the sensitivity so they would see any reflected light from a tetra, but that seemed kind of iffy. Now I am thinking of using the tilt of the camera to compute the range of the target. My plan was to run a cable from the tilt servo port on the camera then split it and run one end to the servo, and another to the RC, then monitor the signal on this cable in order to tell where the servo was supposed to be, then when it gets to the proper angle it starts up the code that makes the robot pick up the tetra. But just now I was going over the code and I noticed this in user_routines_DDT.c:

Quote:
/********************************************
** VISION VARIABLES **
*********************************************/
int pan_dir=0;
int state=0;
int latch=0;
int latch2=0;
extern unsigned int index_ptr;
extern unsigned int data_rdy;
extern cam_struct cam;

int color=0;
const int steering_comp = 30; //steering compenstation (0 to 127)
const int speed_setting = 150; //forward speed setting (127 to 254)
extern int pan_position,tilt_position,tracking;
unsigned int speed_control;
Notice that on the second to the last line it seems to be setting up a variable that monitors the tilt position. Can someone tell me whether my analysis is correct, and how I can access this for an if/then statement basically saying that if this value is above or below a certain number it needs to do something.
  #2   Spotlight this post!  
Unread 15-01-2005, 00:54
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: Camera Range Finding

Yes. This is precisely why they have the camera on the TTL port: so you can have access to all of the data, including the servo positions.
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_
  #3   Spotlight this post!  
Unread 15-01-2005, 01:38
russell's Avatar
russell russell is offline
Registered User
#1430 (WRONG)
Team Role: Electrical
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Anchorage AK
Posts: 402
russell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to all
Re: Camera Range Finding

Ok. Thanks. Do you know what format that number is in? Is it the pwm value being sent to the tilt servo? And regardless of its format could I do something like this:

if (tilt_position =< x)
{
CODE FOR PICKING UP THE TETRA
}

where x is the value which represents the camera angle at which I want it to start executing the pick up the tetra code?
  #4   Spotlight this post!  
Unread 15-01-2005, 08:54
Mr. Lim Mr. Lim is offline
Registered User
AKA: Mr. Lim
no team
Team Role: Leadership
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Toronto, Ontario
Posts: 1,125
Mr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond repute
Re: Camera Range Finding

cam.tilt_servo is the variable for your "tilt_position" and will return your tilt servo position as a value from 0 to 255.

FYI, camera_track_update in camera.c has a pretty good breakdown on what useful values you can read from the camera in tracking mode.

Code:
int camera_track_update(void)
{
  int i;

  if(wait_for_data()==0) return 0;
 
  if(cam_uart_buffer[0]=='T' && cam_index_ptr>=9)
    {
	  cam.x=cam_uart_buffer[1];
	  cam.y=cam_uart_buffer[2];
	  cam.x1=cam_uart_buffer[3];
	  cam.y1=cam_uart_buffer[4];
	  cam.x2=cam_uart_buffer[5];
	  cam.y2=cam_uart_buffer[6];
	  cam.size=cam_uart_buffer[7];
	  cam.conf=cam_uart_buffer[8];
	  if(cam_index_ptr>9)
		{
		  cam.pan_servo=cam_uart_buffer[9];
		  cam.tilt_servo=cam_uart_buffer[10];
		}
	  reset_rx_buffer();
	  return 1;
    }
  // Bad data in buffer
  reset_rx_buffer();
  return 0;
}
Good luck!

-SlimBoJones...

Last edited by Mr. Lim : 15-01-2005 at 08:58. Reason: originally didn't provide much info
  #5   Spotlight this post!  
Unread 15-01-2005, 11:55
fred's Avatar
fred fred is offline
More Grizzle
None #0341 (Daisy)
Team Role: Programmer
 
Join Date: Jan 2003
Location: Ambler
Posts: 132
fred is on a distinguished road
Re: Camera Range Finding

Where can we find the camera code, and is there a script we are supposed to use? We are new at programming and we have no idea how to program teh camera...

Thnx

Fred
__________________
"The distance between genius and insanity is measured only by success."

-Anonymous
  #6   Spotlight this post!  
Unread 15-01-2005, 13:22
russell's Avatar
russell russell is offline
Registered User
#1430 (WRONG)
Team Role: Electrical
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Anchorage AK
Posts: 402
russell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to all
Re: Camera Range Finding

At least as of yesterday the camera code is not officially available. I think. Basically for the first few days innovation first had the code on their website, then they took it away and made it say that they are still working on the code.
  #7   Spotlight this post!  
Unread 15-01-2005, 13:45
fred's Avatar
fred fred is offline
More Grizzle
None #0341 (Daisy)
Team Role: Programmer
 
Join Date: Jan 2003
Location: Ambler
Posts: 132
fred is on a distinguished road
Re: Camera Range Finding

Quote:
Originally Posted by russell
At least as of yesterday the camera code is not officially available. I think. Basically for the first few days innovation first had the code on their website, then they took it away and made it say that they are still working on the code.
ok, thanks
__________________
"The distance between genius and insanity is measured only by success."

-Anonymous
  #8   Spotlight this post!  
Unread 15-01-2005, 18:10
LintNinja LintNinja is offline
Registered User
#1430
 
Join Date: Jan 2005
Location: Anchorage, Alaska
Posts: 1
LintNinja is an unknown quantity at this point
Re: Camera Range Finding

Hey, russel, I think basically that you would use the readings from the servos to tirnagulate the distance. Basically, you know the height of the camera, and you know one of the angle, and so you can triangulate the second side using a sin function, not too hard to do.. Thats why its nice havign the servo output readings... After looking I didn't find anything like that currently in the code but it would not be hard to write a little alogrithm to do that..

Peace up.
  #9   Spotlight this post!  
Unread 15-01-2005, 18:26
Damian Manda's Avatar
Damian Manda Damian Manda is offline
The Damian
no team
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Fort Collins, CO
Posts: 154
Damian Manda has much to be proud ofDamian Manda has much to be proud ofDamian Manda has much to be proud ofDamian Manda has much to be proud ofDamian Manda has much to be proud ofDamian Manda has much to be proud ofDamian Manda has much to be proud ofDamian Manda has much to be proud ofDamian Manda has much to be proud of
Send a message via AIM to Damian Manda
Re: Camera Range Finding

Quote:
Originally Posted by fred
Where can we find the camera code, and is there a script we are supposed to use? We are new at programming and we have no idea how to program the camera...
As far as I know the camera code included in the IFI default code is the official version, but it may be updated into the season. The user interface for the computer is here but this page also contains a notice saying that new default code with the camera will be out shortly. They may have just forgotten to update this when they posted the camera default code, or there will be a revision soon.
__________________
FRC Volunteer, FLL regional planning committee member for Colorado
Former Programmer, Web Designer, Communications Director of Alpine Robotics Team 159.
Add your team to the FIRST Teams Google Map
  #10   Spotlight this post!  
Unread 31-01-2005, 19:54
whakojacko's Avatar
whakojacko whakojacko is offline
Registered User
FRC #1072 (hrt)
Team Role: College Student
 
Join Date: Feb 2003
Rookie Year: 2003
Location: San Jose, California
Posts: 137
whakojacko is on a distinguished road
Send a message via AIM to whakojacko Send a message via MSN to whakojacko
Re: Camera Range Finding

well maybe for the target it will work, but for finding the tetra the issue is that of camera is most likely not going to have to tilt the camera once it finds the tetra to follow it. Weve tried to mess around with this, but have had no sucess
__________________
Harker Robotics:1072
http://www.harker-robotics.org
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
Scripting Setup and the Camera + Serial Port Drivers CJO Programming 22 11-01-2006 17:42
Kevin Watson's Kick-off Demo Code! Mr. Lim Programming 27 22-01-2005 03:38
Only 1 camera allowed? Joe Ross Control System 4 17-01-2005 23:29
Camera Problem n_0163 Electrical 3 14-01-2005 21:10
CMUCam2 Camera Code - Are important parts commented out? Mr. Lim Programming 4 14-01-2005 12:11


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

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