mode auto
This commit is contained in:
parent
b1124bd3f0
commit
a420d3ff2f
@ -85,7 +85,7 @@ public class RobotContainer {
|
|||||||
private final CommandXboxController manette2 = new CommandXboxController(1);
|
private final CommandXboxController manette2 = new CommandXboxController(1);
|
||||||
private final Pigeon2 gyro = new Pigeon2(13); // ID du Pigeon 2
|
private final Pigeon2 gyro = new Pigeon2(13); // ID du Pigeon 2
|
||||||
public final CommandSwerveDrivetrain drivetrain = TunerConstants.createDrivetrain();
|
public final CommandSwerveDrivetrain drivetrain = TunerConstants.createDrivetrain();
|
||||||
private final SendableChooser<Command> autoChooser;
|
//private final SendableChooser<Command> autoChooser;
|
||||||
public double getAngle() {
|
public double getAngle() {
|
||||||
return gyro.getYaw().getValueAsDouble(); // Retourne l'angle actuel du robot
|
return gyro.getYaw().getValueAsDouble(); // Retourne l'angle actuel du robot
|
||||||
}
|
}
|
||||||
@ -104,16 +104,16 @@ public class RobotContainer {
|
|||||||
public RobotContainer() {
|
public RobotContainer() {
|
||||||
CameraServer.startAutomaticCapture();
|
CameraServer.startAutomaticCapture();
|
||||||
configureBindings();
|
configureBindings();
|
||||||
NamedCommands.registerCommand("AprilTag", new AprilTag3G(limelight3g, drivetrain, null, null));
|
// NamedCommands.registerCommand("AprilTag", new AprilTag3G(limelight3g, drivetrain, null, null));
|
||||||
NamedCommands.registerCommand("Station",new StationPince(pince, elevateur,bougie));
|
// NamedCommands.registerCommand("Station",new StationPince(pince, elevateur,bougie));
|
||||||
NamedCommands.registerCommand("L4", new L4(elevateur, pince));
|
// NamedCommands.registerCommand("L4", new L4(elevateur, pince));
|
||||||
NamedCommands.registerCommand("L3", new L3(elevateur, pince));
|
// NamedCommands.registerCommand("L3", new L3(elevateur, pince));
|
||||||
NamedCommands.registerCommand("CoralExpire",new CoralExpire(pince,bougie));
|
// NamedCommands.registerCommand("CoralExpire",new CoralExpire(pince,bougie));
|
||||||
NamedCommands.registerCommand("CoraletAlgue", new CoralAlgueInspire(pince,bougie));
|
// NamedCommands.registerCommand("CoraletAlgue", new CoralAlgueInspire(pince,bougie));
|
||||||
NamedCommands.registerCommand("baleeuse",new L1Requin(requin, bougie));
|
// NamedCommands.registerCommand("baleeuse",new L1Requin(requin, bougie));
|
||||||
NamedCommands.registerCommand("baleeuse sort", new ExpireCorail(requin, bougie));
|
// NamedCommands.registerCommand("baleeuse sort", new ExpireCorail(requin, bougie));
|
||||||
autoChooser = AutoBuilder.buildAutoChooser("New Auto");
|
//autoChooser = AutoBuilder.buildAutoChooser("New Auto");
|
||||||
SmartDashboard.putData("Auto Mode", autoChooser);
|
//SmartDashboard.putData("Auto Mode", autoChooser);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configureBindings() {
|
private void configureBindings() {
|
||||||
|
@ -6,6 +6,7 @@ package frc.robot.commands;
|
|||||||
|
|
||||||
import static edu.wpi.first.units.Units.*;
|
import static edu.wpi.first.units.Units.*;
|
||||||
|
|
||||||
|
import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType;
|
||||||
import com.ctre.phoenix6.swerve.SwerveRequest;
|
import com.ctre.phoenix6.swerve.SwerveRequest;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
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 MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond); // kSpeedAt12Volts desired top speed
|
||||||
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of
|
private double MaxAngularRate = RotationsPerSecond.of(0.75).in(RadiansPerSecond); // 3/4 of
|
||||||
private final SwerveRequest.RobotCentric drive = new SwerveRequest.RobotCentric()
|
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. */
|
/** Creates a new AvancerAuto. */
|
||||||
public AvancerAuto(SwerveRequest.RobotCentric drive) {
|
public AvancerAuto(SwerveRequest.RobotCentric drive) {
|
||||||
// Use addRequirements() here to declare subsystem dependencies.
|
// 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.
|
// Called every time the scheduler runs while the command is scheduled.
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
drive.withVelocityX(0.2);
|
drive.withVelocityX(0.2*MaxSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once the command ends or is interrupted.
|
// Called once the command ends or is interrupted.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user