View Single Post
  #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.