Skip to content

Commit

Permalink
fix: Got rid of tramp command stuff and fixed trap scoring :D
Browse files Browse the repository at this point in the history
  • Loading branch information
DaviTheDinosaur committed Jan 26, 2024
1 parent b6f8ca3 commit af7557c
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 33 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/team1540/robot2024/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,10 @@ public enum ElevatorState {
}
}
}

public static class Tramp {
public static final double AMP_PERCENTAGE = 0.1540; //TODO: Find these values :D
public static final double TRAP_PERCENTAGE = 0.1678; //TODO: Find these values :D
public static final double TRAP_SCORING_TIME_SECONDS = 1.114; //TODO: Find these values :D
}
}
23 changes: 0 additions & 23 deletions src/main/java/org/team1540/robot2024/commands/DeployHooks.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.team1540.robot2024.subsystems.fakesubsystems.Elevator;

public class ElevatorSetpointCommand extends Command {
//TODO: Write an elevator subsystem, so get rid of this later (Not David's Job)
private final Elevator elevator;
private final ElevatorState state;
public ElevatorSetpointCommand(Elevator elevator, ElevatorState state) {
Expand All @@ -22,4 +21,9 @@ public void initialize() {
public void end(boolean interrupted) {
elevator.stop();
}
@Override
public boolean isFinished() {
return elevator.isAtSetpoint();
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package org.team1540.robot2024.commands;
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;

Expand All @@ -16,7 +17,7 @@ public ClimbSequence(Elevator elevator, Hooks hooks) { //TODO: Write servos no i
new ElevatorSetpointCommand(elevator, ElevatorState.CLIMB),
//TODO: Put whatever drive/alignment command we plan on using here
new ElevatorSetpointCommand(elevator, ElevatorState.BOTTOM),
new DeployHooks(hooks) //TODO: Deploy hooks
hooks.deployHooksCommand() //TODO: Deploy hooks
);
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package org.team1540.robot2024.commands;
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),
new DeployHooks(hooks), //Release hooks
hooks.undeployHooksCommand(), //Release hooks
new ElevatorSetpointCommand(elevator, ElevatorState.TOP)
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package org.team1540.robot2024.commands;
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) {
Expand All @@ -11,10 +12,11 @@ public ScoreInTrap(Tramp tramp) {
}
@Override
public void initialize() {
tramp.scoreInTrap();
//TODO: Score in trap :D
}

@Override
public void end(boolean interrupted) {

}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package org.team1540.robot2024.commands;
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;
Expand All @@ -14,7 +18,10 @@ public TrapAndClimbSequence(Elevator elevator, Hooks hooks, Tramp tramp) {
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 ScoreInTrap(tramp), //TODO: Do whatever to this but not my job
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)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ public void goToSetpoint(double heightMeters) {
public void stop() {

}

public boolean isAtSetpoint() {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
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 {
Expand All @@ -8,4 +10,21 @@ public class Hooks extends SubsystemBase {
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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
//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 scoreInTrap() {
public void setPercent(double percentage) {

}
public boolean hasScored() {
return true;
}
}

0 comments on commit af7557c

Please sign in to comment.