View Full Version : Grabbing Tilt Angle?
crossedheart
08-02-2006, 23:13
Ok so my question is this: How can we grab the tilt angle from the camera as a variable that we can use in the user_routines.c? Has anyone done this?
Mark McLeod
08-02-2006, 23:39
Ok so my question is this: How can we grab the tilt angle from the camera as a variable that we can use in the user_routines.c? Has anyone done this?
If you are using the KOP gimbal then
TILT_SERVO is probably what you are looking for.
Just
#include "tracking.h"
in user_routines.c
sparkydp
08-02-2006, 23:41
if you're using the Kevin Watson code that places the tilt servo on PWM1, you can simply read the value of pwm01, but it has also been #defined as PAN_SERVO for more intuitive readings. In the file tracking.c, you'll see a section of the code that starts with a comment "// y-axis/tilt tracking code"
you can see how the tracking.c uses it.
But at any rate, it won't really give you an angle, so much as the position of the servo which is a number between 0 and 255, looking that up to an angle is either some scary math which might not be consistent with anyone else's based on how you installed the servo horns onto the servos. I would recommend just echoing your tilt value to the console with a printf and moving the camera until you determine what PWM value represents the angle you want.
Kevin Watson
09-02-2006, 00:58
Ok so my question is this: How can we grab the tilt angle from the camera as a variable that we can use in the user_routines.c? Has anyone done this?There is a simple expression in terminal.c that will convert from PWM units to degrees. It's explained further here: http://www.chiefdelphi.com/forums/showpost.php?p=437441&postcount=3
-Kevin
sparkydp
09-02-2006, 01:11
due to the installation of the servo to the bracket, is there any guarantee that 0 degrees will actually be horizontal?
There is a simple expression in terminal.c that will convert from PWM units to degrees. It's explained further here: http://www.chiefdelphi.com/forums/showpost.php?p=437441&postcount=3
-Kevin
Keith Watson
09-02-2006, 01:35
due to the installation of the servo to the bracket, is there any guarantee that 0 degrees will actually be horizontal?There is no guarantee, you should measure it. We measured our camera mount last weekend. Servo values of 127 (zero degrees) did not center the camera to the mount. There may also be a difference between your mount and your bot.
Keith Watson
09-02-2006, 02:09
Are those tilt angles, by themselves, accurate enough to use for aiming on your particular bot? This is an interesting question to consider. To answer it you need to read the tracking code to see what it is really doing. Look for what "locked" really means. Then some math is needed to calculate accuracies.
To answer the question you will need the following info which is not documented in the source code. I found it after searching the forums.
T_Packet_Data.mx = X pixel of the target centroid
T_Packet_Data.my = Y pixel of the target centroid
Horizontal camera field of view = 44 degreees (someone calculated this but I would verify it experimentally)
Vertical camera field of view = 34 degreees (someone calculated this but I would verify it experimentally)
There is no guarantee, you should measure it. We measured our camera mount last weekend. Servo values of 127 (zero degrees) did not center the camera to the mount. There may also be a difference between your mount and your bot.
What we did was set both values to 127... than while the servos were on, adjusted the camera mount (those + thingys on the servos actually) to center both the TILT and PAN.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.