Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Commit

Permalink
Implemented intake into superstructure manager and add TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanjcoderman committed Aug 26, 2023
1 parent 4c9d5f9 commit a443146
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,19 @@ public class Robot extends LoggedRobot {

private final DriveController driveController = new DriveController(0);
private final CommandXboxController operatorController = new CommandXboxController(1);
private final RumbleControllerSubsystem rumbleController = new RumbleControllerSubsystem(new XboxController(1));
private final RumbleControllerSubsystem rumbleController =
new RumbleControllerSubsystem(new XboxController(1));

private final FmsSubsystem fmsSubsystem = new FmsSubsystem();
// TODO: Add all the subsystems & managers here

private final Autos autos = new Autos();

private Command autoCommand;

public Robot() {

//XboxController.x().onTrue(wrist.setPositionCommand(10));
// TODO: Start adding button bindings

// Log to a USB stick
Logger.getInstance().addDataReceiver(new WPILOGWriter("/media/sda1/"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ private void setGoal(SuperstructureState goalState) {
}

public boolean atGoal(SuperstructureState state) {
return shoulder.atAngle(state.position.shoulderAngle.getDegrees())
&& wrist.atAngle(state.position.wristAngle.getDegrees());
return motionManager.atPosition(state.position) && intake.atGoal(state.intakeState);
}

// in enabledperiodic, go to the goal position
@Override
public void enabledPeriodic() {
motionManager.set(goalState.position);

if (motionManager.atPosition(goalState.position) || goalState.intakeNow) {
intake.setGoalState(goalState.intakeState);
}
}

public Command setStateCommand(SuperstructureState newGoalState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public SuperstructureMotionManager(WristSubsystem shoulder, WristSubsystem wrist
this.wrist = wrist;
}

private boolean atPosition(SuperstructurePosition position) {
public boolean atPosition(SuperstructurePosition position) {
return shoulder.atAngle(position.shoulderAngle)
&& wrist.atAngle(position.wristAngle);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

public class SuperstructureState {
public final SuperstructurePosition position;
public final IntakeState intakeMode;
public final IntakeState intakeState;
public final boolean intakeNow;

public SuperstructureState(
SuperstructurePosition position, IntakeState intakeMode, boolean intakeNow) {
this.position = position;
this.intakeMode = intakeMode;
this.intakeState = intakeMode;
this.intakeNow = intakeNow;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/wrist/WristSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public Command setPositionCommand(Rotation2d angle) {
.until(() -> atAngle(angle));
}

private boolean atAngle(Rotation2d angle) {
public boolean atAngle(Rotation2d angle) {
double actualAngle = getWristAngle().getDegrees();
return Math.abs(actualAngle - angle.getDegrees()) < 1;
}
Expand Down

0 comments on commit a443146

Please sign in to comment.