diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 796c625..1d96ab5 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -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") @@ -115,6 +116,6 @@ public class RobotContainer { private void configureBindings() {} public Command getAutonomousCommand(){ - return autoChooser.getSelected(); + return new SequentialCommandGroup(lancer.withTimeout(2),avancerAuto.withTimeout(3)); } } diff --git a/src/main/java/frc/robot/command/AvancerAuto.java b/src/main/java/frc/robot/command/AvancerAuto.java new file mode 100644 index 0000000..63bd322 --- /dev/null +++ b/src/main/java/frc/robot/command/AvancerAuto.java @@ -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; + } +}