Compare commits
4 Commits
359a9a6bbb
...
66049f1357
| Author | SHA1 | Date | |
|---|---|---|---|
| 66049f1357 | |||
| 95108b7da7 | |||
| 22c7ec79e2 | |||
| c5df269a49 |
@@ -46,10 +46,20 @@ public class RobotContainer {
|
|||||||
driver::getLeftY,
|
driver::getLeftY,
|
||||||
driver::getLeftX,
|
driver::getLeftX,
|
||||||
driver::getRightX,
|
driver::getRightX,
|
||||||
() -> true
|
() -> false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
driver.start().and(driver.x()).whileTrue(drivetrain.runFrontLeft(1, 0));
|
||||||
|
driver.start().and(driver.y()).whileTrue(drivetrain.runFrontRight(1, 0));
|
||||||
|
driver.start().and(driver.a()).whileTrue(drivetrain.runRearLeft(1, 0));
|
||||||
|
driver.start().and(driver.b()).whileTrue(drivetrain.runRearRight(1, 0));
|
||||||
|
driver.start().negate().and(driver.x()).whileTrue(drivetrain.runFrontLeft(0, 45));
|
||||||
|
driver.start().negate().and(driver.y()).whileTrue(drivetrain.runFrontRight(0, 45));
|
||||||
|
driver.start().negate().and(driver.a()).whileTrue(drivetrain.runRearLeft(0, 45));
|
||||||
|
driver.start().negate().and(driver.b()).whileTrue(drivetrain.runRearRight(0, 45));
|
||||||
|
driver.rightBumper().whileTrue(drivetrain.setX());
|
||||||
|
|
||||||
//drivetrain.setDefaultCommand(drivetrain.disableOutputs());
|
//drivetrain.setDefaultCommand(drivetrain.disableOutputs());
|
||||||
|
|
||||||
configureShiftDisplay();
|
configureShiftDisplay();
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ public class ModuleConstants {
|
|||||||
|
|
||||||
turningConfig
|
turningConfig
|
||||||
.idleMode(kTurnIdleMode)
|
.idleMode(kTurnIdleMode)
|
||||||
.smartCurrentLimit(kTurnMotorCurrentLimit);
|
.smartCurrentLimit(kTurnMotorCurrentLimit)
|
||||||
|
.inverted(true);
|
||||||
turningConfig.encoder
|
turningConfig.encoder
|
||||||
//.inverted(true)
|
//.inverted(true)
|
||||||
.positionConversionFactor(kTurningFactor)
|
.positionConversionFactor(kTurningFactor)
|
||||||
@@ -101,5 +102,6 @@ public class ModuleConstants {
|
|||||||
.outputRange(-1, 1)
|
.outputRange(-1, 1)
|
||||||
.positionWrappingEnabled(true)
|
.positionWrappingEnabled(true)
|
||||||
.positionWrappingInputRange(0, 2 * Math.PI);
|
.positionWrappingInputRange(0, 2 * Math.PI);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,35 @@ public class Drivetrain extends SubsystemBase {
|
|||||||
Logger.recordOutput("Drivetrain/Heading", getHeading());
|
Logger.recordOutput("Drivetrain/Heading", getHeading());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Command runFrontLeft(double staticSpeed, double staticAngleDegrees) {
|
||||||
|
return run(() -> {
|
||||||
|
frontLeft.setDesiredState(new SwerveModuleState(
|
||||||
|
staticSpeed,
|
||||||
|
Rotation2d.fromDegrees(staticAngleDegrees)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public Command runFrontRight(double staticSpeed, double staticAngleDegrees) {
|
||||||
|
return run(() -> {
|
||||||
|
frontRight.setDesiredState(new SwerveModuleState(
|
||||||
|
staticSpeed,
|
||||||
|
Rotation2d.fromDegrees(staticAngleDegrees)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public Command runRearLeft(double staticSpeed, double staticAngleDegrees) {
|
||||||
|
return run(() -> {
|
||||||
|
rearLeft.setDesiredState(new SwerveModuleState(
|
||||||
|
staticSpeed,
|
||||||
|
Rotation2d.fromDegrees(staticAngleDegrees)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public Command runRearRight(double staticSpeed, double staticAngleDegrees) {
|
||||||
|
return run(() -> {
|
||||||
|
rearRight.setDesiredState(new SwerveModuleState(
|
||||||
|
staticSpeed,
|
||||||
|
Rotation2d.fromDegrees(staticAngleDegrees)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public Command disableOutputs() {
|
public Command disableOutputs() {
|
||||||
return run(() -> {
|
return run(() -> {
|
||||||
frontLeft.disableOutput();
|
frontLeft.disableOutput();
|
||||||
|
|||||||
Reference in New Issue
Block a user