Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Camera Tracking Woes (http://www.chiefdelphi.com/forums/showthread.php?t=33396)

VideoMan053 25-01-2005 16:17

Camera Tracking Woes
 
Has anyone been able to get the camera to track and follow (or get close to) one of the vision tetras?

I had an idea about having the drive motors try and turn so that the pan servo on the camera returns to zero, but that doesn't seem to be working.

I have something like this

Code:


 
if (cam.pan_servo < 127) // Camera is turned left
{
        pwm01 = 70; // Left Drive Motor
        pwm-2 = 200; // Right Drive Motor Forward
}
else

the code continues saying that if it is facing the other way, turn right.

Any ideas?

Astronouth7303 25-01-2005 18:48

Re: Camera Tracking Woes
 
It doesn't seem to be working, like...?

I think the default code is setup that the RC does tracking (which I think is a bad idea, since the camera is perfectly capable of it).

Matt Leese 25-01-2005 19:09

Re: Camera Tracking Woes
 
While that possibly can get the robot to drive towards the tetra, it probably won't work well.

The best way to accomplish this is to do it with some form of a control loop. In a control loop, you take as input where you'd like to be. You then subtract out where you currently are. Then, you transform this value (through a variety of techniques the simplest of which being a proportional) and output it to the motor.

In short this is:
output = transform(current position - desired position )

If you're using a proportional controller, it would be:
output = constant * (current position - desired position)

To get the robot to drive to the tetra, you want the pan position of the camera to center. That will give you the current position and the desired position. You can determine the constant through experimentation. There is a bit more to it given that for output, no movement is at 127 not 0. You also have to have a way to make sure it will still go forward when centered.

We used a very similiar technique last Saturday and the robot would reliably drive toward the tetra as long as the camera tracked it.

Matt

VideoMan053 27-01-2005 19:54

Re: Camera Tracking Woes
 
Okay, does anybody know what the variable for the camera pan servo is in user_routines_fast.c ??? Please help!

Greg Marra 29-01-2005 18:09

Re: Camera Tracking Woes
 
Quote:

Originally Posted by VideoMan053
Okay, does anybody know what the variable for the camera pan servo is in user_routines_fast.c ??? Please help!

If you look at the source code you will find that the variable is cam.servo_pan, unless I am mistaken.

[edit] It might be cam.pan_servo [/edit]


All times are GMT -5. The time now is 02:49.

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