mode auto

This commit is contained in:
Antoine PerreaultE
2025-03-04 10:06:12 -05:00
parent b1124bd3f0
commit a420d3ff2f
2 changed files with 15 additions and 13 deletions

View File

@ -6,6 +6,7 @@ package frc.robot.commands;
import static edu.wpi.first.units.Units.*;
import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType;
import com.ctre.phoenix6.swerve.SwerveRequest;
import edu.wpi.first.wpilibj2.command.Command;
@ -16,7 +17,8 @@ public class AvancerAuto extends Command {
private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond); // kSpeedAt12Volts desired top speed
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of
private final SwerveRequest.RobotCentric drive = new SwerveRequest.RobotCentric()
.withDeadband(MaxSpeed * 0.1).withRotationalDeadband(MaxAngularRate * 0.1);
.withDeadband(MaxSpeed * 0.1).withRotationalDeadband(MaxAngularRate * 0.1)
.withDriveRequestType(DriveRequestType.OpenLoopVoltage);
/** Creates a new AvancerAuto. */
public AvancerAuto(SwerveRequest.RobotCentric drive) {
// Use addRequirements() here to declare subsystem dependencies.
@ -29,7 +31,7 @@ public class AvancerAuto extends Command {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
drive.withVelocityX(0.2);
drive.withVelocityX(0.2*MaxSpeed);
}
// Called once the command ends or is interrupted.