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.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.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
@ -45,6 +47,7 @@ import frc.robot.subsystem.Pixy;
public class RobotContainer {
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
private final SendableChooser<Command> autoChooser;
Drive drive = new Drive();
Accumulateur accumulateur = new Accumulateur();
@ -70,6 +73,7 @@ public class RobotContainer {
AllumeLED allumeLED = new AllumeLED(LED);
Pistongrimpeur pistongrimpeur = new Pistongrimpeur(grimpeur, LED);
public RobotContainer() {
dashboard.addCamera("limelight", "limelight","limelight.local:5800");
NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur));
NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur));
autoChooser = AutoBuilder.buildAutoChooser();
@ -98,6 +102,7 @@ public class RobotContainer {
}
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");
private GenericEntry vitesse =
dashboard.add("vitesseacc", 1)
.getEntry();
.withSize(1, 1)
.withPosition(4, 3)
.getEntry();
final WPI_TalonSRX Moteuracc2 = new WPI_TalonSRX(Constants.Moteuracc2);
final WPI_TalonSRX Moteuracc = new WPI_TalonSRX(Constants.Moteuracc);
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.PneumaticsModuleType;
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.BuiltInLayouts;
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
@ -23,6 +25,10 @@ public class Grimpeur extends SubsystemBase {
// moteur
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 grimpeurg = new CANSparkMax(Constants.grimpeurg,MotorType.kBrushless);
// limit switch
@ -32,21 +38,11 @@ public class Grimpeur extends SubsystemBase {
final DoubleSolenoid pistondgauche= new DoubleSolenoid(PneumaticsModuleType.CTREPCM, Constants.pistondgaucheouvre, Constants.pistondroiteouvre);
//fonction
public Grimpeur() {
dashboard.add("limitgrimpeurd", droite())
.withSize(1, 1)
.withPosition(1, 5);
dashboard.add("limitgrimpeurd", droite())
.withSize(1, 1)
.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);
layout.addBoolean("limitgrimpeurd", limitdroite::get);
layout.addBoolean("limitgrimpeurg", limitdroite::get);
layout.add("grimpeurencodeurd", encoderd());
layout.add("grimpeurencodeurg", encoderg());
layout.add("pitchgyrogrimpeur", getpitch());
}
public void droit(double 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.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
@ -16,12 +17,16 @@ public class Guideur extends SubsystemBase {
/** Creates a new Guideur. */
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 DigitalInput guideurhaut = new DigitalInput(Constants.guideurhaut);
final DigitalInput guideurbas = new DigitalInput(Constants.guideurbas);
public Guideur() {
dashboard.add("limitguideurhaut", haut());
dashboard.add("limitguideurbas", bas());
dashboard.addBoolean("limitguideurhaut", guideurhaut::get);
dashboard.addBoolean("limitguideurbas", guideurbas::get);
}
public void guider(double vitesse){
guideur.set(vitesse);

View File

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