Skip to content

Commit

Permalink
progress, all real done i think
Browse files Browse the repository at this point in the history
  • Loading branch information
Merridew1 committed Nov 20, 2024
1 parent cde0355 commit 05fd261
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public final class Constants {
* Motor CAN id's.
*/
public static final class Motors {
public static final class DriveTrainMotors {

Check warning on line 24 in src/main/java/frc/robot/Constants.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./src/main/java/frc/robot/Constants.java:24:9: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)
public static final int FRMOTOR = 0;
public static final int FLMOTOR = 1;
public static final int BRMOTOR = 2;
public static final int BLMOTOR = 3;
}
}

/**
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/frc/robot/subsystems/drive/Drivetrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.littletonrobotics.junction.Logger;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;

/**
* Drivetrain subsystem.
Expand All @@ -10,18 +11,24 @@
public class Drivetrain extends SubsystemBase {
private DrivetrainIO io;
private DrivetrainIOInputsAutoLogged inputs = new DrivetrainIOInputsAutoLogged();
private CommandXboxController driver;

/**
* Create Wrist Intake Subsystem
*/
public Drivetrain(DrivetrainIO io) {
this.io = io;
public Drivetrain(DrivetrainIO iop, CommandXboxController driverp) {
this.io = iop;
io.updateInputs(inputs);

}

@Override
public void periodic() {
io.updateInputs(inputs);
Logger.processInputs("Drivetrain", inputs);

double driverY = driver.getLeftY();
double driverX = driver.getRightY();
}
}

6 changes: 4 additions & 2 deletions src/main/java/frc/robot/subsystems/drive/DrivetrainIO.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package frc.robot.subsystems.drive;

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

/**
* DrivetrainIO interface
Expand All @@ -12,7 +11,10 @@ public interface DrivetrainIO {
*/
@AutoLog
public static class DrivetrainIOInputs {
public Rotation2d gyroYaw = new Rotation2d();
public double rightFrontMotor;
public double leftFrontMotor;
public double rightBackMotor;
public double leftbackMotor;
}

/** Updates the set of loggable inputs. */
Expand Down
23 changes: 19 additions & 4 deletions src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
package frc.robot.subsystems.drive;

import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.wpilibj.motorcontrol.VictorSP;
import frc.robot.Constants;

/**
* DrivetrainReal
*/
public class DrivetrainReal implements DrivetrainIO {

VictorSP FLMotor = new VictorSP(Constants.Motors.DriveTrainMotors.FLMOTOR);

Check warning on line 11 in src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Member name 'FLMotor' must match pattern '^[_a-z][_a-zA-Z0-9]*$'. Raw Output: /github/workspace/./src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java:11:14: warning: Member name 'FLMotor' must match pattern '^[_a-z][_a-zA-Z0-9]*$'. (com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck)
VictorSP FRMotor = new VictorSP(Constants.Motors.DriveTrainMotors.FRMOTOR);

Check warning on line 12 in src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Member name 'FRMotor' must match pattern '^[_a-z][_a-zA-Z0-9]*$'. Raw Output: /github/workspace/./src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java:12:14: warning: Member name 'FRMotor' must match pattern '^[_a-z][_a-zA-Z0-9]*$'. (com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck)
VictorSP BLMotor = new VictorSP(Constants.Motors.DriveTrainMotors.BLMOTOR);

Check warning on line 13 in src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Member name 'BLMotor' must match pattern '^[_a-z][_a-zA-Z0-9]*$'. Raw Output: /github/workspace/./src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java:13:14: warning: Member name 'BLMotor' must match pattern '^[_a-z][_a-zA-Z0-9]*$'. (com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck)
VictorSP BRMotor = new VictorSP(Constants.Motors.DriveTrainMotors.BRMOTOR);

Check warning on line 14 in src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Member name 'BRMotor' must match pattern '^[_a-z][_a-zA-Z0-9]*$'. Raw Output: /github/workspace/./src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java:14:14: warning: Member name 'BRMotor' must match pattern '^[_a-z][_a-zA-Z0-9]*$'. (com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck)


/**
* Drivetrain Real
*/
public DrivetrainReal() {}
public DrivetrainReal() {
FLMotor.addFollower(BLMotor);
FRMotor.addFollower(BRMotor);

FRMotor.setInverted(true);
}


@Override
public void updateInputs(DrivetrainIOInputs inputs) {
inputs.gyroYaw = Rotation2d.fromDegrees(0);

}

/**
* Drive Voltage
*/
public void setDriveVoltage(double lvolts, double rvolts) {}
public void setDriveVoltage(double lvolts, double rvolts) {
FRMotor.setVoltage(lvolts);
FRMotor.setVoltage(rvolts);
}

}

0 comments on commit 05fd261

Please sign in to comment.