Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
245 changes: 206 additions & 39 deletions src/main/deploy/elastic-layout.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,123 @@
"version": 1.0,
"grid_size": 34,
"tabs": [
{
"name": "Teleoperated",
"grid_layout": {
"layouts": [],
"containers": [
{
"title": "Robot State",
"x": 0.0,
"y": 0.0,
"width": 374.0,
"height": 170.0,
"type": "Large Text Display",
"properties": {
"topic": "Robot/m_robotContainer/robotStateToString",
"period": 0.6,
"data_type": "string"
}
},
{
"title": "Match Period",
"x": 374.0,
"y": 170.0,
"width": 714.0,
"height": 136.0,
"type": "Large Text Display",
"properties": {
"topic": "Robot/m_robotContainer/loggedTelemetryInstance/getMatchPeriod",
"period": 0.6,
"data_type": "string"
}
},
{
"title": "Is our shift?",
"x": 0.0,
"y": 170.0,
"width": 374.0,
"height": 374.0,
"type": "Boolean Box",
"properties": {
"topic": "Robot/m_robotContainer/isOurShiftTrigger",
"period": 0.06,
"data_type": "boolean",
"true_color": 4283215696,
"false_color": 4294198070,
"true_icon": "None",
"false_icon": "X"
}
},
{
"title": "Our Shift First",
"x": 1088.0,
"y": 0.0,
"width": 408.0,
"height": 170.0,
"type": "Boolean Box",
"properties": {
"topic": "Robot/m_robotContainer/isOurShiftFirstTrigger",
"period": 0.06,
"data_type": "boolean",
"true_color": 4294967295,
"false_color": 4279571733,
"true_icon": "Checkmark",
"false_icon": "None"
}
},
{
"title": "Match Time",
"x": 374.0,
"y": 0.0,
"width": 714.0,
"height": 170.0,
"type": "Match Time",
"properties": {
"topic": "Robot/m_robotContainer/loggedTelemetryInstance/getMatchTime",
"period": 0.06,
"data_type": "double",
"time_display_mode": "Minutes and Seconds",
"red_start_time": 15,
"yellow_start_time": 30
}
},
{
"title": "remaining period time",
"x": 374.0,
"y": 306.0,
"width": 714.0,
"height": 238.0,
"type": "Match Time",
"properties": {
"topic": "Robot/m_robotContainer/loggedTelemetryInstance/getMatchPeriodTime",
"period": 0.033,
"data_type": "double",
"time_display_mode": "Seconds Only",
"red_start_time": 0,
"yellow_start_time": 5
}
},
{
"title": "Is our shift?",
"x": 1088.0,
"y": 170.0,
"width": 408.0,
"height": 374.0,
"type": "Boolean Box",
"properties": {
"topic": "Robot/m_robotContainer/isOurShiftTrigger",
"period": 0.06,
"data_type": "boolean",
"true_color": 4283215696,
"false_color": 4294198070,
"true_icon": "None",
"false_icon": "X"
}
}
]
}
},
{
"name": "Disabled",
"grid_layout": {
Expand Down Expand Up @@ -67,7 +184,7 @@
}
},
{
"title": "Auto Chooser",
"title": "Auto Choser",
"x": 0.0,
"y": 0.0,
"width": 374.0,
Expand Down Expand Up @@ -114,7 +231,7 @@
"robot_width": 0.85,
"robot_length": 0.85,
"show_other_objects": true,
"show_trajectories": true,
"show_trajectories": false,
"field_rotation": 0.0,
"robot_color": 4294198070,
"trajectory_color": 4294967295,
Expand All @@ -126,7 +243,7 @@
"x": 510.0,
"y": 0.0,
"width": 238.0,
"height": 340.0,
"height": 170.0,
"type": "Large Text Display",
"properties": {
"topic": "Robot/m_robotContainer/robotStateToString",
Expand All @@ -136,9 +253,9 @@
},
{
"title": "Driving State",
"x": 0.0,
"x": 510.0,
"y": 170.0,
"width": 510.0,
"width": 238.0,
"height": 170.0,
"type": "Large Text Display",
"properties": {
Expand All @@ -147,6 +264,23 @@
"data_type": "string"
}
},
{
"title": "All Zeroed",
"x": 0.0,
"y": 170.0,
"width": 510.0,
"height": 170.0,
"type": "Boolean Box",
"properties": {
"topic": "Robot/bothSubsystemsZeroed",
"period": 0.06,
"data_type": "boolean",
"true_color": 4283215696,
"false_color": 4294198070,
"true_icon": "None",
"false_icon": "None"
}
},
{
"title": "Match Time",
"x": 0.0,
Expand All @@ -162,63 +296,96 @@
"red_start_time": 15,
"yellow_start_time": 30
}
},
{
"title": "Ready to shoot",
"x": 0.0,
"y": 340.0,
"width": 748.0,
"height": 204.0,
"type": "Boolean Box",
"properties": {
"topic": "Robot/m_robotContainer/readyToShootTrigger",
"period": 0.06,
"data_type": "boolean",
"true_color": 4283215696,
"false_color": 4294198070,
"true_icon": "None",
"false_icon": "None"
}
},
{
"title": "climbed?",
"x": 748.0,
"y": 340.0,
"width": 782.0,
"height": 204.0,
"type": "Boolean Box",
"properties": {
"topic": "Robot/m_robotContainer/climbingL1Trigger",
"period": 0.06,
"data_type": "boolean",
"true_color": 4283215696,
"false_color": 4294198070,
"true_icon": "None",
"false_icon": "None"
}
}
]
}
},
{
"name": "Teleoperated",
"name": "Climbing",
"grid_layout": {
"layouts": [],
"containers": [
{
"title": "Robot State",
"title": "Climber Camera",
"x": 0.0,
"y": 0.0,
"width": 374.0,
"height": 578.0,
"type": "Large Text Display",
"width": 646.0,
"height": 544.0,
"type": "Camera Stream",
"properties": {
"topic": "Robot/m_robotContainer/robotStateToString",
"period": 0.6,
"data_type": "string"
"topic": "/CameraPublisher/USB Camera 0",
"period": 0.06,
"rotation_turns": 0,
"compression": 40,
"fps": 30
}
},
{
"title": "Match Time",
"x": 374.0,
"title": "Climbed L1",
"x": 646.0,
"y": 0.0,
"width": 782.0,
"height": 170.0,
"type": "Match Time",
"width": 850.0,
"height": 272.0,
"type": "Boolean Box",
"properties": {
"topic": "Robot/m_robotContainer/loggedTelemetryInstance/getMatchTime",
"topic": "Robot/m_robotContainer/climbingL1Trigger",
"period": 0.06,
"data_type": "double",
"time_display_mode": "Minutes and Seconds",
"red_start_time": 15,
"yellow_start_time": 30
"data_type": "boolean",
"true_color": 4283215696,
"false_color": 4294198070,
"true_icon": "None",
"false_icon": "X"
}
},
{
"title": "Field",
"x": 374.0,
"y": 170.0,
"width": 782.0,
"height": 408.0,
"type": "Field",
"title": "Climbed L2 or L3",
"x": 646.0,
"y": 272.0,
"width": 850.0,
"height": 272.0,
"type": "Boolean Box",
"properties": {
"topic": "/SmartDashboard/Field",
"topic": "Robot/m_robotContainer/climbingL2_L3Trigger",
"period": 0.06,
"field_game": "Rebuilt",
"robot_width": 0.85,
"robot_length": 0.85,
"show_other_objects": true,
"show_trajectories": true,
"field_rotation": 0.0,
"robot_color": 4294198070,
"trajectory_color": 4294967295,
"show_robot_outside_widget": true
"data_type": "boolean",
"true_color": 4283215696,
"false_color": 4294198070,
"true_icon": "None",
"false_icon": "X"
}
}
]
Expand Down
36 changes: 35 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@
import edu.wpi.first.epilogue.Logged;
import edu.wpi.first.epilogue.NotLogged;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.wpilibj.GenericHID.RumbleType;
import edu.wpi.first.units.measure.Time;
import edu.wpi.first.wpilibj.RobotController;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.DeferredCommand;
import edu.wpi.first.wpilibj2.command.button.Trigger;
import frc.robot.DeviceIDs.controllerIDs;
import frc.robot.commands.AddVisionMeasurement;
import frc.robot.commands.ResetPose;
import frc.robot.commands.states.ShootingOnFly;
import frc.robot.commands.states.ShootingOnPreset;
import frc.robot.constants.ChoreoTraj;
import frc.robot.constants.ConstRumble;
import frc.robot.constants.ConstAuto;
import frc.robot.constants.ConstField;
import frc.robot.constants.ConstSystem;
Expand Down Expand Up @@ -140,6 +143,16 @@ public class RobotContainer {
conDriver.btn_RightBumper),
Set.of(driverStateMachineInstance));

// public final Trigger
public final Trigger isOurShiftFirstTrigger = new Trigger(
() -> telemetryInstance.ourShiftFirst());
public final Trigger isOurShiftTrigger = new Trigger(
() -> telemetryInstance.isHubActive());
public final Trigger hubSwitchingTrigger = new Trigger(
() -> telemetryInstance.hubsIsSwitching());
public final Trigger climbingL1Trigger = new Trigger(
() -> stateMachineInstance.getRobotState() == RobotState.CLIMBING);

public RobotContainer() {
conDriver.setLeftDeadband(constControllers.DRIVER_LEFT_STICK_DEADBAND);

Expand Down Expand Up @@ -457,4 +470,25 @@ public Command addVisionMeasurement() {
public static boolean isPracticeBot() {
return RobotController.getSerialNumber().equals(ConstSystem.PRACTICE_BOT_RIO_SERIAL_NUMBER);
}

public void configFeedback() {

hubSwitchingTrigger
.whileTrue(
Commands.run(() -> conDriver.setRumble(RumbleType.kRightRumble,
ConstRumble.SHIFT_CHANGE_RUMBLE), telemetryInstance))
.onFalse(Commands.runOnce(() -> conDriver.setRumble(RumbleType.kRightRumble,
ConstRumble.RUMBLE_OFF), telemetryInstance));

isOurShiftFirstTrigger
.whileTrue(Commands.run(() -> {
double t = Timer.getFPGATimestamp(); // seconds since FPGA boot
boolean on = ((int) Math.floor(t) % 2) == 0; // toggle every 1 second
conDriver.setRumble(RumbleType.kLeftRumble,
on ? ConstRumble.OUR_SHIFT_FIRST_RUMBLE : ConstRumble.RUMBLE_OFF);
}, telemetryInstance))
.onFalse(Commands.runOnce(() -> conDriver.setRumble(RumbleType.kLeftRumble, ConstRumble.RUMBLE_OFF),
telemetryInstance));
// Add feedback bindings here if needed
}
}
Loading
Loading