+++ /dev/null
-package org.usfirst.frc.team3501.robot.commands.defensearm;
-
-import org.usfirst.frc.team3501.robot.Robot;
-
-import edu.wpi.first.wpilibj.command.Command;
-
-/***
- * This command is intended to be run from OI using button.whileHeld(...).
- * It lowers the defenseArm continually while the button is being held down.
- *
- * @author shaina
- *
- */
-public class LowerDefenseArmContinuous extends Command {
-
- private double speed;
-
- public LowerDefenseArmContinuous(double speed) {
- requires(Robot.defenseArm);
- this.speed = -speed;
- }
-
- @Override
- protected void initialize() {
- Robot.defenseArm.setArmSpeed(speed);
- }
-
- @Override
- protected void execute() {
- }
-
- @Override
- protected boolean isFinished() {
- return true;
- }
-
- @Override
- protected void end() {
- Robot.defenseArm.setArmSpeed(0);
- }
-
- @Override
- protected void interrupted() {
- end();
- }
-}
+++ /dev/null
-package org.usfirst.frc.team3501.robot.commands.defensearm;
-
-import org.usfirst.frc.team3501.robot.Robot;
-
-import edu.wpi.first.wpilibj.command.Command;
-
-/***
- * This command is intended to be run from OI using button.whileHeld(...).
- * It lowers the defenseWrist continually while the button is being held down.
- *
- * @author shaina
- *
- */
-public class LowerDefenseWristContinuous extends Command {
-
- private double speed;
-
- public LowerDefenseWristContinuous(double speed) {
- requires(Robot.defenseArm);
- this.speed = -speed;
- }
-
- @Override
- protected void initialize() {
- Robot.defenseArm.setHandSpeed(speed);
- }
-
- @Override
- protected void execute() {
- }
-
- @Override
- protected boolean isFinished() {
- return true;
- }
-
- @Override
- protected void end() {
- Robot.defenseArm.setHandSpeed(0);
- }
-
- @Override
- protected void interrupted() {
- end();
- }
-}
+++ /dev/null
-package org.usfirst.frc.team3501.robot.commands.defensearm;
-
-import org.usfirst.frc.team3501.robot.Robot;
-
-import edu.wpi.first.wpilibj.command.Command;
-
-/***
- * This command is intended to be run from OI using button.whileHeld(...).
- * It raises the defenseArm continually while the button is being held down.
- *
- * @author shaina
- */
-public class RaiseDefenseArmContinuous extends Command {
-
- private double speed;
-
- public RaiseDefenseArmContinuous(double speed) {
- requires(Robot.defenseArm);
- this.speed = speed;
- }
-
- @Override
- protected void initialize() {
- Robot.defenseArm.setArmSpeed(speed);
- }
-
- @Override
- protected void execute() {
- }
-
- @Override
- protected boolean isFinished() {
- return true;
- }
-
- @Override
- protected void end() {
- Robot.defenseArm.setArmSpeed(0);
- }
-
- @Override
- protected void interrupted() {
- end();
- }
-}
+++ /dev/null
-package org.usfirst.frc.team3501.robot.commands.defensearm;
-
-import org.usfirst.frc.team3501.robot.Robot;
-
-import edu.wpi.first.wpilibj.command.Command;
-
-/***
- * This command is intended to be run from OI using button.whileHeld(...).
- * It raises the defenseWrist continually while the button is being held down.
- *
- * @author shaina
- *
- */
-public class RaiseDefenseWristContinuous extends Command {
-
- private double speed;
-
- public RaiseDefenseWristContinuous(double speed) {
- requires(Robot.defenseArm);
- this.speed = speed;
- }
-
- @Override
- protected void initialize() {
- Robot.defenseArm.setHandSpeed(speed);
- }
-
- @Override
- protected void execute() {
- }
-
- @Override
- protected boolean isFinished() {
- return true;
- }
-
- @Override
- protected void end() {
- Robot.defenseArm.setHandSpeed(0);
- }
-
- @Override
- protected void interrupted() {
- end();
- }
-}
+++ /dev/null
-package org.usfirst.frc.team3501.robot.commands.defensearm;
-
-import org.usfirst.frc.team3501.robot.Robot;
-
-import edu.wpi.first.wpilibj.command.CommandGroup;
-
-/***
- * This command group simultaneously move arm and hand to retracted position.
- *
- * @author shaina
- *
- */
-public class RetractDefenseArm extends CommandGroup {
- static final double ARM_FULLY_RETRACTED_ANGLE = 0; // change value once tested
- static final double HAND_FULLY_RETRACTED_ANGLE = 0; // change value once
- // tested
-
- public RetractDefenseArm(double speed) {
- requires(Robot.defenseArm);
-
- addParallel(new SetArmToAngle(speed, ARM_FULLY_RETRACTED_ANGLE));
- addParallel(new SetHandToAngle(speed, HAND_FULLY_RETRACTED_ANGLE));
- }
-}
+++ /dev/null
-package org.usfirst.frc.team3501.robot.commands.defensearm;
-
-import org.usfirst.frc.team3501.robot.Robot;
-
-import edu.wpi.first.wpilibj.command.Command;
-
-/***
- * This command moves the defense arm to a input angle position.
- * Requires input of a targetPosition and a speed.
- *
- * @author shaina
- *
- */
-public class SetArmToAngle extends Command {
- private static final double THRESHOLD = 0.1;
- private double speed;
- private double targetPosition;
- private double currentPosition;
- private boolean isDecreasing = false;
-
- public SetArmToAngle(double speed, double targetPosition) {
- requires(Robot.defenseArm);
-
- this.speed = speed;
- this.targetPosition = targetPosition;
- }
-
- @Override
- public void initialize() {
- currentPosition = Robot.defenseArm.getArmPotAngle();
-
- if (currentPosition > targetPosition) {
- Robot.defenseArm.setArmSpeed(-speed);
- isDecreasing = true;
- } else {
- Robot.defenseArm.setArmSpeed(speed);
- isDecreasing = false;
- }
- }
-
- @Override
- public void execute() {
-
- }
-
- @Override
- public boolean isFinished() {
- currentPosition = Robot.defenseArm.getArmPotAngle();
-
- if (isDecreasing == true) {
- return (currentPosition <= targetPosition + THRESHOLD);
- } else {
- return (currentPosition >= targetPosition - THRESHOLD);
- }
- }
-
- @Override
- public void end() {
- Robot.defenseArm.setArmSpeed(0);
- }
-
- @Override
- protected void interrupted() {
- end();
- }
-
-}
+++ /dev/null
-package org.usfirst.frc.team3501.robot.commands.defensearm;
-
-import org.usfirst.frc.team3501.robot.Robot;
-
-import edu.wpi.first.wpilibj.command.Command;
-
-/***
- * This command moves the defense arm to a input angle position.
- * Requires input of a targetPosition and a speed.
- *
- * @author shaina
- *
- */
-public class SetHandToAngle extends Command {
- private static final double THRESHOLD = 0.1;
- private double speed;
- private double targetPosition;
- private double currentPosition;
- private boolean isDecreasing = false;
-
- public SetHandToAngle(double speed, double targetPosition) {
- requires(Robot.defenseArm);
-
- this.speed = speed;
- this.targetPosition = targetPosition;
- }
-
- @Override
- public void initialize() {
- currentPosition = Robot.defenseArm.getHandPotAngle();
-
- if (currentPosition > targetPosition) {
- Robot.defenseArm.setArmSpeed(-speed);
- isDecreasing = true;
- } else {
- Robot.defenseArm.setArmSpeed(speed);
- isDecreasing = false;
- }
- }
-
- @Override
- public void execute() {
-
- }
-
- @Override
- public boolean isFinished() {
- currentPosition = Robot.defenseArm.getHandPotAngle();
-
- if (isDecreasing == true) {
- return (currentPosition <= targetPosition + THRESHOLD);
- } else {
- return (currentPosition >= targetPosition - THRESHOLD);
- }
- }
-
- @Override
- public void end() {
- Robot.defenseArm.setArmSpeed(0);
- }
-
- @Override
- protected void interrupted() {
- end();
- }
-
-}
--- /dev/null
+package org.usfirst.frc.team3501.robot.commands.doublejointeddefensearm;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/***
+ * This command is intended to be run from OI using button.whileHeld(...).
+ * It lowers the defenseArm continually while the button is being held down.
+ *
+ * @author shaina
+ *
+ */
+public class LowerDefenseArmContinuous extends Command {
+
+ private double speed;
+
+ public LowerDefenseArmContinuous(double speed) {
+ requires(Robot.defenseArm);
+ this.speed = -speed;
+ }
+
+ @Override
+ protected void initialize() {
+ Robot.defenseArm.setArmSpeed(speed);
+ }
+
+ @Override
+ protected void execute() {
+ }
+
+ @Override
+ protected boolean isFinished() {
+ return true;
+ }
+
+ @Override
+ protected void end() {
+ Robot.defenseArm.setArmSpeed(0);
+ }
+
+ @Override
+ protected void interrupted() {
+ end();
+ }
+}
--- /dev/null
+package org.usfirst.frc.team3501.robot.commands.doublejointeddefensearm;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/***
+ * This command is intended to be run from OI using button.whileHeld(...).
+ * It lowers the defenseWrist continually while the button is being held down.
+ *
+ * @author shaina
+ *
+ */
+public class LowerDefenseWristContinuous extends Command {
+
+ private double speed;
+
+ public LowerDefenseWristContinuous(double speed) {
+ requires(Robot.defenseArm);
+ this.speed = -speed;
+ }
+
+ @Override
+ protected void initialize() {
+ Robot.defenseArm.setHandSpeed(speed);
+ }
+
+ @Override
+ protected void execute() {
+ }
+
+ @Override
+ protected boolean isFinished() {
+ return true;
+ }
+
+ @Override
+ protected void end() {
+ Robot.defenseArm.setHandSpeed(0);
+ }
+
+ @Override
+ protected void interrupted() {
+ end();
+ }
+}
--- /dev/null
+package org.usfirst.frc.team3501.robot.commands.doublejointeddefensearm;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+public class MoveDefenseArmContinuous extends Command {
+
+ public MoveDefenseArmContinuous() {
+ }
+
+ @Override
+ protected void initialize() {
+ }
+
+ @Override
+ protected void execute() {
+ }
+
+ @Override
+ protected boolean isFinished() {
+ return false;
+ }
+
+ @Override
+ protected void end() {
+ }
+
+ @Override
+ protected void interrupted() {
+ }
+}
--- /dev/null
+package org.usfirst.frc.team3501.robot.commands.doublejointeddefensearm;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+public class MoveDefenseArmToAngle extends Command {
+ private double currentAngle;
+ private double targetAngle;
+ private double targetSpeed;
+ private double SENSITIVITY_THRESHOLD = 0.1;
+ private boolean isDecreasing = false;
+
+ public MoveDefenseArmToAngle(double angle, double speed) {
+ requires(Robot.intakeArm);
+ targetAngle = angle;
+ targetSpeed = speed;
+
+ }
+
+ @Override
+ protected void initialize() {
+ currentAngle = Robot.intakeArm.getArmAngle();
+ double difference = targetAngle - currentAngle;
+ if (difference > 0) {
+ Robot.intakeArm.setArmSpeed(targetSpeed);
+ isDecreasing = true;
+ } else {
+ Robot.intakeArm.setArmSpeed(-targetSpeed);
+ isDecreasing = false;
+ }
+ }
+
+ @Override
+ protected void execute() {
+
+ }
+
+ @Override
+ protected boolean isFinished() {
+ currentAngle = Robot.intakeArm.getArmAngle();
+
+ if (isDecreasing == true) {
+ return (currentAngle <= targetAngle + SENSITIVITY_THRESHOLD);
+ } else {
+ return (currentAngle >= targetAngle + SENSITIVITY_THRESHOLD);
+ }
+ }
+
+ @Override
+ protected void end() {
+ Robot.intakeArm.stop();
+ }
+
+ @Override
+ protected void interrupted() {
+ }
+
+}
--- /dev/null
+package org.usfirst.frc.team3501.robot.commands.doublejointeddefensearm;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/***
+ * This command is intended to be run from OI using button.whileHeld(...).
+ * It raises the defenseArm continually while the button is being held down.
+ *
+ * @author shaina
+ */
+public class RaiseDefenseArmContinuous extends Command {
+
+ private double speed;
+
+ public RaiseDefenseArmContinuous(double speed) {
+ requires(Robot.defenseArm);
+ this.speed = speed;
+ }
+
+ @Override
+ protected void initialize() {
+ Robot.defenseArm.setArmSpeed(speed);
+ }
+
+ @Override
+ protected void execute() {
+ }
+
+ @Override
+ protected boolean isFinished() {
+ return true;
+ }
+
+ @Override
+ protected void end() {
+ Robot.defenseArm.setArmSpeed(0);
+ }
+
+ @Override
+ protected void interrupted() {
+ end();
+ }
+}
--- /dev/null
+package org.usfirst.frc.team3501.robot.commands.doublejointeddefensearm;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/***
+ * This command is intended to be run from OI using button.whileHeld(...).
+ * It raises the defenseWrist continually while the button is being held down.
+ *
+ * @author shaina
+ *
+ */
+public class RaiseDefenseWristContinuous extends Command {
+
+ private double speed;
+
+ public RaiseDefenseWristContinuous(double speed) {
+ requires(Robot.defenseArm);
+ this.speed = speed;
+ }
+
+ @Override
+ protected void initialize() {
+ Robot.defenseArm.setHandSpeed(speed);
+ }
+
+ @Override
+ protected void execute() {
+ }
+
+ @Override
+ protected boolean isFinished() {
+ return true;
+ }
+
+ @Override
+ protected void end() {
+ Robot.defenseArm.setHandSpeed(0);
+ }
+
+ @Override
+ protected void interrupted() {
+ end();
+ }
+}
--- /dev/null
+package org.usfirst.frc.team3501.robot.commands.doublejointeddefensearm;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.CommandGroup;
+
+/***
+ * This command group simultaneously move arm and hand to retracted position.
+ *
+ * @author shaina
+ *
+ */
+public class RetractDefenseArm extends CommandGroup {
+ static final double ARM_FULLY_RETRACTED_ANGLE = 0; // change value once tested
+ static final double HAND_FULLY_RETRACTED_ANGLE = 0; // change value once
+ // tested
+
+ public RetractDefenseArm(double speed) {
+ requires(Robot.defenseArm);
+
+ addParallel(new SetArmToAngle(speed, ARM_FULLY_RETRACTED_ANGLE));
+ addParallel(new SetHandToAngle(speed, HAND_FULLY_RETRACTED_ANGLE));
+ }
+}
--- /dev/null
+package org.usfirst.frc.team3501.robot.commands.doublejointeddefensearm;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/***
+ * This command moves the defense arm to a input angle position.
+ * Requires input of a targetPosition and a speed.
+ *
+ * @author shaina
+ *
+ */
+public class SetArmToAngle extends Command {
+ private static final double THRESHOLD = 0.1;
+ private double speed;
+ private double targetPosition;
+ private double currentPosition;
+ private boolean isDecreasing = false;
+
+ public SetArmToAngle(double speed, double targetPosition) {
+ requires(Robot.defenseArm);
+
+ this.speed = speed;
+ this.targetPosition = targetPosition;
+ }
+
+ @Override
+ public void initialize() {
+ currentPosition = Robot.defenseArm.getArmPotAngle();
+
+ if (currentPosition > targetPosition) {
+ Robot.defenseArm.setArmSpeed(-speed);
+ isDecreasing = true;
+ } else {
+ Robot.defenseArm.setArmSpeed(speed);
+ isDecreasing = false;
+ }
+ }
+
+ @Override
+ public void execute() {
+
+ }
+
+ @Override
+ public boolean isFinished() {
+ currentPosition = Robot.defenseArm.getArmPotAngle();
+
+ if (isDecreasing == true) {
+ return (currentPosition <= targetPosition + THRESHOLD);
+ } else {
+ return (currentPosition >= targetPosition - THRESHOLD);
+ }
+ }
+
+ @Override
+ public void end() {
+ Robot.defenseArm.setArmSpeed(0);
+ }
+
+ @Override
+ protected void interrupted() {
+ end();
+ }
+
+}
--- /dev/null
+package org.usfirst.frc.team3501.robot.commands.doublejointeddefensearm;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/***
+ * This command moves the defense arm to a input angle position.
+ * Requires input of a targetPosition and a speed.
+ *
+ * @author shaina
+ *
+ */
+public class SetHandToAngle extends Command {
+ private static final double THRESHOLD = 0.1;
+ private double speed;
+ private double targetPosition;
+ private double currentPosition;
+ private boolean isDecreasing = false;
+
+ public SetHandToAngle(double speed, double targetPosition) {
+ requires(Robot.defenseArm);
+
+ this.speed = speed;
+ this.targetPosition = targetPosition;
+ }
+
+ @Override
+ public void initialize() {
+ currentPosition = Robot.defenseArm.getHandPotAngle();
+
+ if (currentPosition > targetPosition) {
+ Robot.defenseArm.setArmSpeed(-speed);
+ isDecreasing = true;
+ } else {
+ Robot.defenseArm.setArmSpeed(speed);
+ isDecreasing = false;
+ }
+ }
+
+ @Override
+ public void execute() {
+
+ }
+
+ @Override
+ public boolean isFinished() {
+ currentPosition = Robot.defenseArm.getHandPotAngle();
+
+ if (isDecreasing == true) {
+ return (currentPosition <= targetPosition + THRESHOLD);
+ } else {
+ return (currentPosition >= targetPosition - THRESHOLD);
+ }
+ }
+
+ @Override
+ public void end() {
+ Robot.defenseArm.setArmSpeed(0);
+ }
+
+ @Override
+ protected void interrupted() {
+ end();
+ }
+
+}