diff --git a/src/main/java/frc4388/robot/subsystems/BoomBoom.java b/src/main/java/frc4388/robot/subsystems/BoomBoom.java index 7898e16..54fc697 100644 --- a/src/main/java/frc4388/robot/subsystems/BoomBoom.java +++ b/src/main/java/frc4388/robot/subsystems/BoomBoom.java @@ -46,15 +46,15 @@ public static class ShooterTableEntry { private ShooterTableEntry[] m_shooterTable; -/* -* Creates new BoomBoom subsystem, has drum shooter and angle adjuster -*/ - /** Creates a new BoomBoom. */ +/** + * Creates a new BoomBoom subsystem, which has the drum shooter. + * @param shooterFalconLeft The left drum motor. + * @param shooterFalconRight The right drum motor. + */ public BoomBoom(WPI_TalonFX shooterFalconLeft, WPI_TalonFX shooterFalconRight) { m_shooterFalconLeft = shooterFalconLeft; m_shooterFalconRight = shooterFalconRight; - try { CSV csv = new CSV<>(ShooterTableEntry::new) { private final Pattern parentheses = Pattern.compile("\\([^\\)]*+\\)"); @@ -81,6 +81,8 @@ public Double getHood(final Double distance) { return linearInterpolate(m_shooterTable, distance, e -> e.distance, e -> e.hoodExt).doubleValue(); } +// TODO: @nathanrsxtn pls java doc your shooter tables code + private static Number linearInterpolate(final E[] table, final Number lookupValue, final Function lookupGetter, final Function targetGetter) { final Map.Entry closestEntry = lookup(table, lookupValue.doubleValue(), lookupGetter, false).orElse(Map.entry(table.length - 1, table[table.length - 1])); final E closestRecord = closestEntry.getValue(); diff --git a/src/main/java/frc4388/robot/subsystems/SwerveDrive.java b/src/main/java/frc4388/robot/subsystems/SwerveDrive.java index 342bbca..f945d3c 100644 --- a/src/main/java/frc4388/robot/subsystems/SwerveDrive.java +++ b/src/main/java/frc4388/robot/subsystems/SwerveDrive.java @@ -130,6 +130,10 @@ public class SwerveDrive extends SubsystemBase { setModuleStates(states); } + /** + * Set each module of the swerve drive to the corresponding desired state. + * @param desiredStates Array of module states to set. + */ public void setModuleStates(SwerveModuleState[] desiredStates) { SwerveDriveKinematics.desaturateWheelSpeeds(desiredStates, Units.feetToMeters(SwerveDriveConstants.MAX_SPEED_FEET_PER_SEC)); for (int i = 0; i < desiredStates.length; i++) { @@ -146,15 +150,7 @@ public class SwerveDrive extends SubsystemBase { updateOdometry(); // SmartDashboard.putNumber("Pigeon Fused Heading", m_gyro.getFusedHeading(fstatus)); - SmartDashboard.putNumber("Pigeon Yaw", m_gyro.getYaw()); - - // SmartDashboard.putNumber("Front Left", modules[0].driveMotor.getSelectedSensorPosition()); - // SmartDashboard.putNumber("Front Right", modules[1].driveMotor.getSelectedSensorPosition()); - // SmartDashboard.putNumber("Back Left", modules[2].driveMotor.getSelectedSensorPosition()); - // SmartDashboard.putNumber("Back Right", modules[3].driveMotor.getSelectedSensorPosition()); - // SmartDashboard.putNumber("Pigeon Get Angle", m_gyro.getAngle()); - // SmartDashboard.putNumber("Pigeon Rotation 2D", m_gyro.getRotation2d().getDegrees()); - // SmartDashboard.putStringArray("Fusion Status", new String[] {"Is Fusing: "+fstatus.bIsFusing, "Is Valid: "+fstatus.bIsValid, "Heading: "+fstatus.heading}); + SmartDashboard.putNumber("Pigeon Yaw", m_gyro.getYaw()); // m_field.setRobotPose(m_poseEstimator.getEstimatedPosition()); super.periodic(); @@ -226,7 +222,10 @@ public class SwerveDrive extends SubsystemBase { // m_poseEstimator.getEstimatedPosition(), // Timer.getFPGATimestamp() - 0.1); } - + + /** + * Resets pigeon. + */ public void resetGyro(){ m_gyro.reset(); rotTarget = new Rotation2d(0); @@ -242,6 +241,10 @@ public class SwerveDrive extends SubsystemBase { modules[3].stop(); } + /** + * Switches speed modes. + * @param shift True if fast mode, false if slow mode. + */ public void highSpeed(boolean shift){ if (shift){ speedAdjust = SwerveDriveConstants.JOYSTICK_TO_METERS_PER_SECOND_FAST;