|
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
|