From 94ce2eb3bc568ecac4f6528c5822efabc65f1e3d Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 21 Sep 2016 12:13:07 -0400 Subject: [PATCH] Implemented stopping the arm using limit switches --- src/org/usfirst/frc/team2059/robot/Robot.java | 2 ++ .../frc/team2059/robot/commands/shooter/MoveArm.java | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/org/usfirst/frc/team2059/robot/Robot.java b/src/org/usfirst/frc/team2059/robot/Robot.java index c84f040..efac689 100644 --- a/src/org/usfirst/frc/team2059/robot/Robot.java +++ b/src/org/usfirst/frc/team2059/robot/Robot.java @@ -20,6 +20,8 @@ public class Robot extends IterativeRobot { SmartDashboard.putBoolean("CompressorEnabled", true); //Automatically determine if rolling in or rolling out SmartDashboard.putBoolean("SmartRollers", true); + //Use the limit swithces on the shooter + SmartDashboard.putBoolean("UseLimitSwitches", true); } public void disabledInit() { } diff --git a/src/org/usfirst/frc/team2059/robot/commands/shooter/MoveArm.java b/src/org/usfirst/frc/team2059/robot/commands/shooter/MoveArm.java index 38fd21c..4499827 100644 --- a/src/org/usfirst/frc/team2059/robot/commands/shooter/MoveArm.java +++ b/src/org/usfirst/frc/team2059/robot/commands/shooter/MoveArm.java @@ -1,6 +1,7 @@ package org.usfirst.frc.team2059.robot.commands.shooter; import org.usfirst.frc.team2059.robot.commands.CommandBase; import org.usfirst.frc.team2059.robot.Robot; +import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; /** * */ @@ -21,6 +22,11 @@ public class MoveArm extends CommandBase { } // Make this return true when this Command no longer needs to run execute() protected boolean isFinished() { + if (SmartDashboard.getBoolean("UseLimitSwitches")) { + if (mainArm.getTopPressed() || mainArm.getBottomPressed()) { + return true; + } + } return false; } // Called once after isFinished returns true