This commit is contained in:
Antoine PerreaultE 2024-04-24 18:33:19 -04:00
commit cbb95f40bd
3 changed files with 45 additions and 6 deletions

View File

@ -14,10 +14,11 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
// Manettes
import edu.wpi.first.wpilibj2.command.button.CommandJoystick;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import frc.robot.command.AvancerAuto;
// Commands
import frc.robot.command.Balayer;
import frc.robot.command.GrimpeurDroit;
@ -68,7 +69,7 @@ public class RobotContainer {
GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, manette::getLeftY);
GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getRightY);
Debalayer debalayer = new Debalayer(balayeuse, accumulateur);
AvancerAuto avancerAuto = new AvancerAuto(drive);
public RobotContainer() {
dashboard.addCamera("limelight", "limelight","limelight.local:5800")
@ -89,7 +90,7 @@ public class RobotContainer {
manette.start().whileTrue(new RestGyro(drive));
manette.a().whileTrue(new GuiderBas(guideur));
manette.b().whileTrue(new GuiderHaut(guideur));
manette.x().whileTrue(avancerAuto);
//joystick
joystick.button(3).whileTrue(new Balayer(balayeuse, accumulateur));
manette1.rightBumper().whileTrue(new LancerNote(lanceur, accumulateur));
@ -115,6 +116,6 @@ public class RobotContainer {
private void configureBindings() {}
public Command getAutonomousCommand(){
return autoChooser.getSelected();
return autoChooser.getSelected(); //new SequentialCommandGroup(lancer.withTimeout(2));
}
}

View File

@ -0,0 +1,40 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot.command;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystem.Drive;
public class AvancerAuto extends Command {
private Drive drive;
/** Creates a new AvancerAuto. */
public AvancerAuto(Drive drive) {
this.drive = drive;
addRequirements(drive);
// Use addRequirements() here to declare subsystem dependencies.
}
// Called when the command is initially scheduled.
@Override
public void initialize() {}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
drive.drive(0.5, 0, 0);
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
drive.drive(0, 0, 0);
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View File

@ -58,9 +58,7 @@ public class Drive extends SubsystemBase {
public SwerveModulePosition[] distance(){
return swerveDrive.getModulePositions();
}
public void reset(){
}
@Override
public void periodic() {