diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 8ea39301..6d44280a 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -34,11 +34,12 @@ public static final class RampConstant { public static final class PowerDistributionConstant { // Motor channel - public static final int kCoralShooterMotorCurrentchannel = 7; - public static final int kAlgaeIntakeMotorCurrentchannel = 7; - public static final int kAlgaeRotateMotorCurrentchannel = 7; - public static final int kClimberMotorCurrentchannel = 7; - public static final int kRampMotorCurrentchannel = 7; + public static final int kCoralShooterRightMotorCurrentChannel = 7; + public static final int kCoralShooterLeftMotorCurrentChannel = 7; + public static final int kAlgaeIntakeMotorCurrentChannel = 7; + public static final int kAlgaeRotateMotorCurrentChannel = 7; + public static final int kClimberMotorCurrentChannel = 7; + public static final int kRampMotorCurrentChannel = 7; // Motor Max Current public static final double kCoralShooterMotorMaxCurrent = 40; public static final double kAlgaeIntakeMotorMaxCurrent = 40; diff --git a/src/main/java/frc/robot/subsystems/PowerDistributionSubsystem.java b/src/main/java/frc/robot/lib/PowerDistribution.java similarity index 64% rename from src/main/java/frc/robot/subsystems/PowerDistributionSubsystem.java rename to src/main/java/frc/robot/lib/PowerDistribution.java index 0ca0b6af..c390c4f5 100644 --- a/src/main/java/frc/robot/subsystems/PowerDistributionSubsystem.java +++ b/src/main/java/frc/robot/lib/PowerDistribution.java @@ -1,20 +1,15 @@ -// 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. +package frc.robot.lib; -package frc.robot.subsystems; - -import edu.wpi.first.wpilibj.PowerDistribution; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; -import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants.PowerDistributionConstant; -public class PowerDistributionSubsystem extends SubsystemBase { - private PowerDistribution powerDistribution; +public class PowerDistribution { + private edu.wpi.first.wpilibj.PowerDistribution powerDistribution; - public PowerDistributionSubsystem() { - powerDistribution = new PowerDistribution(); - SmartDashboard.putNumber("coralShooterCurrent", 0); + public PowerDistribution() { + powerDistribution = new edu.wpi.first.wpilibj.PowerDistribution(); + SmartDashboard.putNumber("coralShooterRightCurrent", 0); + SmartDashboard.putNumber("coralShooterLeftCurrent", 0); SmartDashboard.putNumber("algaeIntakeCurrent", 0); SmartDashboard.putNumber("algaeRotateCurrent", 0); SmartDashboard.putNumber("climberCurrent", 0); @@ -26,46 +21,56 @@ public PowerDistributionSubsystem() { SmartDashboard.putBoolean("isRampOverCurrent", false); } - public double coralShooterCurrent() { + public double coralShooterRightCurrent() { double current = powerDistribution - .getCurrent(PowerDistributionConstant.kCoralShooterMotorCurrentchannel); - SmartDashboard.putNumber("coralShooterCurrent", current); + .getCurrent(PowerDistributionConstant.kCoralShooterRightMotorCurrentChannel); + SmartDashboard.putNumber("coralShooterRightCurrent", current); + return current; + } + + public double coralShooterLeftCurrent() { + double current = powerDistribution + .getCurrent(PowerDistributionConstant.kCoralShooterLeftMotorCurrentChannel); + SmartDashboard.putNumber("coralShooterLeftCurrent", current); return current; } public double algaeIntakeCurrent() { double current = powerDistribution - .getCurrent(PowerDistributionConstant.kAlgaeIntakeMotorCurrentchannel); + .getCurrent(PowerDistributionConstant.kAlgaeIntakeMotorCurrentChannel); SmartDashboard.putNumber("algaeIntakeCurrent", current); return current; } public double algaeRotateCurrent() { double current = powerDistribution - .getCurrent(PowerDistributionConstant.kAlgaeRotateMotorCurrentchannel); + .getCurrent(PowerDistributionConstant.kAlgaeRotateMotorCurrentChannel); SmartDashboard.putNumber("algaeRotateCurrent", current); return current; } public double climberCurrent() { double current = powerDistribution - .getCurrent(PowerDistributionConstant.kClimberMotorCurrentchannel); + .getCurrent(PowerDistributionConstant.kClimberMotorCurrentChannel); SmartDashboard.putNumber("climberCurrent", current); return current; } public double rampCurrent() { double current = powerDistribution - .getCurrent(PowerDistributionConstant.kRampMotorCurrentchannel); + .getCurrent(PowerDistributionConstant.kRampMotorCurrentChannel); SmartDashboard.putNumber("rampCurrent", current); return current; } public boolean isCoralShooterOverCurrent() { - boolean isOverCurrent = - coralShooterCurrent() > PowerDistributionConstant.kCoralShooterMotorMaxCurrent; - SmartDashboard.putBoolean("isCoralShooterOverCurrent", isOverCurrent); - return isOverCurrent; + boolean isRightMotorOverCurrent = + coralShooterRightCurrent() > PowerDistributionConstant.kCoralShooterMotorMaxCurrent; + boolean isLeftMotorOverCurrent = + coralShooterLeftCurrent() > PowerDistributionConstant.kCoralShooterMotorMaxCurrent; + SmartDashboard.putBoolean("isCoralShooterOverCurrent", + isLeftMotorOverCurrent || isRightMotorOverCurrent); + return isLeftMotorOverCurrent || isRightMotorOverCurrent; } public boolean isAlgaeIntakeOverCurrent() { @@ -82,7 +87,7 @@ public boolean isAlgaeRotateOverCurrent() { return isOverCurrent; } - public boolean isClimbeOverCurrent() { + public boolean isClimberOverCurrent() { boolean isOverCurrent = climberCurrent() > PowerDistributionConstant.kClimberMotorMaxCurrent; SmartDashboard.putBoolean("isClimberOverCurrent", isOverCurrent); @@ -96,4 +101,4 @@ public boolean isRampOverCurrent() { return isOverCurrent; } -} +} \ No newline at end of file