-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added states
- Loading branch information
Showing
5 changed files
with
86 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,42 @@ | ||
package frc.robot.core.components; | ||
import edu.wpi.first.wpilibj.SpeedController; | ||
import edu.wpi.first.wpilibj.TimedRobot; | ||
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; | ||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | ||
import frc.robot.core.components.ControlSystem; | ||
import frc.robot.core.components.Drivetrain; | ||
|
||
interface launcher { | ||
boolean stopMotors(); | ||
boolean startMotors(); | ||
double shoot(double velocity, int burst); | ||
boolean nextState; | ||
void stopMotors(); | ||
void startMotors(); | ||
void shoot(double velocity, int burst); | ||
void nextState(); | ||
|
||
|
||
} | ||
class UpShoot implements launcher { | ||
|
||
@Override | ||
public void stopMotors() { | ||
Upshoot.set(0); | ||
|
||
} | ||
|
||
@Override | ||
public void startMotors() { | ||
Upshoot.set(1); | ||
} | ||
|
||
@Override | ||
public void shoot(double velocity, int burst) { | ||
|
||
|
||
|
||
} | ||
|
||
class UpShoot implements launcher{ | ||
@Override | ||
public void nextState() { | ||
|
||
|
||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/frc/robot/core/components/LauncherRevUp.java
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,25 @@ | ||
package frc.robot.core.components; | ||
|
||
import edu.wpi.first.wpilibj.Encoder; | ||
import edu.wpi.first.wpilibj.SpeedController; | ||
|
||
public class LauncherRevUp implements LauncherState { | ||
private final SpeedController motor; | ||
private final Encoder encoder; | ||
|
||
public LauncherRevUp(SpeedController motor, Encoder encoder){ | ||
this.motor = motor; | ||
this.encoder = encoder; | ||
} | ||
|
||
|
||
@Override | ||
public LauncherState run() { | ||
motor.set(1); | ||
if(encoder.getRate() > 10){ | ||
LauncherShoot state = new LauncherShoot(null); | ||
} | ||
return this; | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/frc/robot/core/components/LauncherShoot.java
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,22 @@ | ||
package frc.robot.core.components; | ||
|
||
import edu.wpi.first.wpilibj.SpeedController; | ||
|
||
public class LauncherShoot implements LauncherState{ | ||
private final SpeedController motor; | ||
|
||
public LauncherShoot(SpeedController motor, double velocity, double burst){ | ||
this.motor = motor; | ||
motor.set(velocity); | ||
try { | ||
motor.wait(); | ||
} catch(Exception e) { | ||
|
||
} | ||
//wait until total # of balls are fired | ||
} | ||
|
||
public LauncherState run(){ | ||
return this; | ||
} | ||
} |
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,5 @@ | ||
package frc.robot.core.components; | ||
|
||
public interface LauncherState{ | ||
LauncherState run(); | ||
} |