From 92da401427f4f1a4cd9ff9495a5b6473f6743bed Mon Sep 17 00:00:00 2001 From: Jason Israilov Date: Sat, 10 Feb 2018 16:08:02 -0500 Subject: [PATCH] Created StopIntake Command --- .../team4737/robot/commands/StopIntake.java | 39 +++++++++++++++++++ .../frc/team4737/robot/subsystems/Intake.java | 13 ++++++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 src/org/usfirst/frc/team4737/robot/commands/StopIntake.java diff --git a/src/org/usfirst/frc/team4737/robot/commands/StopIntake.java b/src/org/usfirst/frc/team4737/robot/commands/StopIntake.java new file mode 100644 index 0000000..e480203 --- /dev/null +++ b/src/org/usfirst/frc/team4737/robot/commands/StopIntake.java @@ -0,0 +1,39 @@ +package org.usfirst.frc.team4737.robot.commands; + +import org.usfirst.frc.team4737.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * + */ +public class StopIntake extends Command { + + public StopIntake() { + // Use requires() here to declare subsystem dependencies + requires(Robot.INTAKE); + } + + // Called just before this Command runs the first time + protected void initialize() { + } + + // Called repeatedly when this Command is scheduled to run + protected void execute() { + Robot.INTAKE.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/Intake.java b/src/org/usfirst/frc/team4737/robot/subsystems/Intake.java index 7f6d926..49fb554 100644 --- a/src/org/usfirst/frc/team4737/robot/subsystems/Intake.java +++ b/src/org/usfirst/frc/team4737/robot/subsystems/Intake.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.StopIntake; import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; @@ -29,6 +30,16 @@ public Intake() { public void initDefaultCommand() { // Set the default command for a subsystem here. - // setDefaultCommand(new MySpecialCommand()); + setDefaultCommand(new StopIntake()); + + } + + /** + * + * @param speed + * ranges from -1 to 1. + */ + public void setSpeed(double speed) { + // TODO } }