dashboard

This commit is contained in:
Olivier Dubois 2024-02-08 18:59:08 -05:00
parent d87e306b81
commit 4dd6964cd1
5 changed files with 31 additions and 19 deletions

View File

@ -10,6 +10,8 @@ import com.pathplanner.lib.commands.PathPlannerAuto;
import edu.wpi.first.cameraserver.CameraServer; import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.math.MathUtil; import edu.wpi.first.math.MathUtil;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
@ -45,6 +47,7 @@ import frc.robot.subsystem.Pixy;
public class RobotContainer { public class RobotContainer {
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
private final SendableChooser<Command> autoChooser; private final SendableChooser<Command> autoChooser;
Drive drive = new Drive(); Drive drive = new Drive();
Accumulateur accumulateur = new Accumulateur(); Accumulateur accumulateur = new Accumulateur();
@ -70,6 +73,7 @@ public class RobotContainer {
AllumeLED allumeLED = new AllumeLED(LED); AllumeLED allumeLED = new AllumeLED(LED);
Pistongrimpeur pistongrimpeur = new Pistongrimpeur(grimpeur, LED); Pistongrimpeur pistongrimpeur = new Pistongrimpeur(grimpeur, LED);
public RobotContainer() { public RobotContainer() {
dashboard.addCamera("limelight", "limelight","limelight.local:5800");
NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur)); NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur));
NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur)); NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur));
autoChooser = AutoBuilder.buildAutoChooser(); autoChooser = AutoBuilder.buildAutoChooser();
@ -98,6 +102,7 @@ public class RobotContainer {
} }
public Command getAutonomousCommand(){ public Command getAutonomousCommand(){
return autoChooser.getSelected(); return autoChooser.getSelected()
;
} }
} }

View File

@ -21,7 +21,9 @@ public class Accumulateur extends SubsystemBase {
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
private GenericEntry vitesse = private GenericEntry vitesse =
dashboard.add("vitesseacc", 1) dashboard.add("vitesseacc", 1)
.getEntry(); .withSize(1, 1)
.withPosition(4, 3)
.getEntry();
final WPI_TalonSRX Moteuracc2 = new WPI_TalonSRX(Constants.Moteuracc2); final WPI_TalonSRX Moteuracc2 = new WPI_TalonSRX(Constants.Moteuracc2);
final WPI_TalonSRX Moteuracc = new WPI_TalonSRX(Constants.Moteuracc); final WPI_TalonSRX Moteuracc = new WPI_TalonSRX(Constants.Moteuracc);
final DigitalInput photocellacc = new DigitalInput(Constants.photocellacc); final DigitalInput photocellacc = new DigitalInput(Constants.photocellacc);

View File

@ -13,7 +13,9 @@ import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.DoubleSolenoid; import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.PneumaticsModuleType; import edu.wpi.first.wpilibj.PneumaticsModuleType;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
import edu.wpi.first.wpilibj.DoubleSolenoid.Value; import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants; import frc.robot.Constants;
@ -23,6 +25,10 @@ public class Grimpeur extends SubsystemBase {
// moteur // moteur
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
ShuffleboardLayout layout = Shuffleboard.getTab("dashboard")
.getLayout("grimpeur", BuiltInLayouts.kList)
.withSize(2,4)
.withPosition(1,1);
final CANSparkMax grimpeurd = new CANSparkMax(Constants.grimpeurd,MotorType.kBrushless); final CANSparkMax grimpeurd = new CANSparkMax(Constants.grimpeurd,MotorType.kBrushless);
final CANSparkMax grimpeurg = new CANSparkMax(Constants.grimpeurg,MotorType.kBrushless); final CANSparkMax grimpeurg = new CANSparkMax(Constants.grimpeurg,MotorType.kBrushless);
// limit switch // limit switch
@ -32,21 +38,11 @@ public class Grimpeur extends SubsystemBase {
final DoubleSolenoid pistondgauche= new DoubleSolenoid(PneumaticsModuleType.CTREPCM, Constants.pistondgaucheouvre, Constants.pistondroiteouvre); final DoubleSolenoid pistondgauche= new DoubleSolenoid(PneumaticsModuleType.CTREPCM, Constants.pistondgaucheouvre, Constants.pistondroiteouvre);
//fonction //fonction
public Grimpeur() { public Grimpeur() {
dashboard.add("limitgrimpeurd", droite()) layout.addBoolean("limitgrimpeurd", limitdroite::get);
.withSize(1, 1) layout.addBoolean("limitgrimpeurg", limitdroite::get);
.withPosition(1, 5); layout.add("grimpeurencodeurd", encoderd());
dashboard.add("limitgrimpeurd", droite()) layout.add("grimpeurencodeurg", encoderg());
.withSize(1, 1) layout.add("pitchgyrogrimpeur", getpitch());
.withPosition(1, 4);
dashboard.add("grimpeurencodeurd", encoderd())
.withSize(1, 1)
.withPosition(1, 3);
dashboard.add("grimpeurencodeurg", encoderg())
.withSize(1, 1)
.withPosition(1, 2);
dashboard.add("pitchgyrogrimpeur", getpitch())
.withSize(1, 1)
.withPosition(1, 1);
} }
public void droit(double vitesse){ public void droit(double vitesse){
grimpeurd.set(vitesse); grimpeurd.set(vitesse);

View File

@ -8,6 +8,7 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants; import frc.robot.Constants;
@ -16,12 +17,16 @@ public class Guideur extends SubsystemBase {
/** Creates a new Guideur. */ /** Creates a new Guideur. */
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
ShuffleboardLayout layout = Shuffleboard.getTab("dashboard")
.getLayout("grimpeur")
.withSize(2, 2)
.withPosition(1, 3);
final WPI_TalonSRX guideur = new WPI_TalonSRX(Constants.guideur); final WPI_TalonSRX guideur = new WPI_TalonSRX(Constants.guideur);
final DigitalInput guideurhaut = new DigitalInput(Constants.guideurhaut); final DigitalInput guideurhaut = new DigitalInput(Constants.guideurhaut);
final DigitalInput guideurbas = new DigitalInput(Constants.guideurbas); final DigitalInput guideurbas = new DigitalInput(Constants.guideurbas);
public Guideur() { public Guideur() {
dashboard.add("limitguideurhaut", haut()); dashboard.addBoolean("limitguideurhaut", guideurhaut::get);
dashboard.add("limitguideurbas", bas()); dashboard.addBoolean("limitguideurbas", guideurbas::get);
} }
public void guider(double vitesse){ public void guider(double vitesse){
guideur.set(vitesse); guideur.set(vitesse);

View File

@ -18,9 +18,13 @@ public class Lanceur extends SubsystemBase {
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
private GenericEntry vitesse = private GenericEntry vitesse =
dashboard.add("vitesse", 1) dashboard.add("vitesse", 1)
.withSize(1, 1)
.withPosition(3, 3)
.getEntry(); .getEntry();
private GenericEntry vitesseamp = private GenericEntry vitesseamp =
dashboard.add("vitesseamp", 1) dashboard.add("vitesseamp", 1)
.withSize(1, 1)
.withPosition(3, 4)
.getEntry(); .getEntry();
public Lanceur() { public Lanceur() {