-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from MOERobotics/houston
Houston
- Loading branch information
Showing
21 changed files
with
456 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj.Timer; | ||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.CollectorSubsystem; | ||
|
||
public class Intake extends Command { | ||
private final double speed; | ||
private CollectorSubsystem collector; | ||
public Intake(CollectorSubsystem collector, double speed){ | ||
this.collector=collector; | ||
this.speed=speed; | ||
} | ||
|
||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
} | ||
|
||
// Called every time the scheduler runs while the command is scheduled. | ||
@Override | ||
public void execute() { | ||
double finalSpeed = 0; | ||
if(speed<0){ | ||
finalSpeed=speed; | ||
} | ||
if (speed>0 && !collector.isCollected()) { //collecting in, we have no note | ||
finalSpeed = speed; | ||
} | ||
collector.updateCollectorSpeed(finalSpeed); | ||
SmartDashboard.putBoolean("started collector", collector.getCollectorState()); | ||
SmartDashboard.putNumber("collector speed", finalSpeed); | ||
} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
collector.stopCollector(); | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
if(collector.isCollected()){ | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj.Timer; | ||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.CollectorSubsystem; | ||
|
||
public class PopNote extends Command { | ||
private final double speed; | ||
private Timer timer; | ||
|
||
private CollectorSubsystem collector; | ||
public PopNote(CollectorSubsystem collector, double speed){ | ||
this.collector=collector; | ||
this.speed=speed; | ||
timer = new Timer(); | ||
} | ||
|
||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
timer.restart(); | ||
} | ||
|
||
// Called every time the scheduler runs while the command is scheduled. | ||
@Override | ||
public void execute() { | ||
double finalSpeed = -speed; | ||
collector.updateCollectorSpeed(finalSpeed); | ||
SmartDashboard.putBoolean("started collector", collector.getCollectorState()); | ||
SmartDashboard.putNumber("collector speed", finalSpeed); | ||
} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
collector.stopCollector(); | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
if(timer.get() >= .1 || !collector.isCollected()){ | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.