projects
/
3501
/
2017steamworks
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dd4ecd2
)
Add Intake subsystem, filled in methods for Intake commands
author
Arunima DIvya
<adivya822@student.fuhsd.org>
Sat, 21 Jan 2017 05:10:31 +0000
(21:10 -0800)
committer
Arunima DIvya
<adivya822@student.fuhsd.org>
Thu, 26 Jan 2017 04:10:21 +0000
(20:10 -0800)
src/org/usfirst/frc/team3501/robot/commands/intake/RunContinuous.java
patch
|
blob
|
blame
|
history
src/org/usfirst/frc/team3501/robot/commands/intake/RunIntake.java
patch
|
blob
|
blame
|
history
src/org/usfirst/frc/team3501/robot/commands/intake/StopIntake.java
patch
|
blob
|
blame
|
history
src/org/usfirst/frc/team3501/robot/subsystems/Intake.java
patch
|
blob
|
blame
|
history
diff --git
a/src/org/usfirst/frc/team3501/robot/commands/intake/RunContinuous.java
b/src/org/usfirst/frc/team3501/robot/commands/intake/RunContinuous.java
index 632c543f1177e1403a0e358949422f21d361a15b..d6a4bd0228aae70bce0a0491808f372cb4ec8e3f 100644
(file)
--- a/
src/org/usfirst/frc/team3501/robot/commands/intake/RunContinuous.java
+++ b/
src/org/usfirst/frc/team3501/robot/commands/intake/RunContinuous.java
@@
-1,5
+1,7
@@
package org.usfirst.frc.team3501.robot.commands.intake;
package org.usfirst.frc.team3501.robot.commands.intake;
+import org.usfirst.frc.team3501.robot.subsystems.Intake;
+
import edu.wpi.first.wpilibj.command.Command;
/***
import edu.wpi.first.wpilibj.command.Command;
/***
@@
-10,6
+12,8
@@
import edu.wpi.first.wpilibj.command.Command;
*
*/
public class RunContinuous extends Command {
*
*/
public class RunContinuous extends Command {
+ // create setter method for speed, use setSpeed method to do end() by setting
+ // speed to 0
public RunContinuous() {
public RunContinuous() {
@@
-18,28
+22,32
@@
public class RunContinuous extends Command {
@Override
protected boolean isFinished() {
// TODO Auto-generated method stub
@Override
protected boolean isFinished() {
// TODO Auto-generated method stub
- return
fals
e;
+ return
tru
e;
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
+
}
// 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() {
+
}
// Called once after isFinished returns true
@Override
protected void end() {
}
// Called once after isFinished returns true
@Override
protected void end() {
+ Intake.intake.setSpeed(0);
}
// 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();
}
}
}
}
diff --git
a/src/org/usfirst/frc/team3501/robot/commands/intake/RunIntake.java
b/src/org/usfirst/frc/team3501/robot/commands/intake/RunIntake.java
index ca74e1c60c2e93892277c9d4b7d5529b07a4771b..82bb55001b9c45043fbb42d1d772378e32d4ba01 100644
(file)
--- a/
src/org/usfirst/frc/team3501/robot/commands/intake/RunIntake.java
+++ b/
src/org/usfirst/frc/team3501/robot/commands/intake/RunIntake.java
@@
-1,5
+1,8
@@
package org.usfirst.frc.team3501.robot.commands.intake;
package org.usfirst.frc.team3501.robot.commands.intake;
+import org.usfirst.frc.team3501.robot.subsystems.Intake;
+
+import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.command.Command;
/**
import edu.wpi.first.wpilibj.command.Command;
/**
@@
-10,15
+13,16
@@
import edu.wpi.first.wpilibj.command.Command;
*/
public class RunIntake extends Command {
private double timeToMove;
*/
public class RunIntake extends Command {
private double timeToMove;
+ public Timer timer;
public RunIntake(double timeToMove) {
public RunIntake(double timeToMove) {
+ timer = new Timer();
this.timeToMove = timeToMove;
}
@Override
protected boolean isFinished() {
this.timeToMove = timeToMove;
}
@Override
protected boolean isFinished() {
- // TODO Auto-generated method stub
- return false;
+ return timer.get() >= timeToMove;
}
// Called just before this Command runs the first time
}
// Called just before this Command runs the first time
@@
-34,11
+38,13
@@
public class RunIntake extends Command {
// Called once after isFinished returns true
@Override
protected void end() {
// Called once after isFinished returns true
@Override
protected void end() {
+ Intake.intake.setSpeed(0);
}
// 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();
}
}
}
}
diff --git
a/src/org/usfirst/frc/team3501/robot/commands/intake/StopIntake.java
b/src/org/usfirst/frc/team3501/robot/commands/intake/StopIntake.java
index 6a2cc26c9821ec478b0517b62f8b2cb4c6a80ebd..54e8a603b5aff28bb1b23e8871f921d3b62a0c6d 100644
(file)
--- a/
src/org/usfirst/frc/team3501/robot/commands/intake/StopIntake.java
+++ b/
src/org/usfirst/frc/team3501/robot/commands/intake/StopIntake.java
@@
-1,5
+1,7
@@
package org.usfirst.frc.team3501.robot.commands.intake;
package org.usfirst.frc.team3501.robot.commands.intake;
+import org.usfirst.frc.team3501.robot.subsystems.Intake;
+
import edu.wpi.first.wpilibj.command.Command;
/**
import edu.wpi.first.wpilibj.command.Command;
/**
@@
-26,12
+28,14
@@
public class StopIntake extends Command {
// Called once after isFinished returns true
@Override
protected void end() {
// Called once after isFinished returns true
@Override
protected void end() {
+ Intake.intake.setSpeed(0);
}
// 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();
}
@Override
}
@Override
diff --git
a/src/org/usfirst/frc/team3501/robot/subsystems/Intake.java
b/src/org/usfirst/frc/team3501/robot/subsystems/Intake.java
index 1c891d4837c2709b94335327784e0963cf51107b..f849203d561093a0f5c348e96fcd34a68bdae241 100644
(file)
--- a/
src/org/usfirst/frc/team3501/robot/subsystems/Intake.java
+++ b/
src/org/usfirst/frc/team3501/robot/subsystems/Intake.java
@@
-1,47
+1,36
@@
package org.usfirst.frc.team3501.robot.subsystems;
package org.usfirst.frc.team3501.robot.subsystems;
+import com.ctre.CANTalon;
+
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.command.Subsystem;
-/***
- *
- *
+/**
* @author Meeta
* @author Meeta
- *
*/
public class Intake extends Subsystem {
*/
public class Intake extends Subsystem {
- public Intake() {
-
- }
-
- /**
- * Runs the intake continuously
- */
- public void RunContinous() {
+ public static Intake intake = null;
+ protected double speed = 0;
+ private CANTalon intakeWheel;
- }
-
- /**
- * Starts running the intake for a specific period of time that the user
- * inputs.
- *
- * @param timeToMove
- * in seconds
- */
- public void RunIntake(double timeToMove) {
+ // create speed of intake whee
+ public Intake() {
}
}
- /**
- * Stops the intake
- */
- public void StopIntake() {
-
+ public static Intake getIntake() {
+ if (intake == null) {
+ intake = new Intake();
+ }
+ return intake;
}
@Override
protected void initDefaultCommand() {
}
@Override
protected void initDefaultCommand() {
- // TODO Auto-generated method stub
}
}
+ public void setSpeed(double speed) {
+ this.speed = speed;
+ }
+
}
}