View Single Post
  #5   Spotlight this post!  
Unread 10-02-2013, 18:31
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: PID Simple Question

If the camera moves with the turret, and the turret rotation is controlled by a single motor, the situation is pretty straightforward. The x value from the vision control tells you the horizontal distance and direction to where you want the turret to point. Use it as the feedback or "process variable" input to the PID. The setpoint would just be 0, as that represents the center of the video image. Given appropriate PID gains, the output will drive the motor until the target is centered.

Watch out for the amount of time it takes the vision processing to do its job, though. If your turret moves too quickly, it will overshoot the target before you find out that it was correctly pointed a half second ago. If you have some sort of physical feedback on the turret position itself, it can be a lot more effective to use the vision x value to decide how far to move the turret then compute a specific setpoint as a delta from its current location, and use PID to drive the turret so the feedback gets to that setpoint.
Reply With Quote