generated from StuyPulse/Phil
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Amper commmands Co-authored-by: Rahuldeb75 <Rahuldeb75@users.noreply.github.com> Co-authored-by: k4limul <k4limul@users.noreply.github.com> Co-authored-by: Zixi52 <Zixi52@users.noreply.github.com> Co-authored-by: Baiulus <Baiulus@users.noreply.github.com> Co-authored-by: Rahel Arka <RahelArka@users.noreply.github.com> * preliminary mechanism2d visualization Co-authored-by: Rahuldeb75 <Rahuldeb75@users.noreply.github.com> Co-authored-by: k4limul <k4limul@users.noreply.github.com> Co-authored-by: Zixi52 <Zixi52@users.noreply.github.com> Co-authored-by: Baiulus <Baiulus@users.noreply.github.com> Co-authored-by: Rahel Arka <RahelArka@users.noreply.github.com> * fixed ElevatorSim, put MotionProfile with LiftController, cleaned Amper Commands Co-authored-by: Zixi52 <Zixi52@users.noreply.github.com> Co-authored-by: k4limul <k4limul@users.noreply.github.com> Co-authored-by: Baiulus <Baiulus@users.noreply.github.com> * added AmperWaitToHeight + cleaned command code * Add AmperScoreForever * Fix command requirements * Reorganize Amper and its Settings * Add gravity to elevator --------- Co-authored-by: Rahuldeb75 <Rahuldeb75@users.noreply.github.com> Co-authored-by: k4limul <k4limul@users.noreply.github.com> Co-authored-by: Zixi52 <Zixi52@users.noreply.github.com> Co-authored-by: Baiulus <Baiulus@users.noreply.github.com> Co-authored-by: Rahel Arka <RahelArka@users.noreply.github.com> Co-authored-by: BenG49 <ben@goldfisher.com>
- Loading branch information
1 parent
25357a5
commit 3eb81d3
Showing
11 changed files
with
248 additions
and
36 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/main/java/com/stuypulse/robot/commands/amper/AmperIntake.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 com.stuypulse.robot.commands.amper; | ||
|
||
import com.stuypulse.robot.subsystems.amper.Amper; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
|
||
public class AmperIntake extends Command { | ||
|
||
private final Amper amper; | ||
|
||
public AmperIntake() { | ||
amper = Amper.getInstance(); | ||
addRequirements(amper); | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
amper.intake(); | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted) { | ||
amper.stopRoller(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/com/stuypulse/robot/commands/amper/AmperOuttake.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,30 @@ | ||
package com.stuypulse.robot.commands.amper; | ||
|
||
import com.stuypulse.robot.subsystems.amper.Amper; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
|
||
public class AmperOuttake extends Command { | ||
|
||
private final Amper amper; | ||
|
||
public AmperOuttake() { | ||
amper = Amper.getInstance(); | ||
addRequirements(amper); | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
amper.score(); | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return !amper.hasNote(); | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted) { | ||
amper.stopRoller(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/stuypulse/robot/commands/amper/AmperScoreAmp.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,17 @@ | ||
package com.stuypulse.robot.commands.amper; | ||
|
||
import com.stuypulse.robot.constants.Settings.Amper.Score; | ||
|
||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
|
||
public class AmperScoreAmp extends SequentialCommandGroup { | ||
|
||
public AmperScoreAmp() { | ||
addCommands( | ||
new AmperToHeight(Score.AMP_SCORE_HEIGHT.get()), | ||
new AmperWaitToHeight(Score.AMP_SCORE_HEIGHT.get()), | ||
new AmperOuttake() | ||
); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/stuypulse/robot/commands/amper/AmperScoreForever.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,20 @@ | ||
package com.stuypulse.robot.commands.amper; | ||
|
||
import com.stuypulse.robot.subsystems.amper.Amper; | ||
|
||
import edu.wpi.first.wpilibj2.command.InstantCommand; | ||
|
||
public class AmperScoreForever extends InstantCommand { | ||
|
||
private final Amper amper; | ||
|
||
public AmperScoreForever() { | ||
amper = Amper.getInstance(); | ||
addRequirements(amper); | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
amper.score(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/stuypulse/robot/commands/amper/AmperScoreTrap.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,17 @@ | ||
package com.stuypulse.robot.commands.amper; | ||
|
||
import com.stuypulse.robot.constants.Settings.Amper.Score; | ||
|
||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
|
||
public class AmperScoreTrap extends SequentialCommandGroup { | ||
|
||
public AmperScoreTrap() { | ||
addCommands( | ||
new AmperToHeight(Score.TRAP_SCORE_HEIGHT.get()), | ||
new AmperWaitToHeight(Score.TRAP_SCORE_HEIGHT.get()), | ||
new AmperOuttake() | ||
); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/stuypulse/robot/commands/amper/AmperToHeight.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 com.stuypulse.robot.commands.amper; | ||
|
||
import com.stuypulse.robot.subsystems.amper.Amper; | ||
|
||
import edu.wpi.first.wpilibj2.command.InstantCommand; | ||
|
||
public class AmperToHeight extends InstantCommand { | ||
private final Amper amper; | ||
private final double height; | ||
|
||
public AmperToHeight(double height) { | ||
amper = Amper.getInstance(); | ||
this.height = height; | ||
|
||
addRequirements(amper); | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
amper.setTargetHeight(height); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/stuypulse/robot/commands/amper/AmperWaitToHeight.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,24 @@ | ||
package com.stuypulse.robot.commands.amper; | ||
|
||
import com.stuypulse.robot.constants.Settings.Amper.Lift; | ||
import com.stuypulse.robot.subsystems.amper.Amper; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
|
||
public class AmperWaitToHeight extends Command { | ||
|
||
private final Amper amper; | ||
private final double height; | ||
|
||
public AmperWaitToHeight(double height) { | ||
amper = Amper.getInstance(); | ||
this.height = height; | ||
|
||
addRequirements(amper); | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return Math.abs(amper.getLiftHeight() - height) < Lift.MAX_HEIGHT_ERROR; | ||
} | ||
} |
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
Oops, something went wrong.