auto paths and heading = 0

This commit is contained in:
aarav18
2022-02-05 15:51:32 -07:00
parent e9859e90c6
commit e0d293a0bc
10 changed files with 16 additions and 11 deletions
+2 -2
View File
@@ -66,9 +66,9 @@ public final class Constants {
// swerve auto constants
public static final PIDController X_CONTROLLER = new PIDController(4.0, 0.0, 0.0);
public static final PIDController Y_CONTROLLER = new PIDController(4.0, 0.0, 0.0);
public static final PIDController Y_CONTROLLER = new PIDController(0.01, 0.0, 0.0);
public static final ProfiledPIDController THETA_CONTROLLER = new ProfiledPIDController(
1.0, 0.0, 0.0, new TrapezoidProfile.Constraints(2 * Math.PI, Math.PI));
1.0, 0.0, 0.0, new TrapezoidProfile.Constraints(Math.PI, Math.PI));
// swerve configuration
public static final double NEUTRAL_DEADBAND = 0.04;
@@ -181,7 +181,8 @@ public class RobotContainer {
// ppSwerveControllerCommand,
// new InstantCommand(() -> m_robotSwerveDrive.stopModules())
// );
return runAuto("Move Forward", 5.0, 5.0);
// return runAuto("Move Forward", 5.0, 5.0);
return runAuto("Five Ball", 1.0, 1.0);
}
/**
@@ -49,9 +49,9 @@ public class SwerveModule extends SubsystemBase {
angleMotor.configAllSettings(angleTalonFXConfiguration);
TalonFXConfiguration driveTalonFXConfiguration = new TalonFXConfiguration();
driveTalonFXConfiguration.slot0.kP = 1.0;
driveTalonFXConfiguration.slot0.kP = 0.15;
driveTalonFXConfiguration.slot0.kI = 0.0;
driveTalonFXConfiguration.slot0.kD = 0.0;
driveTalonFXConfiguration.slot0.kD = 0.5;
driveMotor.configAllSettings(driveTalonFXConfiguration);
CANCoderConfiguration canCoderConfiguration = new CANCoderConfiguration();
@@ -89,8 +89,9 @@ public class SwerveModule extends SubsystemBase {
}
// double feetPerSecond = Units.metersToFeet(state.speedMetersPerSecond);
driveMotor.set(TalonFXControlMode.Velocity, /*angleMotor.get() + */(Units.metersToInches(state.speedMetersPerSecond) * SwerveDriveConstants.TICKS_PER_INCH) / 10);
double feetPerSecond = Units.metersToFeet(state.speedMetersPerSecond);
// driveMotor.set(TalonFXControlMode.Velocity, /*angleMotor.get() + */(Units.metersToInches(state.speedMetersPerSecond) * SwerveDriveConstants.TICKS_PER_INCH) / 10);
driveMotor.set(feetPerSecond / SwerveDriveConstants.MAX_SPEED_FEET_PER_SEC);
}
/**