diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 5fcb0a5..3719816 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -14,6 +14,11 @@ import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import edu.wpi.first.wpilibj2.command.button.JoystickButton; +import frc.robot.commands.Avancer; +import frc.robot.commands.Force1; +import frc.robot.commands.Force6; +import frc.robot.commands.Force7; +import frc.robot.commands.Reculer; import frc.robot.subsystems.Accumulateur; import frc.robot.subsystems.Drive; import frc.robot.subsystems.Lanceur; @@ -21,6 +26,9 @@ import frc.robot.subsystems.Lanceur; public class RobotContainer { Lanceur lanceur = new Lanceur(); Accumulateur accumulateur = new Accumulateur(); + Force7 Force7 = new Force7(lanceur, null, accumulateur); + + Force1 Force1 = new Force1(lanceur, accumulateur, null); ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard"); ShuffleboardLayout forces = Shuffleboard.getTab("Dashboard") .getLayout("limitswitchsgratte", BuiltInLayouts.kList) @@ -54,6 +62,7 @@ public class RobotContainer { } public Command getAutonomousCommand() { - return new SequentialCommandGroup(null); + return new SequentialCommandGroup(new Avancer(drive), new Force7(lanceur, force7, accumulateur) + , new Force1(lanceur, accumulateur, force1), new Reculer(drive)); } } diff --git a/src/main/java/frc/robot/commands/Avancer.java b/src/main/java/frc/robot/commands/Avancer.java index 3ad931a..9cebc32 100644 --- a/src/main/java/frc/robot/commands/Avancer.java +++ b/src/main/java/frc/robot/commands/Avancer.java @@ -11,6 +11,8 @@ public class Avancer extends CommandBase { private Drive drive; /** Creates a new Avancer. */ public Avancer(Drive drive) { + this.drive = drive; + addRequirements(drive); // Use addRequirements() here to declare subsystem dependencies. } diff --git a/src/main/java/frc/robot/commands/Reculer.java b/src/main/java/frc/robot/commands/Reculer.java new file mode 100644 index 0000000..4c474b8 --- /dev/null +++ b/src/main/java/frc/robot/commands/Reculer.java @@ -0,0 +1,38 @@ +// 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.commands; + +import edu.wpi.first.wpilibj2.command.CommandBase; +import frc.robot.subsystems.Drive; + +public class Reculer extends CommandBase { + private Drive drive; + /** Creates a new Reculer. */ + public Reculer(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.2, 0); + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) {} + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/subsystems/Drive.java b/src/main/java/frc/robot/subsystems/Drive.java index 091680b..9d97d48 100644 --- a/src/main/java/frc/robot/subsystems/Drive.java +++ b/src/main/java/frc/robot/subsystems/Drive.java @@ -30,8 +30,9 @@ public class Drive extends SubsystemBase { e.printStackTrace(); } } - public void reset(){ - } + /* public double distance(){ + return + }*/ @Override public void periodic() { // This method will be called once per scheduler run