From fd72aaf8bddaa892e7e5c915cbb7dd2e2c26a225 Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Wed, 30 Oct 2024 19:14:06 -0400 Subject: [PATCH] Dashboard limelights et accumulateur --- src/main/java/frc/robot/RobotContainer.java | 9 +++++++ .../frc/robot/Subsystems/Accumulateur.java | 26 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index de2c9d0..8563d06 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -4,11 +4,20 @@ package frc.robot; +import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; public class RobotContainer { + ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); public RobotContainer() { + dashboard.addCamera("limelight3G", "limelight3G","limelight.local:5800") + .withSize(3,4) + .withPosition(0,0); + dashboard.addCamera("limelight3", "limelight3","limelight.local:5800") + .withSize(3,4) + .withPosition(3,0); configureBindings(); } diff --git a/src/main/java/frc/robot/Subsystems/Accumulateur.java b/src/main/java/frc/robot/Subsystems/Accumulateur.java index 4de7f10..adb2996 100644 --- a/src/main/java/frc/robot/Subsystems/Accumulateur.java +++ b/src/main/java/frc/robot/Subsystems/Accumulateur.java @@ -5,6 +5,10 @@ package frc.robot.Subsystems; +import edu.wpi.first.networktables.GenericEntry; +import edu.wpi.first.wpilibj.DigitalInput; +import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj2.command.SubsystemBase; @@ -12,15 +16,35 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; public class Accumulateur extends SubsystemBase { /** Creates a new Accumulateur. */ - public Accumulateur() {} + public Accumulateur() {dashboard.addBoolean("photocellacc", this::limitswitch) + .withSize(1, 1) + .withPosition(0, 1); + + } + ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); + + private GenericEntry vitesse = + dashboard.add("vitesseacc", 0.1) + .withSize(1, 1) + .withPosition(0, 4) + .getEntry(); + final WPI_TalonSRX accumulateur1 = new WPI_TalonSRX(0); final WPI_TalonSRX accumulateur2 = new WPI_TalonSRX(10); + final DigitalInput photocell = new DigitalInput(94); public void encodeur(){ } + public boolean limitswitch(){ + return !photocell.get(); + } public void desaccumule(double vitesse){ accumulateur1.set(vitesse); accumulateur2.set(-vitesse); } + public void desaccumule(){ + desaccumule(vitesse.getDouble(0.9)); + } + @Override public void periodic() { // This method will be called once per scheduler run