Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Grabbing Tilt Angle? (http://www.chiefdelphi.com/forums/showthread.php?t=43590)

crossedheart 08-02-2006 23:13

Grabbing Tilt Angle?
 
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

Re: Grabbing Tilt Angle?
 
Quote:

Originally Posted by crossedheart
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

Re: Grabbing Tilt Angle?
 
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

Re: Grabbing Tilt Angle?
 
Quote:

Originally Posted by crossedheart
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/sh...41&postcount=3

-Kevin

sparkydp 09-02-2006 01:11

Re: Grabbing Tilt Angle?
 
due to the installation of the servo to the bracket, is there any guarantee that 0 degrees will actually be horizontal?



Quote:

Originally Posted by Kevin Watson
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/sh...41&postcount=3

-Kevin


Keith Watson 09-02-2006 01:35

Re: Grabbing Tilt Angle?
 
Quote:

Originally Posted by sparkydp
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

Re: Grabbing Tilt Angle?
 
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)

Calvin 09-02-2006 03:08

Re: Grabbing Tilt Angle?
 
Quote:

Originally Posted by Keith Watson
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.


All times are GMT -5. The time now is 21:54.

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