Go to Post Continue? You mean we can quit? Why didn't someone say so! - tsaksa [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
  #4   Spotlight this post!  
Unread 06-02-2006, 16:24
cmurdoch cmurdoch is offline
Registered User
AKA: Caroline Murdoch
FRC #1208 (Metool Brigade)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2004
Location: O'Fallon, IL
Posts: 17
cmurdoch is on a distinguished road
Re: Camera Troubles

Here's my updated camera search code. So, if anyone has any insights I'd appreciate it.

Code:
                                        //turn the turret to the right for a specified
					//number of loops if direction is equal to 1
	                                if (direction == 1)
					{
						pwm12 = 255;
						loop_number++;
						//when it reaches the end of the time, 
						//change tilt value, change direction 
						//and reset loop counter
						if (loop_number > 50)
						{
							if(temp_tilt_servo >= (int)Tracking_Config_Data.Tilt_Max_PWM)
							{
								temp_tilt_servo = (int)Tracking_Config_Data.Tilt_Min_PWM;
							}
							else
							{
								// step the tilt servo to its next destination
								temp_tilt_servo += (int)Tracking_Config_Data.Tilt_Search_Step_Size;
			
								// make sure its new position isn't beyond
								// the maximum value set in tracking.h
								if(temp_tilt_servo >= (int)Tracking_Config_Data.Tilt_Max_PWM)
								{
									temp_tilt_servo = (int)Tracking_Config_Data.Tilt_Max_PWM;
								}	
							}
							direction = 0;
							loop_number = 0;
						}
					}
					//turn the turret to the left for a specified 
					//number of loops if direction is equal to 0
					else if (direction == 0)
					{
						pwm12 = 0;
						loop_number++;
						//when it reaches the end of the time, 
						//change tilt value, change direction 
						//and reset loop counter
						if (loop_number > 50)
						{
							if(temp_tilt_servo >= (int)Tracking_Config_Data.Tilt_Max_PWM)
							{
								temp_tilt_servo = (int)Tracking_Config_Data.Tilt_Min_PWM;
							}
							else
							{
								// step the tilt servo to its next destination
								temp_tilt_servo += (int)Tracking_Config_Data.Tilt_Search_Step_Size;
			
								// make sure its new position isn't beyond
								// the maximum value set in tracking.h
								if(temp_tilt_servo >= (int)Tracking_Config_Data.Tilt_Max_PWM)
								{
									temp_tilt_servo = (int)Tracking_Config_Data.Tilt_Max_PWM;
								}	
							}
							direction = 1;
							loop_number = 0;
						}
					}
					//if direction isn't left or right
					//there is a code error and the
					//motor is set to neutral
				//	else
				//		pwm12 = 127;
				}

				// update the pan and tilt servo PWM value
				//PAN_SERVO = (unsigned char)temp_pan_servo;
				TILT_SERVO = (unsigned char)temp_tilt_servo;
			}
		}
	}
}
 


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
CMU Camera kills robot controller if not found. Chris_Elston Programming 21 27-03-2006 14:30
How To Use the Google Camera generalbrando Kit & Additional Hardware 2 07-02-2006 16:00
Camera Is Spazzing Out! BrittanyV Programming 15 04-02-2006 13:39
Scripting Setup and the Camera + Serial Port Drivers CJO Programming 22 11-01-2006 17:42
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 23:26.

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