View Single Post
  #14   Spotlight this post!  
Unread 09-04-2006, 20:26
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Camera without servos

So you mean something like this?

Code:
if (swt_camera)
{
	if (pan_error < 5 | pan_error > -5)
	{
		// Set drive motors to neutral
		pwm_rightDrive_cim = pwm_rightDrive_cim = 127;
		pwm_leftDrive_cim = pwm_leftDrive_fp = 127;

		// Tell the controller that it is now on target 
		Tracking_State += STATE_PAN_ON_TARGET;
	}
	else
	{
		// If the image is not center, check with the allowable error range
		if (pan_error > PAN_ALLOWABLE_ERROR_DEFAULT)
		{
			// Attempt to turn left
			pwm_rightDrive_cim = pwm_rightDrive_cim = 200;
			pwm_leftDrive_cim = pwm_leftDrive_fp = 120;
		}
		else if(pan_error < -1 * PAN_ALLOWABLE_ERROR_DEFAULT)
		{
			// Attempt to turn right
			pwm_rightDrive_cim = pwm_rightDrive_cim = 120;
			pwm_leftDrive_cim = pwm_leftDrive_fp = 200;
		}
		else
		{
			// Set drive motors to neutral
			pwm_rightDrive_cim = pwm_rightDrive_cim = 127;
			pwm_leftDrive_cim = pwm_leftDrive_fp = 127;

			// Tell the controller that it is now on target 
			Tracking_State += STATE_PAN_ON_TARGET;
		}
	}
}
Sorry I can't really format it inside this little form :-/

Thanks for the help!
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com

Last edited by kiettyyyy : 09-04-2006 at 21:01.