diff options
author | Frank v/d Haterd <f.h.a.v.d.haterd@student.tue.nl> | 2014-01-13 03:06:31 +0100 |
---|---|---|
committer | Frank v/d Haterd <f.h.a.v.d.haterd@student.tue.nl> | 2014-01-13 03:06:31 +0100 |
commit | b8bd3d7bb5b7284879240ab6eb65f2b4619e2d9f (patch) | |
tree | de531ae1f8c24a30c69eb81fac682a91ee245a0c /src/DumbWalkAnimation.java | |
parent | 646e75208290fe1593df9494591195fd41054c2e (diff) | |
parent | f27ed95f90dbc81c7a89a58fb07ac632f4cfdaf9 (diff) | |
download | 2iv60-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.java | 53 |
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; + } +} |