View Single Post
  #4   Spotlight this post!  
Unread 29-01-2013, 03:43
jesusrambo jesusrambo is offline
Self-Proclaimed Programmer Messiah
AKA: JD Russo
FRC #2035 (Robo Rockin' Bots)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Carmel, CA
Posts: 114
jesusrambo is an unknown quantity at this point
Re: Centering Camera and Robot

Hey, try checking out my guide. It explains how to do the vision processing parts of what you're trying to do.

As for the rest, check out my code for automatic turret tracking. RobotMap.top[0] is the reported x coordinate of the center of the detected target. If you're doing your own vision processing, just pass it that value as such. CameraXOffset is just 160, the x value of the center of the camera's vision. HorizontalTurretAxis.rotate() is a method I added to HorizontalTurretAxis, but replace that with whatever you want the PID output to be of course.

If you need more explanation on how this works please ask.

TL;DR image processing sends x,y coordinates of detected target back to a command that runs a PID controller using that coordinate as input and your motors as output to align itself.
Reply With Quote