From 50d481c2b6252ae156f75df5a42a815e5c57ba38 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Mon, 20 Feb 2023 20:00:18 -0500 Subject: [PATCH 1/5] dgnxfbv n --- .../robot/commands/bras/PivotChercheBas.java | 59 +++++++++++++++++++ .../robot/commands/bras/PivotChercheHaut.java | 59 +++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 src/main/java/frc/robot/commands/bras/PivotChercheBas.java create mode 100644 src/main/java/frc/robot/commands/bras/PivotChercheHaut.java diff --git a/src/main/java/frc/robot/commands/bras/PivotChercheBas.java b/src/main/java/frc/robot/commands/bras/PivotChercheBas.java new file mode 100644 index 0000000..33cc965 --- /dev/null +++ b/src/main/java/frc/robot/commands/bras/PivotChercheBas.java @@ -0,0 +1,59 @@ +// 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.bras; + +import edu.wpi.first.wpilibj2.command.CommandBase; +import frc.robot.subsystems.bras.BrasTelescopique; +import frc.robot.subsystems.bras.Pivot; + +public class PivotChercheBas extends CommandBase { + private BrasTelescopique brasTelescopique; + private Pivot pivot; + /** Creates a new PivotChercheBas. */ + public PivotChercheBas(BrasTelescopique brasTelescopique, Pivot pivot) { + this.brasTelescopique = brasTelescopique; + this.pivot = pivot; + // Use addRequirements() here to declare subsystem dependencies. + addRequirements(brasTelescopique); + addRequirements(pivot); + } + + // 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(brasTelescopique.distance()<10){ + brasTelescopique.AvanceRecule(0.5); + } + else if(brasTelescopique.distance()>11) { + brasTelescopique.AvanceRecule(-0.5); + } + else { + brasTelescopique.AvanceRecule(0); + } + if (pivot.distance()<10){ + pivot.monteDescendre(0.5); + } + else if(pivot.distance()>11) { + pivot.monteDescendre(-0.5); + } + else{ + pivot.monteDescendre(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; + } +} \ No newline at end of file diff --git a/src/main/java/frc/robot/commands/bras/PivotChercheHaut.java b/src/main/java/frc/robot/commands/bras/PivotChercheHaut.java new file mode 100644 index 0000000..4288827 --- /dev/null +++ b/src/main/java/frc/robot/commands/bras/PivotChercheHaut.java @@ -0,0 +1,59 @@ +// 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.bras; + +import edu.wpi.first.wpilibj2.command.CommandBase; +import frc.robot.subsystems.bras.BrasTelescopique; +import frc.robot.subsystems.bras.Pivot; + +public class PivotChercheHaut extends CommandBase { + private BrasTelescopique brasTelescopique; + private Pivot pivot; + /** Creates a new PivotChercheHaut. */ + public PivotChercheHaut(BrasTelescopique brasTelescopique, Pivot pivot) { + this.brasTelescopique = brasTelescopique; + this.pivot = pivot; + // Use addRequirements() here to declare subsystem dependencies. + addRequirements(brasTelescopique); + addRequirements(pivot); + } + + // 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(brasTelescopique.distance()<10){ + brasTelescopique.AvanceRecule(0.5); + } + else if(brasTelescopique.distance()>11) { + brasTelescopique.AvanceRecule(-0.5); + } + else { + brasTelescopique.AvanceRecule(0); + } + if (pivot.distance()<10){ + pivot.monteDescendre(0.5); + } + else if(pivot.distance()>11) { + pivot.monteDescendre(-0.5); + } + else{ + pivot.monteDescendre(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; + } +} From 1861b9fe313d6a4355a4b6e9e45d1ac542192cc8 Mon Sep 17 00:00:00 2001 From: Antoine PerreaultE Date: Mon, 20 Feb 2023 20:04:03 -0500 Subject: [PATCH 2/5] dcxvfg --- src/main/java/frc/robot/RobotContainer.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index aff140e..20a459a 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -4,7 +4,6 @@ package frc.robot; - import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; @@ -23,19 +22,16 @@ import frc.robot.subsystems.Limelight; import frc.robot.commands.BrakeFerme; import frc.robot.commands.BrakeOuvre; import frc.robot.commands.Cone; -import frc.robot.commands.Cube; import frc.robot.commands.GratteBaisser; import frc.robot.commands.GratteMonte; import frc.robot.commands.Gyro; import frc.robot.commands.Reculer; -import frc.robot.commands.Tape; import frc.robot.commands.bras.FermePince; import frc.robot.commands.bras.OuvrePince; import frc.robot.commands.bras.PivotBrasRentre; import frc.robot.commands.bras.PivoteBrasBas; import frc.robot.commands.bras.PivoteBrasHaut; import frc.robot.commands.bras.PivoteBrasMilieux; -import frc.robot.commands.Apriltag; public class RobotContainer { CommandXboxController manette1 = new CommandXboxController(0); @@ -60,9 +56,6 @@ PivoteBrasBas pivoteBrasBas = new PivoteBrasBas(brasTelescopique, pivot); PivoteBrasMilieux pivoteBrasMilieux = new PivoteBrasMilieux(brasTelescopique, pivot); PivoteBrasHaut pivoteBrasHaut = new PivoteBrasHaut(brasTelescopique, pivot); Cone cone = new Cone(limelight, basePilotable, ()->-manette1.getLeftY()); -Cube cube = new Cube(limelight, basePilotable, ()->-manette1.getLeftY()); -Apriltag aprilTag = new Apriltag(limelight, basePilotable, ()->-manette1.getLeftY()); -Tape tape = new Tape(limelight, basePilotable, ()->-manette1.getLeftY()); public RobotContainer() { configureBindings(); @@ -76,9 +69,8 @@ public RobotContainer() { manette1.a().toggleOnTrue(Commands.startEnd(pince::ouvrir, pince::fermer,pince)); manette1.x().toggleOnTrue(Commands.startEnd(basePilotable::BrakeFerme,basePilotable::BrakeOuvre,basePilotable)); manette1.y().whileTrue(gyro); - manette1.b().toggleOnTrue(Commands.startEnd()); + manette1.b().toggleOnTrue(Commands.startEnd(gratte::baiser, gratte::Lever,gratte)); manette1.start().toggleOnTrue(Commands.startEnd(basePilotable::resetGyro, basePilotable::resetGyro, basePilotable)); - } public Command getAutonomousCommand() { From 02c52c24bf864d23d3976380a624ef5ff8bfa8d6 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Mon, 20 Feb 2023 20:04:43 -0500 Subject: [PATCH 3/5] tdyjhgmvj --- .../java/frc/robot/subsystems/bras/BrasTelescopique.java | 6 ------ src/main/java/frc/robot/subsystems/bras/Pivot.java | 8 +------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java b/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java index 08f983b..e015295 100644 --- a/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java +++ b/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java @@ -8,10 +8,7 @@ package frc.robot.subsystems.bras; import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkMaxLowLevel.MotorType; -<<<<<<< HEAD import edu.wpi.first.wpilibj.DigitalInput; -======= ->>>>>>> Dash import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; @@ -35,10 +32,7 @@ public class BrasTelescopique extends SubsystemBase { } @Override public void periodic() { -<<<<<<< HEAD Shuffleboard.getTab("SmartDashBoard") .add("photocell",0.1); -======= Shuffleboard.getTab("SmartDashBoard") .add("winch",0.1); ->>>>>>> Dash } } diff --git a/src/main/java/frc/robot/subsystems/bras/Pivot.java b/src/main/java/frc/robot/subsystems/bras/Pivot.java index b2494d0..421aa5c 100644 --- a/src/main/java/frc/robot/subsystems/bras/Pivot.java +++ b/src/main/java/frc/robot/subsystems/bras/Pivot.java @@ -4,10 +4,7 @@ package frc.robot.subsystems.bras; -<<<<<<< HEAD import edu.wpi.first.wpilibj.DigitalInput; -======= ->>>>>>> Dash import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; @@ -37,11 +34,8 @@ public class Pivot extends SubsystemBase { } @Override public void periodic() { -<<<<<<< HEAD Shuffleboard.getTab("SmartDashBoard") .add("limitpivot",0.1); } -======= Shuffleboard.getTab("SmartDashBoard") .add("pivot encodeur",0.1); } ->>>>>>> Dash -} + From 66862069401cf99ba5a308d42436961883ff3743 Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Mon, 20 Feb 2023 20:05:55 -0500 Subject: [PATCH 4/5] fncnv --- src/main/java/frc/robot/commands/GratteMonte.java | 3 +-- src/main/java/frc/robot/subsystems/Limelight.java | 2 +- src/main/java/frc/robot/subsystems/bras/Pivot.java | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/commands/GratteMonte.java b/src/main/java/frc/robot/commands/GratteMonte.java index b460277..3581712 100644 --- a/src/main/java/frc/robot/commands/GratteMonte.java +++ b/src/main/java/frc/robot/commands/GratteMonte.java @@ -4,8 +4,7 @@ package frc.robot.commands; -import com.ctre.phoenix.motorcontrol.LimitSwitchNormal; -import frc.robot.Constants; + import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.Gratte; diff --git a/src/main/java/frc/robot/subsystems/Limelight.java b/src/main/java/frc/robot/subsystems/Limelight.java index a17900b..1d41677 100644 --- a/src/main/java/frc/robot/subsystems/Limelight.java +++ b/src/main/java/frc/robot/subsystems/Limelight.java @@ -8,7 +8,7 @@ import edu.wpi.first.cameraserver.CameraServer; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import org.photonvision.PhotonCamera; import org.photonvision.common.hardware.VisionLEDMode; -import org.photonvision.targeting.PhotonTrackedTarget; + import edu.wpi.first.net.PortForwarder; import edu.wpi.first.wpilibj2.command.SubsystemBase; diff --git a/src/main/java/frc/robot/subsystems/bras/Pivot.java b/src/main/java/frc/robot/subsystems/bras/Pivot.java index 421aa5c..58f24d2 100644 --- a/src/main/java/frc/robot/subsystems/bras/Pivot.java +++ b/src/main/java/frc/robot/subsystems/bras/Pivot.java @@ -35,7 +35,7 @@ public class Pivot extends SubsystemBase { @Override public void periodic() { Shuffleboard.getTab("SmartDashBoard") .add("limitpivot",0.1); - } Shuffleboard.getTab("SmartDashBoard") .add("pivot encodeur",0.1); + } } From 2c79346ce98c80f71d749f5cfbe0025b5dedf77a Mon Sep 17 00:00:00 2001 From: samuel desharnais Date: Wed, 22 Feb 2023 18:29:18 -0500 Subject: [PATCH 5/5] dgbxb v --- src/main/java/frc/robot/Constants.java | 2 ++ .../frc/robot/commands/bras/PivotBrasRentre.java | 4 +++- .../frc/robot/commands/bras/PivotChercheBas.java | 2 ++ .../frc/robot/commands/bras/PivotChercheHaut.java | 2 ++ .../java/frc/robot/commands/bras/PivoteBrasBas.java | 2 ++ .../java/frc/robot/commands/bras/PivoteBrasHaut.java | 2 ++ .../frc/robot/commands/bras/PivoteBrasMilieux.java | 2 ++ .../frc/robot/subsystems/bras/BrasTelescopique.java | 12 +++++++++++- 8 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index f0fb8a8..1518cc8 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -18,6 +18,8 @@ public class Constants { public static int actuateur = 2; public static int brakedroit = 3; public static int brakegauche = 4; + public static int brakewinchf = 5; + public static int brakewinchb = 5; // DIO public static int limitbd = 0; public static int limitbg = 2; diff --git a/src/main/java/frc/robot/commands/bras/PivotBrasRentre.java b/src/main/java/frc/robot/commands/bras/PivotBrasRentre.java index 192dc88..6efbb90 100644 --- a/src/main/java/frc/robot/commands/bras/PivotBrasRentre.java +++ b/src/main/java/frc/robot/commands/bras/PivotBrasRentre.java @@ -29,6 +29,7 @@ public class PivotBrasRentre extends CommandBase { public void execute() { if(brasTelescopique.distance()>1){ brasTelescopique.AvanceRecule(0.5); + brasTelescopique.fermer(); } if (pivot.distance()>1){ pivot.monteDescendre(0.5); @@ -36,9 +37,10 @@ public class PivotBrasRentre extends CommandBase { else if(brasTelescopique.photocell()){ brasTelescopique.Reset(); brasTelescopique.AvanceRecule(0); + brasTelescopique.ouvrir(); } else{ - brasTelescopique.AvanceRecule(.5); + brasTelescopique.AvanceRecule(0.5); } if(pivot.limitpivot()){ pivot.Reset(); diff --git a/src/main/java/frc/robot/commands/bras/PivotChercheBas.java b/src/main/java/frc/robot/commands/bras/PivotChercheBas.java index 33cc965..76367e4 100644 --- a/src/main/java/frc/robot/commands/bras/PivotChercheBas.java +++ b/src/main/java/frc/robot/commands/bras/PivotChercheBas.java @@ -29,12 +29,14 @@ public class PivotChercheBas extends CommandBase { public void execute() { if(brasTelescopique.distance()<10){ brasTelescopique.AvanceRecule(0.5); + brasTelescopique.fermer(); } else if(brasTelescopique.distance()>11) { brasTelescopique.AvanceRecule(-0.5); } else { brasTelescopique.AvanceRecule(0); + brasTelescopique.ouvrir(); } if (pivot.distance()<10){ pivot.monteDescendre(0.5); diff --git a/src/main/java/frc/robot/commands/bras/PivotChercheHaut.java b/src/main/java/frc/robot/commands/bras/PivotChercheHaut.java index 4288827..1bdd45a 100644 --- a/src/main/java/frc/robot/commands/bras/PivotChercheHaut.java +++ b/src/main/java/frc/robot/commands/bras/PivotChercheHaut.java @@ -29,12 +29,14 @@ public class PivotChercheHaut extends CommandBase { public void execute() { if(brasTelescopique.distance()<10){ brasTelescopique.AvanceRecule(0.5); + brasTelescopique.fermer(); } else if(brasTelescopique.distance()>11) { brasTelescopique.AvanceRecule(-0.5); } else { brasTelescopique.AvanceRecule(0); + brasTelescopique.ouvrir(); } if (pivot.distance()<10){ pivot.monteDescendre(0.5); diff --git a/src/main/java/frc/robot/commands/bras/PivoteBrasBas.java b/src/main/java/frc/robot/commands/bras/PivoteBrasBas.java index 038ec51..226454e 100644 --- a/src/main/java/frc/robot/commands/bras/PivoteBrasBas.java +++ b/src/main/java/frc/robot/commands/bras/PivoteBrasBas.java @@ -31,12 +31,14 @@ public class PivoteBrasBas extends CommandBase { public void execute() { if(brasTelescopique.distance()<10){ brasTelescopique.AvanceRecule(0.5); + brasTelescopique.fermer(); } else if(brasTelescopique.distance()>11) { brasTelescopique.AvanceRecule(-0.5); } else { brasTelescopique.AvanceRecule(0); + brasTelescopique.ouvrir(); } if (pivot.distance()<10){ pivot.monteDescendre(0.5); diff --git a/src/main/java/frc/robot/commands/bras/PivoteBrasHaut.java b/src/main/java/frc/robot/commands/bras/PivoteBrasHaut.java index 2ba3c74..1968013 100644 --- a/src/main/java/frc/robot/commands/bras/PivoteBrasHaut.java +++ b/src/main/java/frc/robot/commands/bras/PivoteBrasHaut.java @@ -29,12 +29,14 @@ public class PivoteBrasHaut extends CommandBase { public void execute() { if(brasTelescopique.distance()<10){ brasTelescopique.AvanceRecule(0.5); + brasTelescopique.fermer(); } else if(brasTelescopique.distance()>11) { brasTelescopique.AvanceRecule(-0.5); } else { brasTelescopique.AvanceRecule(0); + brasTelescopique.ouvrir(); } if (pivot.distance()<10){ pivot.monteDescendre(0.5); diff --git a/src/main/java/frc/robot/commands/bras/PivoteBrasMilieux.java b/src/main/java/frc/robot/commands/bras/PivoteBrasMilieux.java index da8939b..c230cfc 100644 --- a/src/main/java/frc/robot/commands/bras/PivoteBrasMilieux.java +++ b/src/main/java/frc/robot/commands/bras/PivoteBrasMilieux.java @@ -29,12 +29,14 @@ public class PivoteBrasMilieux extends CommandBase { public void execute() { if(brasTelescopique.distance()<10){ brasTelescopique.AvanceRecule(0.5); + brasTelescopique.fermer(); } else if(brasTelescopique.distance()>11) { brasTelescopique.AvanceRecule(-0.5); } else { brasTelescopique.AvanceRecule(0); + brasTelescopique.ouvrir(); } if (pivot.distance()<10){ pivot.monteDescendre(0.5); diff --git a/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java b/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java index e015295..98bc79c 100644 --- a/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java +++ b/src/main/java/frc/robot/subsystems/bras/BrasTelescopique.java @@ -9,6 +9,9 @@ import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkMaxLowLevel.MotorType; import edu.wpi.first.wpilibj.DigitalInput; +import edu.wpi.first.wpilibj.DoubleSolenoid; +import edu.wpi.first.wpilibj.PneumaticsModuleType; +import edu.wpi.first.wpilibj.DoubleSolenoid.Value; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; @@ -18,6 +21,7 @@ public class BrasTelescopique extends SubsystemBase { public BrasTelescopique() {} final CANSparkMax Winch = new CANSparkMax(Constants.BrasTelescopique,MotorType.kBrushless); private DigitalInput photocell = new DigitalInput(Constants.photocell); + private DoubleSolenoid brakewinch = new DoubleSolenoid(PneumaticsModuleType.CTREPCM,Constants.brakewinchf, Constants.brakewinchb); public void AvanceRecule(double vitesse) { Winch.set(vitesse); } @@ -28,8 +32,14 @@ public class BrasTelescopique extends SubsystemBase { Winch.getEncoder().setPosition(0); } public boolean photocell(){ - return photocell.get(); + return photocell.get(); } + public void fermer() { + brakewinch.set(Value.kReverse); + } + public void ouvrir() { + brakewinch.set(Value.kForward); + } @Override public void periodic() { Shuffleboard.getTab("SmartDashBoard") .add("photocell",0.1);