-
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 remote-tracking branch 'origin/climbing' into elevator
- Loading branch information
Showing
9 changed files
with
220 additions
and
0 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
29 changes: 29 additions & 0 deletions
29
src/main/java/org/team1540/robot2024/commands/ElevatorSetpointCommand.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,29 @@ | ||
package org.team1540.robot2024.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import org.team1540.robot2024.Constants.Elevator.ElevatorState; | ||
import org.team1540.robot2024.subsystems.fakesubsystems.Elevator; | ||
|
||
public class ElevatorSetpointCommand extends Command { | ||
private final Elevator elevator; | ||
private final ElevatorState state; | ||
public ElevatorSetpointCommand(Elevator elevator, ElevatorState state) { | ||
this.elevator = elevator; | ||
this.state = state; | ||
addRequirements(elevator); | ||
} | ||
@Override | ||
public void initialize() { | ||
elevator.goToSetpoint(state.heightMeters); | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted) { | ||
elevator.stop(); | ||
} | ||
@Override | ||
public boolean isFinished() { | ||
return elevator.isAtSetpoint(); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/org/team1540/robot2024/commands/climb/ClimbSequence.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,23 @@ | ||
package org.team1540.robot2024.commands.climb; | ||
|
||
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; | ||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
import org.team1540.robot2024.Constants.Elevator.ElevatorState; | ||
import org.team1540.robot2024.commands.ElevatorSetpointCommand; | ||
import org.team1540.robot2024.subsystems.fakesubsystems.Elevator; | ||
import org.team1540.robot2024.subsystems.fakesubsystems.Hooks; | ||
|
||
public class ClimbSequence extends SequentialCommandGroup { | ||
public ClimbSequence(Elevator elevator, Hooks hooks) { //TODO: Write servos no idea how they are supposed to work for now, add them somewhere :D | ||
addCommands( | ||
new ParallelCommandGroup( | ||
new ElevatorSetpointCommand(elevator, ElevatorState.BOTTOM) | ||
//TODO: Put whatever drive/alignment command we plan on using here | ||
), | ||
new ElevatorSetpointCommand(elevator, ElevatorState.CLIMB), | ||
//TODO: Put whatever drive/alignment command we plan on using here | ||
new ElevatorSetpointCommand(elevator, ElevatorState.BOTTOM), | ||
hooks.deployHooksCommand() //TODO: Deploy hooks | ||
); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/team1540/robot2024/commands/climb/DeclimbSequence.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 org.team1540.robot2024.commands.climb; | ||
|
||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
import org.team1540.robot2024.Constants.Elevator.ElevatorState; | ||
import org.team1540.robot2024.commands.ElevatorSetpointCommand; | ||
import org.team1540.robot2024.subsystems.fakesubsystems.Elevator; | ||
import org.team1540.robot2024.subsystems.fakesubsystems.Hooks; | ||
|
||
public class DeclimbSequence extends SequentialCommandGroup { | ||
public DeclimbSequence(Elevator elevator, Hooks hooks) { | ||
addCommands( | ||
new ElevatorSetpointCommand(elevator, ElevatorState.BOTTOM), | ||
hooks.undeployHooksCommand(), //Release hooks | ||
new ElevatorSetpointCommand(elevator, ElevatorState.TOP) | ||
); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/org/team1540/robot2024/commands/climb/ScoreInTrap.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 org.team1540.robot2024.commands.climb; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import org.team1540.robot2024.subsystems.fakesubsystems.Tramp; | ||
|
||
//TODO: Write this command Tramp people :D | ||
public class ScoreInTrap extends Command { | ||
private final Tramp tramp; | ||
public ScoreInTrap(Tramp tramp) { | ||
this.tramp = tramp; | ||
addRequirements(tramp); | ||
} | ||
@Override | ||
public void initialize() { | ||
//TODO: Score in trap :D | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted) { | ||
|
||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/org/team1540/robot2024/commands/climb/TrapAndClimbSequence.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,28 @@ | ||
package org.team1540.robot2024.commands.climb; | ||
|
||
import edu.wpi.first.wpilibj2.command.ParallelDeadlineGroup; | ||
import edu.wpi.first.wpilibj2.command.ParallelRaceGroup; | ||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
import edu.wpi.first.wpilibj2.command.WaitCommand; | ||
import org.team1540.robot2024.Constants; | ||
import org.team1540.robot2024.Constants.Elevator.ElevatorState; | ||
import org.team1540.robot2024.commands.ElevatorSetpointCommand; | ||
import org.team1540.robot2024.subsystems.fakesubsystems.Elevator; | ||
import org.team1540.robot2024.subsystems.fakesubsystems.Hooks; | ||
import org.team1540.robot2024.subsystems.fakesubsystems.Tramp; | ||
|
||
public class TrapAndClimbSequence extends SequentialCommandGroup { | ||
|
||
public TrapAndClimbSequence(Elevator elevator, Hooks hooks, Tramp tramp) { | ||
addCommands( | ||
new ClimbSequence(elevator, hooks), //Climb | ||
new WaitCommand(0.1), //TODO: Perhaps remove this or change it depending on how climbing turns out to be | ||
new ElevatorSetpointCommand(elevator, ElevatorState.TRAP), | ||
new ParallelDeadlineGroup( | ||
new WaitCommand(Constants.Tramp.TRAP_SCORING_TIME_SECONDS), | ||
new ScoreInTrap(tramp) //TODO: Do whatever to this but not my job | ||
), | ||
new ElevatorSetpointCommand(elevator, ElevatorState.BOTTOM) | ||
); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/org/team1540/robot2024/subsystems/fakesubsystems/Elevator.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,18 @@ | ||
package org.team1540.robot2024.subsystems.fakesubsystems; | ||
|
||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
|
||
//TODO: Get rid of this class and make an actual one its just a temporary thingie for David :D | ||
public class Elevator extends SubsystemBase { | ||
public void goToSetpoint(double heightMeters) { | ||
|
||
} | ||
|
||
public void stop() { | ||
|
||
} | ||
|
||
public boolean isAtSetpoint() { | ||
return true; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/org/team1540/robot2024/subsystems/fakesubsystems/Hooks.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 org.team1540.robot2024.subsystems.fakesubsystems; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.InstantCommand; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
//TODO: Get rid of this class and make an actual one its just a temporary thingie for David :D | ||
public class Hooks extends SubsystemBase { | ||
|
||
//TODO: Whoever does this it should retract or deploy the hooks depending on if they are already deployed or retracted | ||
public void deployHooks() { | ||
|
||
} | ||
|
||
public void undeployHooks() { | ||
|
||
} | ||
|
||
/** | ||
* Factory method for deploying hooks | ||
*/ | ||
public Command deployHooksCommand() { | ||
return new InstantCommand(this::deployHooks, this); | ||
} | ||
/** | ||
* Factory method for undeploying hooks | ||
*/ | ||
public Command undeployHooksCommand() { | ||
return new InstantCommand(this::undeployHooks, this); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/org/team1540/robot2024/subsystems/fakesubsystems/Tramp.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,13 @@ | ||
package org.team1540.robot2024.subsystems.fakesubsystems; | ||
|
||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
//TODO: Get rid of this class and make an actual one its just a temporary thingie for David :D | ||
|
||
public class Tramp extends SubsystemBase { | ||
public void setPercent(double percentage) { | ||
|
||
} | ||
public boolean hasScored() { | ||
return true; | ||
} | ||
} |