From 1367087b1402f16bbbd9df487bef40df6e400a27 Mon Sep 17 00:00:00 2001 From: Antoine <2443335@carrefour.cegepvicto.ca> Date: Mon, 4 Nov 2024 18:53:43 -0500 Subject: [PATCH] commande limelight 3 forme + couleur manque pipline --- .../frc/robot/Commands/FollowAprilTag.java | 2 +- .../robot/Commands/Tracker_Couleur_Forme.java | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/main/java/frc/robot/Commands/Tracker_Couleur_Forme.java diff --git a/src/main/java/frc/robot/Commands/FollowAprilTag.java b/src/main/java/frc/robot/Commands/FollowAprilTag.java index a44d9ec..0f4a1ef 100644 --- a/src/main/java/frc/robot/Commands/FollowAprilTag.java +++ b/src/main/java/frc/robot/Commands/FollowAprilTag.java @@ -27,7 +27,7 @@ public class FollowAprilTag extends Command { @Override public void execute() { - if (enlignement.getv()==1) + if (enlignement.getv()==1) { lanceur.tourelRotation(0,0, enlignement.getx()/30); } diff --git a/src/main/java/frc/robot/Commands/Tracker_Couleur_Forme.java b/src/main/java/frc/robot/Commands/Tracker_Couleur_Forme.java new file mode 100644 index 0000000..36b4da1 --- /dev/null +++ b/src/main/java/frc/robot/Commands/Tracker_Couleur_Forme.java @@ -0,0 +1,47 @@ +// 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.Command; +import frc.robot.Subsystems.Limelight3G; + + +public class Tracker_Couleur_Forme extends Command { + /** Creates a new Tracker_Couleur_Forme. */ + private Limelight3G pipeline; + public Tracker_Couleur_Forme(Limelight3G tracker_couleur, Limelight3G tracker_forme) { + // Use addRequirements() here to declare subsystem dependencies. + this.pipeline = pipeline; + this.tracker_couleur = tracker_couleur; + this.tracker_forme = tracker_forme; + } + + // 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() { + if (pipeline == 1) { + Limelight3G.tracker_couleur; + } + else if (pipeline == 2){ + Limelight3G.tracker_forme; + } + + + } + + // 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; + } +}