View Single Post
  #2   Spotlight this post!  
Unread 08-02-2012, 09:44
dbeckwith's Avatar
dbeckwith dbeckwith is offline
Lead Programmer
AKA: Daniel Beckwith
FRC #3205 (The Patriots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: USA
Posts: 84
dbeckwith is an unknown quantity at this point
Re: Camera Vision Processing

You can't rely on the loop being executed every 10ms, it's bound to change as you put in more code (especially image processing). If you wanted to do something every 200ms, you might do something like this:
Code:
import edu.wpi.first.wpilibj.Timer;

public void operatorControl() {
  double time = Timer.getFPGATimestamp();
  
  while(isEnabled() && isOperatorControl()) {
    if (Timer.getFPGATimestamp() - time >= 0.2) {
      // CAMERA IMAGE PROCESSING HERE
      time = Timer.getFPGATimestamp();
    }
    // OTHER CODE HERE
  }
}
__________________
q = (2*b) | ~(2*b);

if (life.getLemons() != null) this.lemonade = new Drink(life.getLemons());
else throw new NoLemonsException("What now?");


Reply With Quote