summaryrefslogtreecommitdiff
path: root/src/DumbWalkAnimation.java
diff options
context:
space:
mode:
authorFrank v/d Haterd <f.h.a.v.d.haterd@student.tue.nl>2014-01-13 03:06:31 +0100
committerFrank v/d Haterd <f.h.a.v.d.haterd@student.tue.nl>2014-01-13 03:06:31 +0100
commitb8bd3d7bb5b7284879240ab6eb65f2b4619e2d9f (patch)
treede531ae1f8c24a30c69eb81fac682a91ee245a0c /src/DumbWalkAnimation.java
parent646e75208290fe1593df9494591195fd41054c2e (diff)
parentf27ed95f90dbc81c7a89a58fb07ac632f4cfdaf9 (diff)
download2iv60-robots-b8bd3d7bb5b7284879240ab6eb65f2b4619e2d9f.tar.gz
Merge branch 'master' of git.lekensteyn.nl:tue/2iv60-robots
Diffstat (limited to 'src/DumbWalkAnimation.java')
-rw-r--r--src/DumbWalkAnimation.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/DumbWalkAnimation.java b/src/DumbWalkAnimation.java
new file mode 100644
index 0000000..7ff44d1
--- /dev/null
+++ b/src/DumbWalkAnimation.java
@@ -0,0 +1,53 @@
+
+/**
+ * A WalkAnimation that does not result in a smooth transition. The formula and
+ * constants are chosen at random.
+ *
+ * @author Peter Wu
+ */
+public class DumbWalkAnimation implements WalkAnimation {
+
+ private double robot_pos_meters;
+
+ /**
+ * Sets the new position for the robot.
+ */
+ public void updatePosition(double pos) {
+ this.robot_pos_meters = pos;
+ }
+
+ private double getTime() {
+ return robot_pos_meters / 5;
+ }
+
+ @Override
+ public double getLegAngleLeft() {
+ return Math.sin(-getTime()) * 30.0;
+ }
+
+ @Override
+ public double getLegAngleRight() {
+ return -getLegAngleLeft();
+ }
+
+ @Override
+ public double getKneeAngleLeft() {
+ return 75.0 + Math.abs(Math.cos(getTime()) * 90.0);
+ }
+
+ public double getKneeAngleRight() {
+ return getKneeAngleLeft();
+ }
+
+ @Override
+ public double getArmAngleLeft() {
+ // static non-moving arms.
+ return 0;
+ }
+
+ @Override
+ public double getArmAngleRight() {
+ // static non-moving arms.
+ return 0;
+ }
+}