attempted fix for swerve jitter

This commit is contained in:
Tyler-J42 2024-03-27 10:39:04 -04:00
parent 16909c356f
commit 15a6253e85
3 changed files with 10 additions and 6 deletions

View File

@ -226,9 +226,9 @@ public class RobotContainer {
drivetrain.setDefaultCommand( drivetrain.setDefaultCommand(
drivetrain.teleopCommand( drivetrain.teleopCommand(
() -> { return driver.getLeftY() /* * (invertXYDrive ? -1 : 1)*/; }, () -> { return driver.getLeftY() * (invertXYDrive ? -1 : 1); },
() -> { return driver.getLeftX() /* * (invertXYDrive ? -1 : 1)*/; }, () -> { return driver.getLeftX() * (invertXYDrive ? -1 : 1); },
() -> { return -driver.getRightX(); }, () -> { return -driver.getRightX() * (invertXYDrive ? -1 : 1); },
OIConstants.kTeleopDriveDeadband OIConstants.kTeleopDriveDeadband
) )
); );
@ -409,7 +409,7 @@ public class RobotContainer {
//operator.a().whileTrue(shooter.angleSpeedsSetpoints(ShooterConstants.kShooterAmpAngle, 0, 0)); //operator.a().whileTrue(shooter.angleSpeedsSetpoints(ShooterConstants.kShooterAmpAngle, 0, 0));
operator.y().whileTrue(Commands.parallel(climber.setSpeedWithSupplier(operator::getRightTriggerAxis), shooter.climbState())); operator.y().whileTrue(Commands.parallel(climber.setSpeedWithSupplier(operator::getRightTriggerAxis), shooter.climbState(), intake.climbingStateCommand()));
driver.a().whileTrue(indexer.shootNote(() -> 1.0)); driver.a().whileTrue(indexer.shootNote(() -> 1.0));

View File

@ -8,8 +8,8 @@ import edu.wpi.first.math.trajectory.TrapezoidProfile;
import edu.wpi.first.math.util.Units; import edu.wpi.first.math.util.Units;
public final class AutoConstants { public final class AutoConstants {
public static final double kMaxSpeedMetersPerSecond = 3.895; // max capable = 4.6 public static final double kMaxSpeedMetersPerSecond = 4; // max capable = 4.6
public static final double kMaxAccelerationMetersPerSecondSquared = 3; // max capable = 7.4 public static final double kMaxAccelerationMetersPerSecondSquared = 4; // max capable = 7.4
public static final double kMaxAngularSpeedRadiansPerSecond = Math.PI; public static final double kMaxAngularSpeedRadiansPerSecond = Math.PI;
public static final double kMaxAngularSpeedRadiansPerSecondSquared = Math.PI; public static final double kMaxAngularSpeedRadiansPerSecondSquared = Math.PI;

View File

@ -6,6 +6,7 @@ import edu.wpi.first.math.kinematics.SwerveModuleState;
import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkLowLevel.MotorType; import com.revrobotics.CANSparkLowLevel.MotorType;
import com.revrobotics.CANSparkLowLevel.PeriodicFrame;
import com.revrobotics.SparkAbsoluteEncoder.Type; import com.revrobotics.SparkAbsoluteEncoder.Type;
import com.revrobotics.SparkPIDController; import com.revrobotics.SparkPIDController;
import com.revrobotics.AbsoluteEncoder; import com.revrobotics.AbsoluteEncoder;
@ -36,6 +37,9 @@ public class MAXSwerveModule {
m_drivingSparkMax = new CANSparkMax(drivingCANId, MotorType.kBrushless); m_drivingSparkMax = new CANSparkMax(drivingCANId, MotorType.kBrushless);
m_turningSparkMax = new CANSparkMax(turningCANId, MotorType.kBrushless); m_turningSparkMax = new CANSparkMax(turningCANId, MotorType.kBrushless);
m_turningSparkMax.setPeriodicFramePeriod(PeriodicFrame.kStatus5, 20);
m_turningSparkMax.setPeriodicFramePeriod(PeriodicFrame.kStatus6, 20);
// Factory reset, so we get the SPARKS MAX to a known state before configuring // Factory reset, so we get the SPARKS MAX to a known state before configuring
// them. This is useful in case a SPARK MAX is swapped out. // them. This is useful in case a SPARK MAX is swapped out.
m_drivingSparkMax.restoreFactoryDefaults(); m_drivingSparkMax.restoreFactoryDefaults();