Comments added

This commit is contained in:
Noah 2024-11-22 13:45:14 +00:00
parent c47d35120c
commit 496891cce4
5 changed files with 11 additions and 0 deletions

View File

@ -26,6 +26,7 @@ public class RobotContainer {
private CommandXboxController driver; private CommandXboxController driver;
//constructor//
public RobotContainer() { public RobotContainer() {
drivetrain = new Drivetrain(); drivetrain = new Drivetrain();
indexer = new Indexer(); indexer = new Indexer();
@ -39,6 +40,7 @@ public class RobotContainer {
} }
private void configureBindings() { private void configureBindings() {
//default commands//
drivetrain.setDefaultCommand( drivetrain.setDefaultCommand(
drivetrain.driveArcade( drivetrain.driveArcade(
null, null,
@ -68,6 +70,7 @@ public class RobotContainer {
driver.x().onTrue(smartShooter()); driver.x().onTrue(smartShooter());
} }
//configures shuffleboard//
private void configureShuffleboard() { private void configureShuffleboard() {
ShuffleboardTab robotIndicatorTab = Shuffleboard.getTab(OIConstants.kRobotIndicatorsTabName); ShuffleboardTab robotIndicatorTab = Shuffleboard.getTab(OIConstants.kRobotIndicatorsTabName);

View File

@ -67,6 +67,7 @@ public class Drivetrain extends SubsystemBase {
drive = new DifferentialDrive(leftFront, rightFront); drive = new DifferentialDrive(leftFront, rightFront);
} }
//getters/
public double getGyroAngle() { public double getGyroAngle() {
return gyro.getAngle() * (DrivetrainConstants.kInvertGyro ? -1 : 1); return gyro.getAngle() * (DrivetrainConstants.kInvertGyro ? -1 : 1);
} }

View File

@ -9,10 +9,12 @@ import frc.robot.constants.IndexerConstants;
public class Indexer extends SubsystemBase { public class Indexer extends SubsystemBase {
private WPI_VictorSPX motor1; private WPI_VictorSPX motor1;
//construtor//
public Indexer(){ public Indexer(){
motor1 = new WPI_VictorSPX(IndexerConstants.kIndexerMotorCAN); motor1 = new WPI_VictorSPX(IndexerConstants.kIndexerMotorCAN);
} }
//indexer commands//
public Command runIndexer(double speed) { public Command runIndexer(double speed) {
return run(() -> { return run(() -> {
motor1.set(speed); motor1.set(speed);

View File

@ -9,10 +9,12 @@ import frc.robot.constants.IntakeConstants;
public class Intake extends SubsystemBase { public class Intake extends SubsystemBase {
private WPI_VictorSPX motor1; private WPI_VictorSPX motor1;
//constructor//
public Intake() { public Intake() {
motor1 = new WPI_VictorSPX(IntakeConstants.kIntakeMotorCAN); motor1 = new WPI_VictorSPX(IntakeConstants.kIntakeMotorCAN);
} }
//intake commands//
public Command runIntake(double speed) { public Command runIntake(double speed) {
return run(() -> { return run(() -> {
motor1.set(speed); motor1.set(speed);

View File

@ -19,6 +19,7 @@ public class Shooter extends SubsystemBase {
private Encoder frontMotorEncoder; private Encoder frontMotorEncoder;
private Encoder rearMotorEncoder; private Encoder rearMotorEncoder;
//constructor//
public Shooter() { public Shooter() {
frontMotor = new WPI_VictorSPX(ShooterConstants.kFrontMotorCAN); frontMotor = new WPI_VictorSPX(ShooterConstants.kFrontMotorCAN);
rearMotor = new WPI_VictorSPX(ShooterConstants.kRearMotorCAN); rearMotor = new WPI_VictorSPX(ShooterConstants.kRearMotorCAN);
@ -48,6 +49,7 @@ public class Shooter extends SubsystemBase {
rearMotorEncoder.setDistancePerPulse(ShooterConstants.kDistancePerPulse); rearMotorEncoder.setDistancePerPulse(ShooterConstants.kDistancePerPulse);
} }
//getters//
public double getFrontEncoder() { public double getFrontEncoder() {
return frontMotorEncoder.getRate(); return frontMotorEncoder.getRate();
} }
@ -60,6 +62,7 @@ public class Shooter extends SubsystemBase {
return (frontMotorEncoder.getRate() + rearMotorEncoder.getRate()) / 2 >= ShooterConstants.kShooterFireSpeed; return (frontMotorEncoder.getRate() + rearMotorEncoder.getRate()) / 2 >= ShooterConstants.kShooterFireSpeed;
} }
//shooter commands//
public Command runAutoShooter() { public Command runAutoShooter() {
return run(() -> { return run(() -> {
double output = bangBangController.calculate( double output = bangBangController.calculate(