git.haldean.org droidcopter / 7d42d65
Telemetry resize fixed; binaries removed Ben 11 years ago
56 changed file(s) with 19 addition(s) and 126 deletion(s). Raw diff Collapse all Expand all
Pilot/bin/Pilot.apk less more
Binary diff not shown
Binary diff not shown
Pilot/bin/org/haldean/chopper/nav/NavDest.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/nav/NavDestTest.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/nav/NavList.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/nav/NavListTest.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/nav/NavTask.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/nav/NavVel.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/nav/NavVelTest.class less more
Binary diff not shown
+0
-33
Pilot/bin/org/haldean/chopper/nav/package.html less more
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
1 <html>
2 <head>
3 <!--
4
5 @(#)package.html 1.60 98/01/27
6
7 #Copyright
8
9 -->
10 </head>
11 <body bgcolor="white">
12 Objects used for droidcopter navigation.
13
14
15 <h2>Package Specification</h2>
16
17 Designed for use on an Android-based device
18 <ul>
19 <li><a href="http://www.android.com">Android</a>
20 </ul>
21
22 <h2>Related Documentation</h2>
23
24 For overviews, tutorials, examples, guides, and tool documentation, please see:
25 <ul>
26 <li><a href="http://developer.android.com/reference/packages.html">Android API</a>
27 </ul>
28
29 @see org.haldean.chopper.pilot org.haldean.chopper.pilot
30
31 </body>
32 </html>
Pilot/bin/org/haldean/chopper/pilot/ChopperMain.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/ChopperStatus$1$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/ChopperStatus$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/ChopperStatus$2.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/ChopperStatus$3.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/ChopperStatus$4.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/ChopperStatus.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Comm$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Comm$2.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Comm$3.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Comm$4.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Comm$5.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Comm$6$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Comm$6.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Comm.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Constants.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Guidance$1$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Guidance$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Guidance.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/MakePicture$1$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/MakePicture$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/MakePicture$2.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/MakePicture$3.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/MakePicture$4.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/MakePicture$5.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/MakePicture.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Navigation$1$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Navigation$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Navigation$2.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Navigation.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/PersistentThread.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/R$attr.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/R$drawable.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/R$id.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/R$layout.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/R$string.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/R.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/Receivable.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/StatusReporter$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/StatusReporter.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/TransmitPicture$1$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/TransmitPicture$1.class less more
Binary diff not shown
Pilot/bin/org/haldean/chopper/pilot/TransmitPicture.class less more
Binary diff not shown
109109 /** Hides Runnability, ensures singleton-ness */
110110 private Runnable mRunner;
111111 private static PersistentThread sThread;
112
113 /** Transformation matrix to from local frame to absolute **/
114 private double[][] mTransform = new double[3][3];
115
116 /** Holds the timestamp of the last acceleration update **/
117 private long mLastAccelUpdate = -1;
118
119 /** Waits through this many acceleratino updates before calculating velocities **/
120 private int mAccCount = 0;
121
122 /** Holds velocity **/
123 private double[] mVel = new double[3];
124112
125113 /**
126114 * Initializes the locks, registers application context for runtime use.
445433 public void onSensorChanged(SensorEvent event) {
446434 int type = event.sensor.getType();
447435 switch (type) {
448 //Locks handled in updateField()
449436 case Sensor.TYPE_ACCELEROMETER:
450
451 double t3 = getReadingField(AZIMUTH) * Math.PI / 180.0D;
452 double t1 = getReadingField(PITCH) * Math.PI / 180.0D;
453 double t2 = getReadingField(ROLL) * Math.PI / 180.0D;
454
455 double s1 = Math.sin(t1);
456 double s2 = Math.sin(t2);
457 double s3 = Math.sin(t3);
458
459 double c1 = Math.cos(t1);
460 double c2 = Math.cos(t2);
461 double c3 = Math.cos(t2);
462
463 //XYZ
464 mTransform[0][0] = c2*c3;
465 mTransform[1][0] = c1*s3 + c3*s1*s2;
466 mTransform[2][0] = s1*s3 - c1*c3*s2;
467
468 mTransform[0][1] = -c2*s3;
469 mTransform[1][1] = c1*c3 - s1*s2*s3;
470 mTransform[2][1] = c1*s2*s3 + c3*s1;
471
472 mTransform[0][2] = s2;
473 mTransform[1][2] = -c2*s1;
474 mTransform[2][2] = c1*c2;
475
476 double[] newAcc = new double[3];
477 newAcc[0] = 0;
478 newAcc[1] = 0;
479 newAcc[2] = -SensorManager.GRAVITY_EARTH;
480
481 for (int i = 0; i < 3; i++) {
482 for (int j = 0; j < 3; j++) {
483 newAcc[i] += (double)event.values[j] * mTransform[j][i];
484 }
485 Log.v(TAG, "ACC" + i + ": " + newAcc[i]);
486
487 }
488 Log.v(TAG, "ACC: ");
489 if (mAccCount < 300) {
490 mAccCount++;
491 Log.v(TAG,"MCOUNT is " + mAccCount);
492 }
493 else {
494 if (mLastAccelUpdate==-1) {
495 mLastAccelUpdate = event.timestamp;
496 }
497 else {
498 for (int i = 0; i < 3; i++) {
499 mVel[i] += ((double)(event.timestamp - mLastAccelUpdate))/1000000000.0 * newAcc[i];
500 Log.v(TAG, "VEL" + i + ": " + mVel[i]);
501 }
502 Log.v(TAG, "VEL: ");
503 mLastAccelUpdate = event.timestamp;
504 }
505 }
506 /*
507 double sumsqd = Math.sqrt(Math.pow(event.values[0], 2.0) +
508 Math.pow(event.values[1], 2.0) +
509 Math.pow(event.values[2], 2.0)) -
510 Math.sqrt(Math.pow(newAcc[0], 2.0) +
511 Math.pow(newAcc[1], 2.0) +
512 Math.pow(newAcc[2], 2.0));
513 */
514 //Log.v(TAG, "XACC: " + newAcc[0]);
515 //Log.v(TAG, "YACC: " + newAcc[1]);
516 //Log.v(TAG, "ZACC: " + newAcc[2]);
517 //Log.v(TAG, "DIFFOFSUMOFTDASQUARES: " + sumsqd);
518 setReadingField(X_ACCEL, newAcc[0]);
519 setReadingField(Y_ACCEL, newAcc[1]);
520 setReadingField(Z_ACCEL, newAcc[2]);
521
437 setReadingField(X_ACCEL, event.values[0]);
438 setReadingField(Y_ACCEL, event.values[1]);
439 setReadingField(Z_ACCEL, event.values[2]);
522440 break;
523441 case Sensor.TYPE_LIGHT:
524442 setReadingField(LIGHT, event.values[0]);
286286 else {
287287 mPool.submit(new Runnable() {
288288 public void run() {
289 try {
289 try {
290 Log.v(TAG, message);
290291 mTextOut.println(message);
291292 mTextOut.flush();
292293 }
357358 }
358359 if (parts[0].equals("COMM")) {
359360 if (parts[1].equals("PULSE")) {
361 sendMessage(msg);
360362 //Reset the heartbeat countdown
361363 mCountdown.purge();
362364 //countdown.cancel();
198198 if (parts[0].equals("IMAGE")) {
199199 if (parts[1].equals("SET")) {
200200 if (parts[2].equals("SIZE")) {
201 Log.v(TAG, "Set size to " + parts[3] + ", " + parts[4]);
201202 setNextFrameSize(new Integer(parts[3]), new Integer(parts[4]));
202203 }
203204 }
267268 if (!(mNextX.get() != mXprev.get() | mNextY.get() != mYprev.get()))
268269 return false;
269270 try {
271 Log.d(TAG, "updateFrameSize: " + mNextX.get() + ", " + mNextY.get());
272 mCamera.stopPreview();
270273 params.setPreviewSize(mNextX.get(), mNextY.get());
271 mCamera.stopPreview();
272274 mCamera.setParameters(params);
273275 mXprev.set(mNextX.get());
274276 mYprev.set(mNextY.get());
277 Log.v(TAG, "Init prev array: " + mXprev.get() + ", " + mYprev.get());
275278 synchronized (mStoreFrame) {
276279 mStoreFrame = new byte[mXprev.get() * mYprev.get() * ImageFormat.getBitsPerPixel(getPreviewFormat()) / 8];
277 }
280 Log.e(TAG, "Array size: " + mStoreFrame.length);
281 }
282 initPrevCallback();
278283 mHandler.sendEmptyMessage(START_PREVIEW);
279284 }
280285 catch (Throwable t) {
370375 mNextX.set(mXprev.get());
371376 mNextY.set(mYprev.get());
372377
373 synchronized (mStoreFrame) {
374 mStoreFrame = new byte[mXprev.get() * mYprev.get() * ImageFormat.getBitsPerPixel(getPreviewFormat()) / 8];
375 mCamera.addCallbackBuffer(mStoreFrame);
376 }
377
378378 //Deal with FPS
379379 List<Integer> fps = params.getSupportedPreviewFrameRates();
380380 if (fps != null) {
410410 }
411411 }
412412 };
413 mCamera.setPreviewCallbackWithBuffer(null);
413414 mCamera.setPreviewCallbackWithBuffer(precall);
415
416 synchronized (mStoreFrame) {
417 mStoreFrame = new byte[mXprev.get() * mYprev.get() * ImageFormat.getBitsPerPixel(getPreviewFormat()) / 8];
418 mCamera.addCallbackBuffer(mStoreFrame);
419 }
414420 //Inner class defs done
415421 }
416422