git.haldean.org droidcopter / 954713d
Upgrading eclipse; minor adjustments to Guidance Benjamin Bardin 9 years ago
8 changed file(s) with 22 addition(s) and 39 deletion(s). Raw diff Collapse all Expand all
22 <classpathentry excluding="org/haldean/blob/JavaImage.java|org/haldean/blob/SegmentTest.java|org/haldean/chopper/pilot/nav/NavListTest.java|org/haldean/chopper/pilot/nav/NavVelTest.java|org/haldean/chopper/pilot/test/|org/haldean/chopper/server/" kind="src" path="src"/>
33 <classpathentry kind="src" path="gen"/>
44 <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
5 <classpathentry kind="lib" path="/home/benjamin/workspace/droidcopter/jars/AndroidBluetoothLibrary.jar"/>
6 <classpathentry kind="output" path="bin"/>
5 <classpathentry exported="true" kind="lib" path="/home/benjamin/workspace/droidcopter/jars/AndroidBluetoothLibrary.jar"/>
6 <classpathentry kind="lib" path="libs/AmarinoLibrary.jar"/>
7 <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
8 <classpathentry kind="output" path="bin/classes"/>
79 </classpath>
+0
-13
Pilot/default.properties less more
0 # This file is automatically generated by Android Tools.
1 # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
2 #
3 # This file must be checked in Version Control Systems.
4 #
5 # To customize properties used by the Ant build system use,
6 # "build.properties", and override values to adapt the script to your
7 # project structure.
8
9 # Indicates whether an apk should be generated for each density.
10 split.density=false
11 # Project target.
12 target=android-10
33 <classpathentry excluding="org/haldean/chopper/pilot/" including="org/haldean/chopper/pilot/test/" kind="src" path="gen"/>
44 <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
55 <classpathentry combineaccessrules="false" kind="src" path="/Pilot"/>
6 <classpathentry kind="output" path="bin"/>
6 <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
7 <classpathentry kind="output" path="bin/classes"/>
78 </classpath>
+0
-11
PilotTest/default.properties less more
0 # This file is automatically generated by Android Tools.
1 # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
2 #
3 # This file must be checked in Version Control Systems.
4 #
5 # To customize properties used by the Ant build system use,
6 # "build.properties", and override values to adapt the script to your
7 # project structure.
8
9 # Project target.
10 target=android-10
756756
757757 /* ---------- use setForeground() but be also backward compatible ---------- */
758758
759 @SuppressWarnings("unchecked")
759
760 @SuppressWarnings("rawtypes")
760761 private static final Class[] mStartForegroundSignature = new Class[] {
761762 int.class, Notification.class};
762 @SuppressWarnings("unchecked")
763 @SuppressWarnings("rawtypes")
763764 private static final Class[] mStopForegroundSignature = new Class[] {
764765 boolean.class};
765766
430430 setReadingField(ROLL, orientation[2] * -180.0 / Math.PI);
431431 break;
432432 case Sensor.TYPE_ROTATION_VECTOR:
433 Log.v(TAG, "my grav time: " + ((time - grav_time)/1000000));
433 //Log.v(TAG, "my grav time: " + ((time - grav_time)/1000000));
434434 grav_time = time;
435435 String timestring = Long.toString(time/1000000);
436436 try {
125125 //Temporary: need real tuning values at some point. Crap.
126126 for (int i = 0; i < 3; i++)
127127 mGain[i][0] = .01;
128 mGain[3][0] = .01;
128 //mGain[3][0] = .01;
129129
130130 try {
131131 if (mEnableLogging)
261261 }
262262 if (parts[1].equals("MANUAL")) {
263263 //autoPilot(false);
264 @SuppressWarnings("unused")
264265 String log = "manual mode: ";
265266 if (parts.length > 2) {
266267 double[] newTarget = new double[4];
271272 //Log.v(TAG, log);
272273 newTarget[0] *= Angler.MAX_ANGLE;
273274 newTarget[1] *= Angler.MAX_ANGLE;
274 newTarget[2] *= 3.0;
275 // newTarget[2] *= 3.0;
275276 synchronized (mAngleTarget) {
276277 System.arraycopy(newTarget, 0, mAngleTarget, 0, 4);
277278 }
307308
308309 double[] errors = new double[4];
309310 synchronized (mAngleTarget) {
310 logArray("mAngleTarget", mAngleTarget);
311 //logArray("mAngleTarget", mAngleTarget);
311312 errors[0] = mAngleTarget[0] - mRollDeg;
312313 errors[1] = mAngleTarget[1] - mPitchDeg;
313314 errors[2] = mAngleTarget[2] - mStatus.getGpsField(dALT);
314315 errors[3] = mAngleTarget[3] - mAzimuth;
315 logArray("errors", errors);
316 }
317
316 //logArray("errors", errors);
317 }
318
319 @SuppressWarnings("unused")
318320 String errs = "errors: ";
319321 for (int i = 0; i < 4; i++) {
320322 errs += errors[i] + ": ";
366368 // Constrain control vars:
367369 mControlVars[0] = constrainValue(mControlVars[0], -1, 1);
368370 mControlVars[1] = constrainValue(mControlVars[1], -1, 1);
369 mControlVars[2] = constrainValue(mControlVars[2], 0, 4);
371 mControlVars[2] = constrainValue(mControlVars[2], 0, 1);
370372 mControlVars[3] = constrainValue(mControlVars[3], -2, 2);
371373
372374 /*String vars = "Control vars: ";
383385 //Log.v(TAG, "motors: " + mMotorSpeed[0] + ", " + mMotorSpeed[1] + ", " + mMotorSpeed[2] + ", " + mMotorSpeed[3]);
384386 //Sleep a while
385387 long timetonext = (1000 / PIDREPS) - (System.currentTimeMillis() - starttime);
386 Log.v(TAG, "time to next: " + timetonext);
388 //Log.v(TAG, "time to next: " + timetonext);
387389 int currentMode = mGuidanceMode.get();
388390 if ((currentMode == MANUAL) || (currentMode == AUTOPILOT)) {
389391 if (timetonext > 0)
413415 if (cosGrad != 0) {
414416 z = mControlVars[2] / cosGrad;
415417 } else {
416 z = mControlVars[2];
418 z = mControlVars[2]; // Chopper is vertical, we got other problems.
417419 }
418420 double t = mControlVars[3];
419421
421423 mMotorSpeed[1] = Math.sqrt(constrainValue(t + 2*y + z, 0, 1));
422424 mMotorSpeed[2] = Math.sqrt(constrainValue(-t - 2*x + z, 0, 1));
423425 mMotorSpeed[3] = Math.sqrt(constrainValue(-t + 2*x + z, 0, 1));
426 logArray("motorSpeeds", mMotorSpeed);
424427 }
425428
426429 private void updateAngleTarget() {