Skip to content

Commit

Permalink
Removed elevator input logging, fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekChen1 committed Dec 1, 2023
1 parent 11ab675 commit 0de89c7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 59 deletions.
3 changes: 2 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import frc.robot.subsystems.DrivebaseSubsystemIO;
import frc.robot.subsystems.ElevatorSubsystem;
import frc.robot.subsystems.ElevatorSubsystem.ElevatorState;
import frc.robot.subsystems.IntakeIO;
import frc.robot.subsystems.IntakeSubsystem;
import frc.robot.subsystems.IntakeSubsystem.Modes;
import frc.robot.subsystems.NetworkWatchdogSubsystem;
Expand Down Expand Up @@ -103,7 +104,7 @@ public class RobotContainer {

private final ElevatorSubsystem elevatorSubsystem = new ElevatorSubsystem();

private final IntakeSubsystem intakeSubsystem = new IntakeSubsystem();
private final IntakeSubsystem intakeSubsystem = new IntakeSubsystem(new IntakeIO() {});

private final SharedReference<NodeSelection> currentNodeSelection =
new SharedReference<>(new NodeSelection(NodeSelectorUtility.defaultNodeStack, Height.HIGH));
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/frc/robot/subsystems/DrivebaseSubsystemIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

package frc.robot.subsystems;

import edu.wpi.first.math.geometry.Rotation2d;
import org.littletonrobotics.junction.AutoLog;

public interface DrivebaseSubsystemIO {
Expand All @@ -38,8 +37,6 @@ public static class DrivebaseSubsystemIOInputs {
public double backRightVelocityRadPerSec = 0.0;
public double backRightAppliedVolts = 0.0;
public double[] backRightCurrentAmps = new double[] {};

public Rotation2d gyroYaw = new Rotation2d();
}

/** Updates the set of loggable inputs. */
Expand Down
39 changes: 0 additions & 39 deletions src/main/java/frc/robot/subsystems/ElevatorIO.java

This file was deleted.

24 changes: 9 additions & 15 deletions src/main/java/frc/robot/subsystems/ElevatorSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@

/** Add your docs here. */
public class ElevatorSubsystem extends SubsystemBase {

private final ElevatorIO io;
private final ElevatorIOInputsAutoLogged inputs = new ElevatorIOInputsAutoLogged();

public enum Modes {
PERCENT_CONTROL,
POSITION_CONTROL,
Expand Down Expand Up @@ -69,9 +65,7 @@ public enum Modes {

public static record ElevatorState(double extension, double angle) {}

public ElevatorSubsystem(ElevatorIO io) {

this.io = io;
public ElevatorSubsystem() {

currentMode = Modes.ZERO;

Expand All @@ -92,15 +86,15 @@ public ElevatorSubsystem(ElevatorIO io) {
leftMotor.setSelectedSensorPosition(0);
wristMotor.setSelectedSensorPosition(0);

currentExtension = inputs.currentExtension;
targetExtension = inputs.targetExtension;
currentWristAngle = inputs.currentWristAngle;
targetAngle = inputs.targetAngle;
elevatorPercentControl = inputs.elevatorPercentControl;
wristPercentControl = inputs.wristPercentControl;
currentExtension = 0.0;
targetExtension = 0.0;
currentWristAngle = 0.0;
targetAngle = 0.0;
elevatorPercentControl = 0.0;
wristPercentControl = 0.0;

elevatorZeroed = inputs.elevatorZeroed;
wristZeroed = inputs.wristZeroed;
elevatorZeroed = false;
wristZeroed = false;

rightMotor.configFactoryDefault();
leftMotor.configFactoryDefault();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/subsystems/IntakeIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public interface IntakeIO {
@AutoLog
public static class IntakeIOInputs {
public Modes currentIntakeMode = Modes.OFF;
public String currentIntakeMode = Modes.OFF.toString();
public double filterOutput = 0.0;
public boolean isCone = false;
public double motorOutput = 0.0;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/frc/robot/subsystems/IntakeSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public IntakeSubsystem(IntakeIO io) {
shuffleboard.addBoolean("is cube intake", () -> motorIO.getIsCone());
}

// These modes should probably be in the IntakeIOTalonFX class
public enum Modes {
INTAKE,
OUTTAKE,
Expand Down Expand Up @@ -93,5 +94,7 @@ public void periodic() {
}

intakePeriodic(mode);

io.updateInputs(inputs);
}
}

0 comments on commit 0de89c7

Please sign in to comment.