Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Search Servo Initialization Caution (http://www.chiefdelphi.com/forums/showthread.php?t=43546)

Keith Watson 08-02-2006 14:25

Search Servo Initialization Caution
 
The default search code initializes the camera pan/tilt servos with this code.

Code:

    if(new_search == 1)
    {
        new_search = 0;
        temp_pan_servo = 0;
        temp_tilt_servo = Tracking_Config_Data.Tilt_Center_PWM;
                           
    }
    else
    {
        // search code
    }
    PAN_SERVO = (unsigned char)temp_pan_servo;
    TILT_SERVO = (unsigned char)temp_tilt_servo;

Note that the pan servo pwm is hardcoded to zero. If you have changed PAN_MIN_PWM_DEFAULT from zero to something else then hardcoding to zero is incorrect. Change the line to:
Code:

        temp_pan_servo = Tracking_Config_Data.Pan_Min_PWM;

Kevin Watson 09-02-2006 01:05

Re: Search Servo Initialization Caution
 
Quote:

Originally Posted by Keith Watson
The default search code initializes the camera pan/tilt servos with this code.

Code:

if(new_search == 1)
{
new_search = 0;
temp_pan_servo = 0;
temp_tilt_servo = Tracking_Config_Data.Tilt_Center_PWM;
 
}
else
{
// search code
}
PAN_SERVO = (unsigned char)temp_pan_servo;
TILT_SERVO = (unsigned char)temp_tilt_servo;

Note that the pan servo pwm is hardcoded to zero. If you have changed PAN_MIN_PWM_DEFAULT from zero to something else then hardcoding to zero is incorrect. Change the line to:
Code:

temp_pan_servo = Tracking_Config_Data.Pan_Min_PWM;

Hmmm... I wonder what the heck I was thinking when I did that? Oh well, since I can't possibly explain this away as an undocumented "feature", I guess we have to call it a bug <grin>.

-Kevin

Keith Watson 09-02-2006 02:13

Re: Search Servo Initialization Caution
 
I found it by reading the code to understand the algorithm. The rest of the code was all nicely parameterized. :)

Donut 09-02-2006 07:49

Re: Search Servo Initialization Caution
 
You may want to keep temp_pan_servo or temp_tilt_servo the same for a new search as well; we ran into a problem where the camera would catch the target as it spun all the way back to 0 (as it does this the tilt angle increases, which is why it caught it on the way to the left but not the right), lose it when it got there, initialize a new search and have us repeat over and over.


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

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi