mettre des choses dans le dashboard(ca marche)

This commit is contained in:
Olivier Dubois 2023-12-05 19:09:54 -05:00
parent 838eab55e6
commit c214822ac6
5 changed files with 38 additions and 10 deletions

View File

@ -38,7 +38,8 @@ public class RobotContainer {
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard"); ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
ShuffleboardLayout forces = Shuffleboard.getTab("Dashboard") ShuffleboardLayout forces = Shuffleboard.getTab("Dashboard")
.getLayout("forces", BuiltInLayouts.kList) .getLayout("forces", BuiltInLayouts.kList)
.withSize(3, 7); .withSize(1, 7)
.withPosition(1, 0);
GenericEntry force1 = forces.add("Force1", 2).getEntry(); GenericEntry force1 = forces.add("Force1", 2).getEntry();
GenericEntry force2 = forces.add("Force2", 4).getEntry(); GenericEntry force2 = forces.add("Force2", 4).getEntry();
GenericEntry force3 = forces.add("Force3", 6).getEntry(); GenericEntry force3 = forces.add("Force3", 6).getEntry();

View File

@ -16,7 +16,8 @@ public class Avancer extends CommandBase {
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard"); ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
ShuffleboardLayout avancer = Shuffleboard.getTab("Dashboard") ShuffleboardLayout avancer = Shuffleboard.getTab("Dashboard")
.getLayout("Avancer", BuiltInLayouts.kList) .getLayout("Avancer", BuiltInLayouts.kList)
.withSize(3, 3); .withSize(1, 4)
.withPosition(4, 0);
/** Creates a new Avancer. */ /** Creates a new Avancer. */
public Avancer(Drive drive) { public Avancer(Drive drive) {
avancer.add("vitesse x", 1); avancer.add("vitesse x", 1);

View File

@ -16,7 +16,8 @@ public class Reculer extends CommandBase {
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard"); ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
ShuffleboardLayout reculer = Shuffleboard.getTab("Dashboard") ShuffleboardLayout reculer = Shuffleboard.getTab("Dashboard")
.getLayout("Reculer", BuiltInLayouts.kList) .getLayout("Reculer", BuiltInLayouts.kList)
.withSize(3, 3); .withSize(1, 4)
.withPosition(6,0);
/** Creates a new Reculer. */ /** Creates a new Reculer. */
public Reculer(Drive drive) { public Reculer(Drive drive) {
reculer.add("vitesse x", 1); reculer.add("vitesse x", 1);

View File

@ -7,14 +7,28 @@ package frc.robot.subsystems;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.math.geometry.Translation2d; import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.kinematics.SwerveModulePosition; import edu.wpi.first.math.kinematics.SwerveModulePosition;
import edu.wpi.first.wpilibj.Filesystem; import edu.wpi.first.wpilibj.Filesystem;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
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 edu.wpi.first.wpilibj2.command.SubsystemBase;
import swervelib.SwerveDrive; import swervelib.SwerveDrive;
import swervelib.parser.SwerveParser; import swervelib.parser.SwerveParser;
public class Drive extends SubsystemBase { public class Drive extends SubsystemBase {
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
ShuffleboardLayout avancer = Shuffleboard.getTab("Dashboard")
.getLayout("Avancer", BuiltInLayouts.kList)
.withSize(1, 4)
.withPosition(4, 0);
ShuffleboardLayout reculer = Shuffleboard.getTab("Dashboard")
.getLayout("Reculer", BuiltInLayouts.kList)
.withSize(1, 4)
.withPosition(3,0);
SwerveDrive swerveDrive; SwerveDrive swerveDrive;
File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve"); File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve");
@ -25,6 +39,14 @@ public class Drive extends SubsystemBase {
/** Creates a new Drive. */ /** Creates a new Drive. */
public Drive() { public Drive() {
reculer.add("vitesse x", 1);
reculer.add("vitesse y", 2);
reculer.add("vitesse z", 3);
reculer.add("distance", 4);
avancer.add("vitesse x", 1);
avancer.add("vitesse y", 2);
avancer.add("vitesse z", 3);
avancer.add("distance", 4);
try { try {
this.swerveDrive = new SwerveParser(swerveJsonDirectory).createSwerveDrive(); this.swerveDrive = new SwerveParser(swerveJsonDirectory).createSwerveDrive();
} catch (IOException e) { } catch (IOException e) {

View File

@ -7,6 +7,7 @@ package frc.robot.subsystems;
import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType; import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts; import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
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.ShuffleboardLayout;
@ -18,14 +19,16 @@ public class Lanceur extends SubsystemBase {
ShuffleboardTab dash2 = Shuffleboard.getTab("Dashboard2.0"); ShuffleboardTab dash2 = Shuffleboard.getTab("Dashboard2.0");
ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard"); ShuffleboardTab dashboard = Shuffleboard.getTab("Dashboard");
//ShuffleboardLayout pid = Shuffleboard.getTab("Dashboard") ShuffleboardLayout pid = Shuffleboard.getTab("Dashboard")
//.getLayout("Pid", BuiltInLayouts.kList) .getLayout("Pid", BuiltInLayouts.kList)
//.withSize(3, 7); .withSize(1, 3)
.withPosition(0, 0);
private GenericEntry p = pid.add("p", 1).getEntry();
public Lanceur(){ public Lanceur(){
dash2.add("test", 1); double P = p.getDouble(1.0);
dashboard.add("p", 1); pid.add("i", 2).getEntry();
dashboard.add("i", 2); pid.add("d", 3).getEntry();
dashboard.add("d", 3);
} }
final CANSparkMax lanceur = new CANSparkMax(Constants.lanceur, MotorType.kBrushless); final CANSparkMax lanceur = new CANSparkMax(Constants.lanceur, MotorType.kBrushless);