Thread: Usb camera
View Single Post
  #4   Spotlight this post!  
Unread 03-28-2016, 03:44 PM
ARaine ARaine is offline
Registered User
FRC #2834
 
Join Date: Feb 2016
Location: Michigan
Posts: 5
ARaine is an unknown quantity at this point
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.
Reply With Quote