Go to Post What's the reason for having a rule if it's not enforced? - jpsaul7usa [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #16   Spotlight this post!  
Unread 15-02-2005, 19:27
Code\\Pilot Code\\Pilot is offline
< Only smart people see my avatar
AKA: Rafael Estrada
FRC #1065 (Tatsu)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Florida
Posts: 53
Code\\Pilot is an unknown quantity at this point
Send a message via AIM to Code\\Pilot Send a message via MSN to Code\\Pilot
Re: AUTO TRACKING!!!!!!:(

Quote:
Originally Posted by devicenull
I had this same problem. Rather then spend a long time fixing it, I just control the servos right off of the RC.

It's working fine, and is legal (I had thought it wasn't at one point, but there is a question in the Q&A thing that says otherwise, ID 1480)

Here's the code that we are using.. it should be easily changed to other configurations
Code:
//Pan and tilt servos
#define cam_pan pwm01
#define cam_tilt pwm02
//Internal posistion variables
unsigned char cam_p=128;
unsigned char cam_t=128;

if (cam.x == 0 && cam.y == 0) {
		//cam_pan and cam_tilt control the servo's on the mount
		//cam_p and cam_t are our local variables
		cam_pan = cam_p;
		cam_tilt = cam_t;
		//Tell the camera where the servos are,
		//so we get useful values when it finds a target
		camera_set_servos(cam_pan,cam_tilt);
		//What color do we want to track?
		camera_find_color(GREEN);
		//This does all the panning
		cam_p += 10;		//X pan
		if (cam_p > 210) { //if we hit the x limit
			cam_p = 46;		//start over
			cam_t += 10;	//but change the tilt
		}
		//if we've tilted too much
		if (cam_t > 117) cam_t = 97;
	}
	else { 
		//sometimes we get nonsense packets, this fixes them
		if (cam_pan > 0 && cam_tilt > 0) {
			//update the servo and our var with new servo values
			cam_p = cam_pan = cam.pan_servo;
			//update the tilt servo with new tilt value
			cam_tilt = cam.tilt_servo;
		}
	}
The trick here is we fool the servo into thinking the servos are connected to it. We do that with the camera_set_servo command. After it finds a target, we update the servos with where the camera thinks it is. The only thing I wanted to do with this code is get rid of the internal variables that hold the servo posistions.
when do you tell it to stop and go for the tetra??
__________________
Join the Red revolution, give me some RED rep!!!!
if it doesn't work, don't force it. Go get a bigger hammer.

int run = 0;
int robot_chasing_you = 1;

if (robot_chasing_you)
{
run = 254;
}

I got 48 Gmail invites left, pm me with your e-mail so i can send you one.
 


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
Camera Auto Tracking? Ryan Cumings Programming 9 22-01-2005 02:20
IR Tracking & Navigation Tallman General Forum 3 20-01-2004 17:26
auto archiving of posts Joe Ross CD Forum Support 4 01-01-2004 02:04
My auto is better than yours.. lol randomperson Programming 25 07-04-2003 12:10
picking auto program Mike375 Programming 19 03-03-2003 15:47


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

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