View Single Post
  #2   Spotlight this post!  
Unread 02-02-2012, 16:05
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: Calculating Angle to Target

Quote:
Originally Posted by DjScribbles View Post
So after getting some rudimentary rectangle detection working, I've found some big drawbacks in the "simple" way of turning one direction or the other until facing the center of the target rectangle. The big problem is (at least for our test robot) it takes a significant amount of power to the motors to start moving, and once you get moving, your moving quite fast and tend to overshoot the target; leading to the robot swinging wildly back and forth.

So what I'd like to do is determine the angle the robot needs to turn from the each image, and monitor a gyroscope to determine when to slow down and stop (using periodic, low framerate, images to update the angle to target).

To do this, we'll need to no the angle between our current and desired facing; eventually I came up with an idea I'd like to field here:

The camera has a fixed field of view; regardless of your distance from the target, the left edge of the image is a fixed number of degrees from the center, so it should be possible to determine the needed rotation by:
[r](deg_delta) = [x](pixel_delta) * [a](pixels/deg)

I do understand the edges of the image are a bit fish-eyed (or perhaps the whole thing) so it may not be quite this simple, but should be easy enough to measure.


What does CD think... is this a good approach, or is there a better way of doing this that I'm overlooking?
We used that approach in 2006, and will be doing so again this year. It works well.

Just keep in mind that the camera image will have a significant lag.
__________________
-
An ounce of perception is worth a pound of obscure.