projects
/
3501
/
2017steamworks
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
competition fixes
[3501/2017steamworks]
/
src
/
org
/
usfirst
/
frc
/
team3501
/
robot
/
commands
/
intake
/
ReverseIntakeContinuous.java
diff --git
a/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntakeContinuous.java
b/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntakeContinuous.java
index b84a1920b9cbf90a3509c108522fb1e8a1169fb5..699559d224c4d99313a8512d564d65ddbcd0f3b4 100644
(file)
--- a/
src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntakeContinuous.java
+++ b/
src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntakeContinuous.java
@@
-1,18
+1,24
@@
package org.usfirst.frc.team3501.robot.commands.intake;
import org.usfirst.frc.team3501.robot.Robot;
package org.usfirst.frc.team3501.robot.commands.intake;
import org.usfirst.frc.team3501.robot.Robot;
+import org.usfirst.frc.team3501.robot.subsystems.Intake;
import edu.wpi.first.wpilibj.command.Command;
/**
* Reverses the intake until the button triggering this command is released
*
import edu.wpi.first.wpilibj.command.Command;
/**
* Reverses the intake until the button triggering this command is released
*
- * pre-condition: button is pressed
+ * pre-condition: This command must be run by a button in OI with
+ * button.whileHeld(...).
*/
public class ReverseIntakeContinuous extends Command {
*/
public class ReverseIntakeContinuous extends Command {
+ private Intake intake = Robot.getIntake();
+
+ private double previousMotorValue = 0;
+ private double targetMotorValue = intake.REVERSE_SPEED;
public ReverseIntakeContinuous() {
public ReverseIntakeContinuous() {
- requires(
Robot.getIntake()
);
+ requires(
intake
);
}
// Called just before this Command runs the first time
}
// Called just before this Command runs the first time
@@
-23,6
+29,9
@@
public class ReverseIntakeContinuous extends Command {
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
+ double motorValue = (6 * previousMotorValue + targetMotorValue) / 7;
+ previousMotorValue = motorValue;
+ intake.setSpeed(motorValue);
}
// Make this return true when this Command no longer needs to run execute()
}
// Make this return true when this Command no longer needs to run execute()
@@
-34,11
+43,13
@@
public class ReverseIntakeContinuous extends Command {
// Called once after isFinished returns true
@Override
protected void end() {
// Called once after isFinished returns true
@Override
protected void end() {
+ intake.stopIntake();
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
+ end();
}
}
}
}