diff --git a/src/org/usfirst/frc/team4737/robot/Robot.java b/src/org/usfirst/frc/team4737/robot/Robot.java index df88036..5690480 100644 --- a/src/org/usfirst/frc/team4737/robot/Robot.java +++ b/src/org/usfirst/frc/team4737/robot/Robot.java @@ -12,6 +12,7 @@ import edu.wpi.first.wpilibj.command.Scheduler; import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; + /** * The VM is configured to automatically run this class, and to call the * functions corresponding to each mode, as described in the TimedRobot diff --git a/src/org/usfirst/frc/team4737/robot/commands/StopElevator.java b/src/org/usfirst/frc/team4737/robot/commands/StopElevator.java new file mode 100644 index 0000000..65d65a9 --- /dev/null +++ b/src/org/usfirst/frc/team4737/robot/commands/StopElevator.java @@ -0,0 +1,38 @@ +package org.usfirst.frc.team4737.robot.commands; + +import org.usfirst.frc.team4737.robot.subsystems.Elevator; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * + */ +public class StopElevator extends Command { + + public StopElevator() { + requires(Elevator.getInstance()); + } + + // Called just before this Command runs the first time + protected void initialize() { + } + + // Called repeatedly when this Command is scheduled to run + protected void execute() { + Elevator.getInstance().setSpeed(0); + } + + // Make this return true when this Command no longer needs to run execute() + protected boolean isFinished() { + return false; + } + + // Called once after isFinished returns true + protected void end() { + } + + // Called when another command which requires one or more of the same + // subsystems is scheduled to run + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team4737/robot/subsystems/Climber.java b/src/org/usfirst/frc/team4737/robot/subsystems/Climber.java index 99c4207..ad6e329 100644 --- a/src/org/usfirst/frc/team4737/robot/subsystems/Climber.java +++ b/src/org/usfirst/frc/team4737/robot/subsystems/Climber.java @@ -9,8 +9,8 @@ */ public class Climber extends Subsystem { - private static Climber instance = new Climber (); - + private static Climber instance = new Climber(); + public static Climber getInstance() { return instance; } diff --git a/src/org/usfirst/frc/team4737/robot/subsystems/Drivetrain.java b/src/org/usfirst/frc/team4737/robot/subsystems/Drivetrain.java index b04aa8a..c5ddcc4 100644 --- a/src/org/usfirst/frc/team4737/robot/subsystems/Drivetrain.java +++ b/src/org/usfirst/frc/team4737/robot/subsystems/Drivetrain.java @@ -10,9 +10,9 @@ * */ public class Drivetrain extends Subsystem { - + private static Drivetrain instance = new Drivetrain(); - + public static Drivetrain getInstance() { return instance; } diff --git a/src/org/usfirst/frc/team4737/robot/subsystems/Elevator.java b/src/org/usfirst/frc/team4737/robot/subsystems/Elevator.java index cf1e9f5..312b1d3 100644 --- a/src/org/usfirst/frc/team4737/robot/subsystems/Elevator.java +++ b/src/org/usfirst/frc/team4737/robot/subsystems/Elevator.java @@ -1,6 +1,7 @@ package org.usfirst.frc.team4737.robot.subsystems; import org.usfirst.frc.team4737.robot.RobotMap; +import org.usfirst.frc.team4737.robot.commands.StopElevator; import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; @@ -10,9 +11,9 @@ * */ public class Elevator extends Subsystem { - + private static Elevator instance = new Elevator(); - + public static Elevator getInstance() { return instance; } @@ -30,6 +31,15 @@ public Elevator() { public void initDefaultCommand() { // Set the default command for a subsystem here. - // setDefaultCommand(new MySpecialCommand()); + setDefaultCommand(new StopElevator()); + } + + /** + * + * @param speed + * ranges from -1 to 1 + */ + public void setSpeed(double speed) { + // TODO } } diff --git a/src/org/usfirst/frc/team4737/robot/subsystems/Intake.java b/src/org/usfirst/frc/team4737/robot/subsystems/Intake.java index 4054077..7f6d926 100644 --- a/src/org/usfirst/frc/team4737/robot/subsystems/Intake.java +++ b/src/org/usfirst/frc/team4737/robot/subsystems/Intake.java @@ -12,7 +12,7 @@ public class Intake extends Subsystem { private static Intake instance = new Intake(); - + public static Intake getInstance() { return instance; }