Skip to content

Commit 59012cd

Browse files
committed
Rearrange Shuffleboard + add limelight stream
1 parent 0123941 commit 59012cd

5 files changed

Lines changed: 66 additions & 37 deletions

File tree

src/main/java/frc/robot/Constants.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ public static enum FieldType {
4141
public static final SendableChooser<FieldType> kFieldType = new SendableChooser<>();
4242

4343
static {
44-
kFieldType.setDefaultOption("AndyMark Field", FieldType.ANDYMARK);
45-
kFieldType.addOption("Welded Field", FieldType.WELDED);
44+
kFieldType.setDefaultOption("AndyMark", FieldType.ANDYMARK);
45+
kFieldType.addOption("Welded", FieldType.WELDED);
4646

47-
Shuffleboard.getTab("Teleoperated")
47+
Shuffleboard.getTab("Testing")
4848
.add("Field Type", kFieldType)
4949
.withWidget(BuiltInWidgets.kComboBoxChooser)
5050
.withSize(2, 1)
51-
.withPosition(0, 3);
51+
.withPosition(0, 1);
5252
}
5353

5454
/**

src/main/java/frc/robot/RobotContainer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private void configureBindings() {
101101
overrideElevatorFactorCombo.getTrigger().onTrue(Commands.runOnce(() -> {}));
102102
Shuffleboard.getTab("Teleoperated")
103103
.addBoolean("EleFact Override", overrideElevatorFactorCombo.getTrigger())
104-
.withPosition(8, 2)
104+
.withPosition(1, 3)
105105
.withSize(1, 1);
106106

107107
swerve.setToAimSuppliers(
@@ -171,7 +171,7 @@ private void configureBindings() {
171171
alignedOverrideCombo.getTrigger().onTrue(Commands.run(() -> {}));
172172
Shuffleboard.getTab("Teleoperated")
173173
.addBoolean("Aligned Override", alignedOverrideCombo.getTrigger()).
174-
withPosition(3, 2)
174+
withPosition(8, 2)
175175
.withSize(1, 1);
176176
elevator.setIsAlignedSupplier(() -> swerve.isAligned() || alignedOverrideCombo.getTrigger().getAsBoolean());
177177
elevator.setScoreComboSupplier(auxController.rightTrigger());

src/main/java/frc/robot/subsystems/elevator/Elevator.java

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,36 @@ public Elevator(ElevatorIO io) {
5656

5757
ShuffleboardTab teleopTab = Shuffleboard.getTab("Teleoperated");
5858
teleopTab.addBoolean("Low Photo", () -> elevatorIOInputs.lowerPhotosensor)
59-
.withPosition(2, 1)
59+
.withPosition(9, 2)
6060
.withSize(1, 1);
6161
teleopTab.addBoolean("Up Photo", () -> elevatorIOInputs.upperPhotosensor)
62-
.withPosition(2, 0)
62+
.withPosition(9, 1)
6363
.withSize(1, 1);
64-
teleopTab.addBoolean("Low Limit", () -> elevatorIOInputs.lowLimit)
65-
.withPosition(3, 1)
64+
// teleopTab.addBoolean("Low Limit", () -> elevatorIOInputs.lowLimit)
65+
// .withPosition(3, 1)
66+
// .withSize(1, 1);
67+
// teleopTab.addBoolean("High Limit", () -> elevatorIOInputs.highLimit)
68+
// .withPosition(3, 0)
69+
// .withSize(1, 1);
70+
teleopTab.addString("Limit Switches", () ->
71+
(Timer.getFPGATimestamp() % 1 > 0.5 ? "\\ " : "/ ") +
72+
(elevatorIOInputs.lowerPhotosensor ?
73+
(elevatorIOInputs.upperPhotosensor ? "Both" : "Low") :
74+
(elevatorIOInputs.lowerPhotosensor ? "High" : "None")) +
75+
(Timer.getFPGATimestamp() % 1 > 0.5 ? " /" : " \\"))
76+
.withPosition(8, 1)
6677
.withSize(1, 1);
67-
teleopTab.addBoolean("High Limit", () -> elevatorIOInputs.highLimit)
68-
.withPosition(3, 0)
69-
.withSize(1, 1);
70-
teleopTab.addString("Elevator Position", () -> elevatorIOInputs.desiredPosition.name)
71-
.withPosition(0, 2)
78+
teleopTab.addString("Elevator Position", () -> elevatorIOInputs.desiredPosition.name + (intaking ? " + Intaking" : ""))
79+
.withPosition(8, 0)
7280
.withSize(2, 1);
73-
teleopTab.addBoolean("\"Intaking\"", () -> intaking)
74-
.withPosition(2, 2)
75-
.withSize(1, 1);
76-
teleopTab.addBoolean("Home Bounce", () -> bouncing)
77-
.withPosition(7, 2)
81+
// teleopTab.addBoolean("\"Intaking\"", () -> intaking)
82+
// .withPosition(2, 2)
83+
// .withSize(1, 1);
84+
teleopTab.addBoolean("Bouncing", () -> bouncing)
85+
.withPosition(9, 3)
7886
.withSize(1, 1);
7987
teleopTab.addBoolean("Awaiting Home", () -> awaitingScoreCombo)
80-
.withPosition(7, 1)
88+
.withPosition(8, 3)
8189
.withSize(1, 1);
8290
}
8391

src/main/java/frc/robot/subsystems/swerve/SwerveDrive.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -191,27 +191,27 @@ private void initAutoDashboards() {
191191

192192
ShuffleboardTab teleopTab = Shuffleboard.getTab("Teleoperated");
193193
teleopTab.addBoolean("toX", () -> toX)
194-
.withPosition(2, 3)
194+
.withPosition(0, 3)
195195
.withSize(1, 1);
196-
teleopTab.addString("Field Zone", () -> fieldZone.name())
197-
.withPosition(0, 1)
198-
.withSize(2, 1);
199-
teleopTab.addString("Desired Preset Position", () -> desiredPresetPosition.name())
196+
teleopTab.addString("Field Zone + Preset Pos", () -> fieldZone.name() + " " + desiredPresetPosition.name())
200197
.withPosition(0, 0)
201198
.withSize(2, 1);
199+
// teleopTab.addString("Desired Preset Position", () -> desiredPresetPosition.name())
200+
// .withPosition(0, 0)
201+
// .withSize(2, 1);
202202
teleopTab.addBoolean("Aligned", this::isAligned)
203-
.withPosition(3, 3)
203+
.withPosition(1, 2)
204204
.withSize(1, 1);
205205
teleopTab.addNumber("xError", () -> errorX)
206-
.withPosition(7, 0);
206+
.withPosition(0, 1);
207207
teleopTab.addNumber("yError", () -> errorY)
208-
.withPosition(8, 0);
208+
.withPosition(1, 1);
209209
teleopTab.addNumber("headingError", () -> errorHeading)
210-
.withPosition(9, 0)
211-
.withSize(1, 1);
212-
teleopTab.addBoolean("reefPresetted", () -> reefPresetted)
213-
.withPosition(8, 1)
210+
.withPosition(0, 2)
214211
.withSize(1, 1);
212+
// teleopTab.addBoolean("reefPresetted", () -> reefPresetted)
213+
// .withPosition(8, 1)
214+
// .withSize(1, 1);
215215

216216
presetVisualizerField = new Field2d();
217217
odometryField = new Field2d();
@@ -220,10 +220,10 @@ private void initAutoDashboards() {
220220
odometryField.setRobotPose(new Pose2d());
221221

222222
teleopTab.add("Desired Preset Pose", presetVisualizerField)
223-
.withPosition(4, 2)
223+
.withPosition(2, 2)
224224
.withSize(3, 2);
225225
teleopTab.add("Odometry Pose", odometryField)
226-
.withPosition(4, 0)
226+
.withPosition(2, 0)
227227
.withSize(3, 2);
228228
}
229229

src/main/java/frc/robot/subsystems/vision/Vision.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
package frc.robot.subsystems.vision;
22

3+
import java.util.HashMap;
4+
35
import org.littletonrobotics.junction.Logger;
46

7+
import edu.wpi.first.cameraserver.CameraServer;
8+
import edu.wpi.first.cscore.HttpCamera;
59
import edu.wpi.first.math.Matrix;
610
import edu.wpi.first.math.VecBuilder;
711
import edu.wpi.first.math.geometry.Pose2d;
812
import edu.wpi.first.math.numbers.N1;
913
import edu.wpi.first.math.numbers.N3;
10-
import edu.wpi.first.networktables.NetworkTableInstance;
1114
import edu.wpi.first.wpilibj.Alert;
12-
import edu.wpi.first.wpilibj.Timer;
1315
import edu.wpi.first.wpilibj.Alert.AlertType;
16+
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
17+
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
1418
import edu.wpi.first.wpilibj2.command.SubsystemBase;
1519

1620
public class Vision extends SubsystemBase {
@@ -29,6 +33,23 @@ public Vision(PoseEstimateConsumer consumer, VisionIO... ios) {
2933
new Alert("Vision module " + ios[i].getLimelightLocation().name + " disconnected.", AlertType.kWarning)
3034
);
3135
}
36+
37+
ShuffleboardTab teleopTab = Shuffleboard.getTab("Teleoperated");
38+
HttpCamera frontCameraStream = new HttpCamera("Front", "http://10.1.78:5800");
39+
HttpCamera highCameraStream = new HttpCamera("High", "http://10.1.78:5810");
40+
CameraServer.addCamera(frontCameraStream);
41+
CameraServer.addCamera(highCameraStream);
42+
CameraServer.startAutomaticCapture();
43+
HashMap<String, Object> cameraProperties = new HashMap<>();
44+
cameraProperties.put("Show controls", false);
45+
teleopTab.add(frontCameraStream)
46+
.withPosition(5, 0)
47+
.withSize(3, 2)
48+
.withProperties(cameraProperties);
49+
teleopTab.add(highCameraStream)
50+
.withPosition(5, 2)
51+
.withSize(3, 2)
52+
.withProperties(cameraProperties);
3253
}
3354

3455
@Override

0 commit comments

Comments
 (0)