![]() |
Finding servo location?
Just as a quick question, seeing as I never got to test my code, would getting the location of the servo be as simple as
Code:
printf("Servo Location is... %d\r", pwm01) |
Re: Finding servo location?
that works
|
Re: Finding servo location?
Code:
printf("Servo Location is... %d\r", (int)pwm01) |
Re: Finding servo location?
Quote:
|
Re: Finding servo location?
Quote:
|
Re: Finding servo location?
You can. Just read the value of the PWM - in Kevin's code, the position is in the variable TILT_SERVO and PAN_SERVO
|
Re: Finding servo location?
If you are using the onboard motor control (PWM) to move the camera servos, you can put that printf right after the line that modifies that outputs value (make sure it is before the PutData !!)
If you are using the servo controller on the camera, you will have to ask the camera for what the current servo value is. |
Re: Finding servo location?
Quote:
int testTest = PAN_SERVO ; or static int testTest = PAN_SERVO; i get syntax errors is there a way to access these varible outside of tracking.c? |
Re: Finding servo location?
Quote:
|
Re: Finding servo location?
1 Attachment(s)
alright its attached
its down where it is commented out for the aim up code |
Re: Finding servo location?
Quote:
That might be it, then again, I could be wrong. (code trimmed out to point out lines in question) Code:
void Default_Routine(void) |
Re: Finding servo location?
I thought that was it but shooter is declared..
i will try it out tho |
Re: Finding servo location?
wow alright.. so turns out i fail at remembering basic C...
had to declare Andrew at the top of default routines.. |
Re: Finding servo location?
Keep in mind this tells you where the servo is being commanded to go, not where it is, in most case they're synonomous, but if you're caught on something, or doing a lot of tracking this value could introduce lag which creates oscillations, making it worse, feedback loops, a constantly increasing error, all kinds of bad stuff. Just remember thats where it's trying to be and 98% of the time it should be there.
|
Re: Finding servo location?
Just out of curiosity, is there a better way, then?
|
Re: Finding servo location?
Other than having a rotary potentiometer or something on it...
Nope =) |
Re: Finding servo location?
Quote:
|
Re: Finding servo location?
Quote:
1) Do not command your servo to go into a position where the servo's movement is physically limited. 2) Setting the pwm value is where the servo will end up. This is pretty accurate. If you are worried about the speed in which the servo gets to the commanded position versus the speed of your processing loop then use the Hitec specification for the speed of your servo to figure out if you need a delay. |
| All times are GMT -5. The time now is 22:59. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi