View Single Post
  #14   Spotlight this post!  
Unread 14-12-2012, 15:36
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Quick Question about Threads

Disclaimer: I have little to no experience with vision tracking apart from pseudo discussions with people who do.

I'm not sure there is any need to periodically fetch and analyse an image. For me, I would only get an image when it is needed, and only take one and analyse that. I know for a fact that most of the teams that did well in champs did exactly that. Processing multiple images is just wasting valuable processing power. If it take 2-5 seconds to process one image well, versus doing 10 images in the same amount of time badly, it seems like an obvious decision to do it once thoroughly.

Kind of like this:

1. User presses "track" button (mapped to somewhere on the controller)
2. Stop robot, Take picture
3. Send image to a new vision processing thread (or executor)
4. Wait (keep robot stopped) until thread sends speed (or whatever data you need) back to main thread (use thread.join() or object.wait())
5. Shoot using data

This is far more efficient than constantly looking for the target. 100% CPU all of the time can literally slow your robot down. (watchdog, PWM signal sent less) Unless you are using the target to dynamically line yourself up (which would be impressive), I can't think of a good reason to track it periodically.
__________________
All opinions are my own.

Last edited by joelg236 : 14-12-2012 at 15:38.
Reply With Quote