This commit is contained in:
samuel desharnais 2024-04-24 17:38:05 -04:00
parent e24e36486b
commit bb4bee0d96
2 changed files with 44 additions and 3 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.Command;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
// Manettes // Manettes
import edu.wpi.first.wpilibj2.command.button.CommandJoystick; import edu.wpi.first.wpilibj2.command.button.CommandJoystick;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import frc.robot.command.AvancerAuto;
// Commands // Commands
import frc.robot.command.Balayer; import frc.robot.command.Balayer;
import frc.robot.command.GrimpeurDroit; import frc.robot.command.GrimpeurDroit;
@ -68,7 +69,7 @@ public class RobotContainer {
GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, manette::getLeftY); GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, manette::getLeftY);
GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getRightY); GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getRightY);
Debalayer debalayer = new Debalayer(balayeuse, accumulateur); Debalayer debalayer = new Debalayer(balayeuse, accumulateur);
AvancerAuto avancerAuto = new AvancerAuto(drive);
public RobotContainer() { public RobotContainer() {
dashboard.addCamera("limelight", "limelight","limelight.local:5800") dashboard.addCamera("limelight", "limelight","limelight.local:5800")
@ -115,6 +116,6 @@ public class RobotContainer {
private void configureBindings() {} private void configureBindings() {}
public Command getAutonomousCommand(){ public Command getAutonomousCommand(){
return autoChooser.getSelected(); return new SequentialCommandGroup(lancer.withTimeout(2),avancerAuto.withTimeout(3));
} }
} }

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;
}
}