Go to Post We're still not ready for 2012.... - AdamHeard [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-02-2012, 15:58
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Lightbulb Calculating Angle to Target

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?
  #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.
  #3   Spotlight this post!  
Unread 02-02-2012, 16:08
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,113
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: Calculating Angle to Target

That's exactly the approach used in the example code from a couple of years ago (Breakaway?). Use the camera to determine how far to turn, then use the gyro to execute the turn.

The camera and vision processing has enough delay to pretty much guarantee that you'll overshoot the target direction if that's all you use.
  #4   Spotlight this post!  
Unread 02-02-2012, 16:36
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Re: Calculating Angle to Target

I'm glad to hear my idea is not unique (and therefore not impossible/ innacurate). I'm a bit curious if the image is close enough to flat to assume the deg/pixel value can be treated as a constant and still be accurate, or if just the edges should be treated with a different rate, etc.

Also, according to the datasheet the M206 has a field of view of 54 deg (assuming linearity here) is that accurate enough value to use?

Sorry if I'm asking for a handout a bit here, I'm just trying to avoid going overboard on gathering a ton of sample images and doing a ton of trig only to find out I could have just taken 54/320.
  #5   Spotlight this post!  
Unread 02-02-2012, 16:40
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Calculating Angle to Target

There is definitely some barrel distortion, and there exist algorithms to try and account for it.

That said, if you have images getting processed at 15, 30, 60 frames per second*, it doesn't much matter - as you turn closer to the center of the object, you will receive new azimuth information which should correct for prior errors.

(*Our current prototype tracking code is running at 150 frames per second...can anyone beat that? It's a shame the camera can't go past 60 )
  #6   Spotlight this post!  
Unread 02-02-2012, 16:40
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,753
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Calculating Angle to Target

I would start linear, and as a last resort, you should be able to piece-wise-linear model it with probably just a few table lookups.

Greg McKaskle
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 19:03.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi