/** * 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; } }