git.haldean.org droidcopter / bba1bc3
Updated BlobTracker thread to actually work correctly. Will Brown 11 years ago
1 changed file(s) with 19 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
99 int[] lastVector;
1010
1111 private static final int TRACKING_PERIOD_MS = 200;
12 private static final int DISABLED_PERIOD_MS = 1000;
1213
1314 public BlobTracker() {
1415 lastLocation = new int[2];
2425 }
2526
2627 public int[] getVector() {
27 return null;//Arrays.copyOf(lastVector, lastVector.length);
28 return Arrays.copyOf(lastVector, lastVector.length);
2829 }
2930
3031 private void calculateVector() {
4142 }
4243
4344 public void run() {
44 //image = getImage();
45 calculateVector();
45 while (true) {
46 if (enabled) {
47 //image = getImage();
48 calculateVector();
49 try {
50 Thread.sleep(TRACKING_PERIOD_MS);
51 } catch (InterruptedException e) {
52 e.printStackTrace();
53 }
54 } else {
55 try {
56 Thread.sleep(DISABLED_PERIOD_MS);
57 } catch (InterruptedException e) {
58 e.printStackTrace();
59 }
60 }
61 }
4662 }
4763 }