add command to robot.java to actually run the LimitSwitchTest arraytest
authorEvanYap <evanyap.14@gmail.com>
Tue, 17 Nov 2015 05:22:52 +0000 (21:22 -0800)
committerEvanYap <evanyap.14@gmail.com>
Tue, 17 Nov 2015 05:22:52 +0000 (21:22 -0800)
src/org/usfirst/frc3501/RiceCatRobot/Robot.java
src/org/usfirst/frc3501/RiceCatRobot/commands/LimitSwitchTest.java
src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmToLevel1.java
src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmToLevel2.java
src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmToLevel3.java
src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java

index 0e4d9348556f06e6da292ef66a7028da9b67df1c..c65eac9bbdd6092c1a421f34ee60eb72ea657aeb 100644 (file)
@@ -1,5 +1,6 @@
 package org.usfirst.frc3501.RiceCatRobot;
 
+import org.usfirst.frc3501.RiceCatRobot.commands.LimitSwitchTest;
 import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm;
 import org.usfirst.frc3501.RiceCatRobot.subsystems.Claw;
 import org.usfirst.frc3501.RiceCatRobot.subsystems.DriveTrain;
@@ -35,6 +36,7 @@ public class Robot extends IterativeRobot {
 
   public void teleopInit() {
     System.out.println("running teleopInit");
+    Scheduler.getInstance().add(new LimitSwitchTest());
   }
 
   public void teleopPeriodic() {
index daedb3c4acd097ee1c6c586e164e2f05a982fc27..3350a83cf903e71e4804fe0cbf73ae13328027c7 100644 (file)
@@ -4,7 +4,8 @@ import edu.wpi.first.wpilibj.command.CommandGroup;
 
 public class LimitSwitchTest extends CommandGroup {
        /**
-        * It is necessary for all commands to be used. From MoveArmToLevel1 - MoveArmToLevel3
+        * It is necessary for all commands to be used. 
+        * From MoveArmToLevel1 - MoveArmToLevel3
         */
        
        public LimitSwitchTest() {
index 158a4bec9e46d56b1c8a015c111b8429d134cc03..c5cf68ad3520b326aa368865cfbcc809efc3995c 100644 (file)
@@ -1,26 +1,26 @@
 package org.usfirst.frc3501.RiceCatRobot.commands;
 
-import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm;
+import org.usfirst.frc3501.RiceCatRobot.Robot;
 
 import edu.wpi.first.wpilibj.command.Command;
 
 public class MoveArmToLevel1 extends Command {
-       Arm arm;
+       
        double slowSpeed = 0.2;
 
        public MoveArmToLevel1() {
-               arm.setArmSpeeds(slowSpeed);
+               Robot.arm.setArmSpeeds(slowSpeed);
        }
 
        protected void initialize() {
-               arm.initializeCounters();
+               Robot.arm.initializeCounters();
        }
 
        protected void execute() {
        }
 
        protected boolean isFinished() {
-               return arm.isSwitch1Hit();
+               return Robot.arm.isSwitch1Hit();
        }
 
        protected void end() {
index 4152739f3b89a55621ee28254cce4267d2383376..2cd560ce3efefdf3d3df4e16b0e6a2eaee63746c 100644 (file)
@@ -1,27 +1,26 @@
 package org.usfirst.frc3501.RiceCatRobot.commands;
 
-import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm;
+import org.usfirst.frc3501.RiceCatRobot.Robot;
 
 import edu.wpi.first.wpilibj.command.Command;
 
 public class MoveArmToLevel2 extends Command {
-       Arm arm;
        double slowSpeed = 0.2;
        public MoveArmToLevel2() {
-               if(arm.getArmSpeed() == 0.0) {
-                       arm.setArmSpeeds(slowSpeed);
+               if(Robot.arm.getArmSpeed() == 0.0) {
+                       Robot.arm.setArmSpeeds(slowSpeed);
                }
        }
 
        protected void initialize() {
-               arm.initializeCounters();
+               Robot.arm.initializeCounters();
        }
 
        protected void execute() {
        }
 
        protected boolean isFinished() {
-               return arm.isSwitch2Hit();
+               return Robot.arm.isSwitch2Hit();
        }
 
        protected void end() {
index d969deec78bfebceb0a5929cfc7760f0043fa6b2..fbbf32a503d37d036f41dbd615c1cab8c5b83fcf 100644 (file)
@@ -1,34 +1,34 @@
 package org.usfirst.frc3501.RiceCatRobot.commands;
 
+import org.usfirst.frc3501.RiceCatRobot.Robot;
 import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm;
 
 import edu.wpi.first.wpilibj.command.Command;
 
 public class MoveArmToLevel3 extends Command {
-       Arm arm;
 
        double slowSpeed = 0.2;
 
        public MoveArmToLevel3() {
-               if (arm.getArmSpeed() == 0.0) {
-                       arm.setArmSpeeds(slowSpeed);
+               if (Robot.arm.getArmSpeed() == 0.0) {
+                       Robot.arm.setArmSpeeds(slowSpeed);
                }
        }
 
        protected void initialize() {
-               arm.initializeCounters();
+               Robot.arm.initializeCounters();
        }
 
        protected void execute() {
        }
 
        protected boolean isFinished() {
-               return arm.isSwitch3Hit();
+               return Robot.arm.isSwitch3Hit();
        }
 
        protected void end() {
                System.out.println("Robot arm has reached level 3");
-               arm.stop();
+               Robot.arm.stop();
        }
 
        protected void interrupted() {
index a29262a37d588133326f94f510c894185886dc42..9aff8c1f45302cd0914024c7116798940ae0f3bb 100644 (file)
@@ -17,6 +17,9 @@ public class Arm extends Subsystem {
        public Arm() {
                left = new CANJaguar(RobotMap.ARM_LEFT);
                right = new CANJaguar(RobotMap.ARM_RIGHT);
+               
+               setDigitalInputValues();
+               setCountersCorrespondingToSwitches();
        }
 
        public void setDigitalInputValues() {