diff --git a/src/main/deploy/pathplanner/paths/3.1.path b/src/main/deploy/pathplanner/paths/3.1.path index e11f7a1..bb40a31 100644 --- a/src/main/deploy/pathplanner/paths/3.1.path +++ b/src/main/deploy/pathplanner/paths/3.1.path @@ -16,12 +16,12 @@ }, { "anchor": { - "x": 2.7, - "y": 7.0 + "x": 2.7155331803541096, + "y": 6.958021893251764 }, "prevControl": { - "x": 2.6949379619996434, - "y": 7.0 + "x": 2.727570849247609, + "y": 6.978871747379996 }, "nextControl": null, "isLocked": false, @@ -39,7 +39,7 @@ }, "goalEndState": { "velocity": 0, - "rotation": -88.31533329176997, + "rotation": 56.65929265352304, "rotateFast": false }, "reversed": false, diff --git a/src/main/deploy/pathplanner/paths/5.1.path b/src/main/deploy/pathplanner/paths/5.1.path index 1e1753c..b1d8eb7 100644 --- a/src/main/deploy/pathplanner/paths/5.1.path +++ b/src/main/deploy/pathplanner/paths/5.1.path @@ -20,8 +20,8 @@ "y": 4.1 }, "prevControl": { - "x": 13.990250241783144, - "y": 4.090250241783143 + "x": 14.011940966373402, + "y": 4.093105879849931 }, "nextControl": null, "isLocked": false, @@ -39,7 +39,7 @@ }, "goalEndState": { "velocity": 0, - "rotation": -88.30255667497883, + "rotation": -155.07456608690077, "rotateFast": false }, "reversed": false, diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 66da0bf..4e05ed8 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -28,6 +28,7 @@ import frc.robot.command.GuiderHaut; import frc.robot.command.Lancer; import frc.robot.command.LancerAmp; import frc.robot.command.LancerNote; +import frc.robot.command.LancerTrape; import frc.robot.command.Lancerampli; import frc.robot.command.Limelight_tracker; import frc.robot.command.PistonFerme; @@ -93,7 +94,7 @@ public class RobotContainer { joystick.button(5).whileTrue(new LancerAmp(lanceur, accumulateur)); joystick.button(4).whileTrue(new ParallelCommandGroup(new Lancer(lanceur,limelight),new Limelight_tracker(limelight,drive))); joystick.button(2).whileTrue(new ParallelCommandGroup(new Lancerampli(lanceur,limelight),new Limelight_tracker(limelight,drive))); - + joystick.button(6).whileTrue(new LancerTrape(lanceur, accumulateur)); // deplacement configureBindings(); drive.setDefaultCommand(new RunCommand(()->{ diff --git a/src/main/java/frc/robot/command/LancerTrape.java b/src/main/java/frc/robot/command/LancerTrape.java new file mode 100644 index 0000000..3a7a0c5 --- /dev/null +++ b/src/main/java/frc/robot/command/LancerTrape.java @@ -0,0 +1,53 @@ +// 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.Accumulateur; +import frc.robot.subsystem.Lanceur; + +public class LancerTrape extends Command { + private Lanceur lancer; + private Accumulateur accumulateur; + /** Creates a new LancerNote. */ + public LancerTrape(Lanceur lancer, Accumulateur accumulateur) { + this.lancer = lancer; + this.accumulateur = accumulateur; + addRequirements(lancer); + // Use addRequirements() here to declare subsystem dependencies. + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + lancer.pid(); + } + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + double vitesse = 0.8; + lancer.Lancertrape(); + if(lancer.vitesse(vitesse)>vitesse){ + accumulateur.Accumuler(); + } + else{ + accumulateur.Accumuler(0); + } + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) { + lancer.lancer(0); + accumulateur.Accumuler(0); + } + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/subsystem/Lanceur.java b/src/main/java/frc/robot/subsystem/Lanceur.java index 830a3cc..c377812 100644 --- a/src/main/java/frc/robot/subsystem/Lanceur.java +++ b/src/main/java/frc/robot/subsystem/Lanceur.java @@ -86,6 +86,9 @@ public class Lanceur extends SubsystemBase { } public void lancerspeaker(){ lancer(vitesse.getDouble(0.8)); + } + public void Lancertrape(){ + lancer(vitesse.getDouble(0.8)); } public void lanceramp(){ lancer(vitesseamp.getDouble(0.1));