This commit is contained in:
Antoine PerreaultE 2023-12-04 19:00:09 -05:00
commit 5c6703dc3d
2 changed files with 61 additions and 12 deletions

View File

@ -16,6 +16,13 @@ import edu.wpi.first.wpilibj2.command.button.CommandJoystick;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import frc.robot.commands.Avancer;
import frc.robot.commands.Lancer;
import frc.robot.commands.LancerTest;
import frc.robot.commands.Force2;
import frc.robot.commands.Force3;
import frc.robot.commands.Force4;
import frc.robot.commands.Force5;
import frc.robot.commands.Force6;
import frc.robot.commands.Force7;
import frc.robot.commands.Reculer;
import frc.robot.commands.accumulateurtest;
import frc.robot.subsystems.Accumulateur;
@ -33,12 +40,12 @@ public class RobotContainer {
.getLayout("forces", BuiltInLayouts.kList)
.withSize(3, 7);
GenericEntry force1 = forces.add("Force1", 2).getEntry();
GenericEntry force2 = forces.add("Force2", 0).getEntry();
GenericEntry force3 = forces.add("Force3", 0).getEntry();
GenericEntry force4 = forces.add("Force4", 0).getEntry();
GenericEntry force5 = forces.add("Force5", 0).getEntry();
GenericEntry force6 = forces.add("Force6", 0).getEntry();
GenericEntry force7 = forces.add("Force7", 0).getEntry();
GenericEntry force2 = forces.add("Force2", 4).getEntry();
GenericEntry force3 = forces.add("Force3", 6).getEntry();
GenericEntry force4 = forces.add("Force4", 8).getEntry();
GenericEntry force5 = forces.add("Force5", 10).getEntry();
GenericEntry force6 = forces.add("Force6", 12).getEntry();
GenericEntry force7 = forces.add("Force7", 14).getEntry();
CommandXboxController manette = new CommandXboxController(0);
CommandJoystick joystick1 = new CommandJoystick(0);
@ -53,15 +60,17 @@ public class RobotContainer {
private void configureBindings() {
accumulateurtest accumulateurtest = new accumulateurtest(accumulateur);
joystick1.button(7).onTrue(new Lancer(lanceur, accumulateur, force1));
joystick1.button(8).onTrue(new Lancer(lanceur, accumulateur, force2));
accumulateurtest accumulateurtest = new accumulateurtest(accumulateur);
LancerTest lancertest = new LancerTest(lanceur);
// joystick1.button(7).onTrue(new Lancer(lanceur, accumulateur, force1));
/* joystick1.button(8).onTrue(new Lancer(lanceur, accumulateur, force2));
joystick1.button(9).onTrue(new Lancer(lanceur, accumulateur, force3));
joystick1.button(10).onTrue(new Lancer(lanceur, accumulateur, force4));
joystick1.button(11).onTrue(new Lancer(lanceur, accumulateur, force5));
joystick1.button(12).onTrue(new Lancer(lanceur, accumulateur, force6));
joystick1.button(3).onTrue(new Lancer(lanceur, accumulateur, force7));
joystick1.button(5).toggleOnTrue(accumulateurtest);
joystick1.button(12).onTrue(new Lancer(lanceur, accumulateur, force6));*/
// joystick1.button(3).onTrue(new Lancer(lanceur, accumulateur, force7));
joystick1.button(5).whileTrue(accumulateurtest);
joystick1.button(1).whileTrue(lancertest);
}

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.commands;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.subsystems.Lanceur;
public class LancerTest extends CommandBase {
private Lanceur lanceur;
/** Creates a new LancerTest. */
public LancerTest(Lanceur lanceur) {
this.lanceur = lanceur;
addRequirements(lanceur);
// 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() {
lanceur.lancer(0.5);
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
lanceur.lancer(0);
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}