Skip to content

Commit

Permalink
Merge pull request #111 from frc937/clear-stick-faults
Browse files Browse the repository at this point in the history
Clear stick faults
  • Loading branch information
Jack-Haefele authored Mar 8, 2024
2 parents f8519c3 + c6e3357 commit 37addc2
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import frc.robot.Controllers.Keymap;
import frc.robot.commands.AimAndFireRoutine;
import frc.robot.commands.AimWithLimelight;
import frc.robot.commands.ClearPDPStickyFaults;
import frc.robot.commands.ClimbDown;
import frc.robot.commands.ClimbUp;
import frc.robot.commands.DeployUrMom;
Expand All @@ -41,6 +42,7 @@
import frc.robot.subsystems.Drive;
import frc.robot.subsystems.Intake;
import frc.robot.subsystems.Limelight;
import frc.robot.subsystems.PDP;
import frc.robot.subsystems.UrMom;
import frc.robot.subsystems.mailbox.Mailbox;
import frc.robot.subsystems.mailbox.MailboxBelts;
Expand Down Expand Up @@ -85,6 +87,9 @@ public class RobotContainer {
/** Singleton instance of {@link Climber} for the whole robot. */
public static Climber climber = new Climber();

/** Singleton instance of {@link PDP} for the whole robot. */
public static PDP pdp = new PDP();

/*
* ************
* * COMMANDS *
Expand Down Expand Up @@ -218,6 +223,9 @@ public class RobotContainer {
/** Singleton instance of {@link TaxiAuto} for the whole robot. */
public static TaxiAuto taxiAuto = new TaxiAuto();

/** Singleton instance of {@link ClearPDPStickyFaults} for the whole robot. */
public static ClearPDPStickyFaults clearPDPStickyFaults = new ClearPDPStickyFaults();

/*
* ***********************
* * OTHER INSTANCE VARS *
Expand All @@ -233,6 +241,7 @@ public class RobotContainer {
public RobotContainer() {
configureBindings();
configureAuto();
SmartDashboard.putData("Clear PDP sticky faults", clearPDPStickyFaults);

drive.setDefaultCommand(driveRobotOriented);
}
Expand Down
48 changes: 48 additions & 0 deletions src/main/java/frc/robot/commands/ClearPDPStickyFaults.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

/*
* Asimov's Laws:
* The First Law: A robot may not injure a human being or, through inaction, allow a human being to come to harm.
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot.commands;

import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.RobotContainer;
import frc.robot.subsystems.PDP;

/** Clears the PDP's sticky faults */
public class ClearPDPStickyFaults extends Command {

private PDP pdp;

/** Creates a new ClearPDPStickyFaults. */
public ClearPDPStickyFaults() {
this.pdp = RobotContainer.pdp;
addRequirements(this.pdp);
}

// Called when the command is initially scheduled.
@Override
public void initialize() {
pdp.clearStickyFaults();
}

// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {}

// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {}

// Returns true when the command should end.
@Override
public boolean isFinished() {
return true;
}
}
36 changes: 36 additions & 0 deletions src/main/java/frc/robot/subsystems/PDP.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

/*
* Asimov's Laws:
* The First Law: A robot may not injure a human being or, through inaction, allow a human being to come to harm.
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot.subsystems;

import edu.wpi.first.wpilibj.PowerDistribution;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

/** PDP of the robot */
public class PDP extends SubsystemBase {

private PowerDistribution powerDistributionPanel;

/** Creates a new PDP. */
public PDP() {
this.powerDistributionPanel = new PowerDistribution();
}

/** Clears the sticky faults of the PDP */
public void clearStickyFaults() {
powerDistributionPanel.clearStickyFaults();
}

@Override
public void periodic() {
// This method will be called once per scheduler run
}
}

0 comments on commit 37addc2

Please sign in to comment.