|
Re: Usb camera
I found that using the vision to directly control a motor was too slow. By using a gyro, I calculated (roughly) the angle needed to rotate so that the center of the target was on the center of the camera's vision.
The calculation was:
arctan([Distance of center target to center vision] / [Constant])
The constant is just a value that I found through experimentation (around 300, may be different for you). This method only works if you have a gyroscope because I then took that calculated angle and plugged it into a PID loop to rotate the robot based on a gyro reading.
I had some success with this in autonomous by performing this operation twice.
|