|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am using a combination of the camera and a gyro to turn until the camera is lined up with the green light. With the code I'm using the robot just rotates back and forth and will never stop. Is there a better way to accomplish this. Here is the code:
Camera_Handler(); Servo_Track(); temp_gyro = Get_Gyro_Angle(); tracking_state = Get_Tracking_State(); printf("gyro_angle = %d\r\n", (int)temp_gyro); if(capture == 0 && tracking_state == CAMERA_ON_TARGET ) { goal_angle = ((((int)PAN_SERVO - 124) * 65)/124); capture = 1; } milliradian_goal = ((goal_angle * 3.1415 * 1000)/180); if(capture == 1) { if((milliradian_goal - 60) < temp_gyro) { pwm03 = pwm06 = 150; //Turns robot left pwm04 = pwm05 = 150; } if(temp_gyro < milliradian_goal + 60) { pwm03 = pwm06 = 104; //Turns robot right pwm04 = pwm05 = 104; } if(((milliradian_goal + 60) >= temp_gyro) && (temp_gyro >= (milliradian_goal - 60))) { pwm03 = pwm06 = 127; pwm04 = pwm05 = 127; capture = 2; } } |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Turning 18... | Astronouth7303 | Chit-Chat | 16 | 22-05-2006 09:29 |
| Turning Trouble! | Cadetdan | General Forum | 18 | 05-03-2005 08:55 |
| Slowing down Camera drive turning | Zalumaskov | Programming | 1 | 27-02-2005 10:11 |
| Connections For Camera | Eupher | Programming | 3 | 02-02-2005 14:35 |
| Canadian fined for turning left while on his Segway | MrToast | Dean Kamen's Inventions | 2 | 21-10-2004 17:34 |