|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Camera Troubles
I'd like to say there's a problem with the camera itself causing our problems. Unfortunately, the camera was working fine until I attempted to adapt the tracking and search code to manipulate the pwm output for our rotating turret instead of the pan servo. I tried my best to leave the tilt tracking code intact. When we tested, however, the panning code worked as anticipated, while the tilt code didn't work at all (well... it tried to work, but failed miserably resulting in a subtle twitching motion). It seems as though the camera is trying to change the tilt servo value and remain in home position simultaneously. I'd appreciate any ideas anyone might have to solve my problem. Thanks
|
|
#2
|
|||||
|
|||||
|
Re: HELP!!! Camera with mental issues...
If you post the part of your code that isn't working, we'll be better able to help.
|
|
#3
|
||||
|
||||
|
Re: HELP!!! Camera with mental issues...
Quote:
-Kevin |
|
#4
|
||||
|
||||
|
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;
}
}
}
}
|
|
#5
|
|||||
|
|||||
|
Re: Camera Troubles
Nothing in your code jumps out at me but I just don't like the fact that you type cast temp_tilt_servo as an int when you change the servo position then change it back to a unsigned char when finally setting the actual tilt variable. I would suggest however, that you use some sort of sensor to find the actual position of the pan device, at the very least you should use a limit switch or keep track of how many times you have turned left, or right, to be sure you do not break something.
|
|
#6
|
||||
|
||||
|
Re: Camera Troubles
ok what tells the camera to go to home position or stay in home position. Is that on the camera itself and if so is there a portion of the code that overrides that? Basically, I'm wondering what could be causing the camera to try to stay in home position even when it's receiving new tilt servo values. I really don't know where to start.
|
|
#7
|
|||
|
|||
|
Re: Camera Troubles
we had problems with the servo pwm cable being attached to the wrong input on the RC, if it is hooked up to the wrong PWM, it tries to stay on neutral, triple check to make sure PAN and TILT are hooked up to the pwm's stated in tracking.h
Quote:
|
|
#8
|
||||
|
||||
|
Re: Camera Troubles
I've just discovered something. I was testing the tracking code again and found that when we ran it without the driving code, it worked fine, but when we ran it in the combined code we had problems with the tilt servo.
So, my problem isn't in tracking.c; it must be somewhere else but I don't know where. Any idea what the problem could be? |
|
#9
|
|||||
|
|||||
|
Re: Camera Troubles
Do a search for all the pwm's, inputs and outputs the camera uses and see if any other code interferes.
|
|
#10
|
||||
|
||||
|
Re: Camera Troubles
yup that was the problem. In the drive code, the drive motors are on pwms 1 and 2 and the camera also uses those outputs in the camera code. When I combined them I forgot to change the outputs for the drive motors. Man is my face red
... oh well at least it works now. Thank you everyone for your help. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |