Skip to content
Browse files

gitignore created

  • Loading branch information...
1 parent 720a137 commit 0b0c2e088e3a7124dd6af324dca7da07485f0fb8 @cattaka committed
View
1 DroidDancerMotionWriter/.gitignore
@@ -0,0 +1 @@
+/bin
View
133 DroidRobo01/src/net/cattaka/droidrobo01/MonitorTwitterActivity.java
@@ -6,6 +6,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
+import java.util.Random;
import net.cattaka.droidrobo01.robo.RoboPauseInfo;
import net.cattaka.droidrobo01.robo.RoboPauseInfo.MotorDir;
@@ -41,6 +42,8 @@
private static final int EVENT_DRIVE = 2;
+ private Random mRandom = new Random();
+
private MonitorTwitterActivity me = this;
private IAdkService mAdkService;
@@ -222,40 +225,104 @@ private void addMessageAsync(String str) {
mHandler.sendMessage(msg);
}
if (mPauseQueue.size() == 0) {
- mPauseQueue
- .add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.25f, 0.25f));
- mPauseQueue.add(new RoboPauseInfo(false, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
- 0.25f));
- mPauseQueue
- .add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.25f, 0.25f));
- mPauseQueue.add(new RoboPauseInfo(false, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
- 0.25f));
-
- mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 1000, 0.75f,
- 0.75f));
- mPauseQueue
- .add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 1.00f, 0.50f));
- mPauseQueue
- .add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.50f, 1.00f));
- mPauseQueue
- .add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 1.00f, 0.50f));
- mPauseQueue
- .add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.50f, 1.00f));
- mPauseQueue
- .add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 1.00f, 0.50f));
- mPauseQueue
- .add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.50f, 1.00f));
- mPauseQueue.add(new RoboPauseInfo(false, MotorDir.STOP, MotorDir.STOP, 500, 0.75f,
- 0.75f));
-
- mPauseQueue.add(new RoboPauseInfo(true, MotorDir.FORWARD, MotorDir.REVERSE, 200, 0.75f,
- 0.75f));
- mPauseQueue.add(new RoboPauseInfo(true, MotorDir.REVERSE, MotorDir.FORWARD, 200, 0.75f,
- 0.75f));
-
- mPauseQueue
- .add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 1000, 1.0f, 1.0f));
+ addMotion();
+ }
+ }
+ private void addMotion() {
+ switch (mRandom.nextInt(3)) {
+ case 0: {
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
+ 0.25f));
+ mPauseQueue.add(new RoboPauseInfo(false, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
+ 0.25f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
+ 0.25f));
+ mPauseQueue.add(new RoboPauseInfo(false, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
+ 0.25f));
+
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.5f,
+ 0.5f));
+
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.FORWARD, MotorDir.REVERSE, 500,
+ 1.0f, 0.0f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.REVERSE, MotorDir.FORWARD, 500,
+ 0.0f, 1.0f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.FORWARD, MotorDir.REVERSE, 500,
+ 1.0f, 0.0f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.REVERSE, MotorDir.FORWARD, 500,
+ 0.0f, 1.0f));
+
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 1000, 1.0f,
+ 1.0f));
+ break;
+ }
+ case 1: {
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
+ 0.25f));
+ mPauseQueue.add(new RoboPauseInfo(false, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
+ 0.25f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
+ 0.25f));
+ mPauseQueue.add(new RoboPauseInfo(false, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
+ 0.25f));
+
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 1000, 0.75f,
+ 0.75f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 1.00f,
+ 0.50f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.50f,
+ 1.00f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 1.00f,
+ 0.50f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.50f,
+ 1.00f));
+ mPauseQueue.add(new RoboPauseInfo(false, MotorDir.STOP, MotorDir.STOP, 500, 0.75f,
+ 0.75f));
+
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.FORWARD, MotorDir.REVERSE, 200,
+ 0.75f, 0.75f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.REVERSE, MotorDir.FORWARD, 200,
+ 0.75f, 0.75f));
+
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 1000, 1.0f,
+ 1.0f));
+ break;
+ }
+ case 2: {
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
+ 0.25f));
+ mPauseQueue.add(new RoboPauseInfo(false, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
+ 0.25f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
+ 0.25f));
+ mPauseQueue.add(new RoboPauseInfo(false, MotorDir.STOP, MotorDir.STOP, 500, 0.25f,
+ 0.25f));
+
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.0f,
+ 0.0f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 1.0f,
+ 0.0f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.0f,
+ 0.0f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.0f,
+ 1.0f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 0.0f,
+ 0.0f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 500, 1.0f,
+ 1.0f));
+
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.REVERSE, MotorDir.FORWARD, 200,
+ 1.0f, 1.0f));
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.FORWARD, MotorDir.REVERSE, 200,
+ 1.0f, 1.0f));
+
+ mPauseQueue.add(new RoboPauseInfo(true, MotorDir.STOP, MotorDir.STOP, 1000, 1.0f,
+ 1.0f));
+ break;
+ }
+ default:
+ break;
}
}

0 comments on commit 0b0c2e0

Please sign in to comment.
Something went wrong with that request. Please try again.