From cb97c1a9be26697bd954dd1d7b44ce56046d9f7c Mon Sep 17 00:00:00 2001 From: Wesley28w Date: Fri, 3 Apr 2026 05:57:01 -0700 Subject: [PATCH] added functions for operator --- src/main/deploy/elastic-layout.json | 279 +++++------------- .../robot/commands/gpm/Superstructure.java | 19 ++ .../java/frc/robot/constants/Constants.java | 2 +- .../controls/PS5ControllerDriverConfig.java | 1 + .../frc/robot/subsystems/Intake/IntakeIO.java | 2 +- .../frc/robot/subsystems/shooter/Shooter.java | 8 + src/main/java/frc/robot/util/HubActive.java | 2 - 7 files changed, 101 insertions(+), 212 deletions(-) diff --git a/src/main/deploy/elastic-layout.json b/src/main/deploy/elastic-layout.json index 7811b8e..82fce05 100644 --- a/src/main/deploy/elastic-layout.json +++ b/src/main/deploy/elastic-layout.json @@ -8,11 +8,11 @@ "layouts": [], "containers": [ { - "title": "WON AUTO?", - "x": 1280.0, - "y": 256.0, - "width": 384.0, - "height": 256.0, + "title": "Autos Result", + "x": 1408.0, + "y": 512.0, + "width": 256.0, + "height": 128.0, "type": "Large Text Display", "properties": { "topic": "/SmartDashboard/WON AUTO?", @@ -20,114 +20,12 @@ "data_type": "string" } }, - { - "title": "Turret position", - "x": 1024.0, - "y": 0.0, - "width": 384.0, - "height": 256.0, - "type": "Graph", - "properties": { - "topic": "/SmartDashboard/Turret position", - "period": 0.033, - "data_type": "double", - "time_displayed": 5.0, - "color": 4278238420, - "line_width": 2.0 - } - }, - { - "title": "Target Velocity RPS", - "x": 768.0, - "y": 128.0, - "width": 256.0, - "height": 128.0, - "type": "Number Bar", - "properties": { - "topic": "/SmartDashboard/Target Velocity RPS", - "period": 0.06, - "data_type": "double", - "min_value": -60.0, - "max_value": 0.0, - "divisions": 5, - "inverted": true, - "orientation": "horizontal" - } - }, - { - "title": "Intake Calibrated", - "x": 256.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/SmartDashboard/Intake Calibrated", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "Hood Calibrated", - "x": 128.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/SmartDashboard/Hood Calibrated", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "Turret Calibrated", - "x": 0.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/SmartDashboard/Turret Calibrated", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "Climb Calibrated", - "x": 384.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/SmartDashboard/Climb Calibrated", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, { "title": "Field", "x": 0.0, - "y": 128.0, - "width": 768.0, - "height": 384.0, + "y": 0.0, + "width": 512.0, + "height": 512.0, "type": "Field", "properties": { "topic": "/SmartDashboard/Field", @@ -144,60 +42,9 @@ } }, { - "title": "Hood At Setpoint", - "x": 128.0, - "y": 512.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/SmartDashboard/Hood At Setpoint", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "Turret At Setpoint", + "title": "Voltage", "x": 0.0, "y": 512.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/SmartDashboard/Turret At Setpoint", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "Intake At Setpoint", - "x": 256.0, - "y": 512.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/SmartDashboard/Intake At Setpoint", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "Voltage", - "x": 512.0, - "y": 0.0, "width": 512.0, "height": 128.0, "type": "Voltage View", @@ -207,95 +54,111 @@ "data_type": "double", "min_value": 4.0, "max_value": 13.0, - "divisions": 5, + "divisions": 10, "inverted": false, "orientation": "horizontal" } }, { "title": "RobotID", - "x": 1408.0, - "y": 0.0, + "x": 0.0, + "y": 768.0, "width": 256.0, "height": 128.0, - "type": "Text Display", + "type": "Large Text Display", "properties": { "topic": "/SmartDashboard/RobotID", "period": 0.06, - "data_type": "string", - "show_submit_button": false + "data_type": "string" } }, { - "title": "OPERATOR: Shooter Power Modifier", - "x": 1408.0, - "y": 128.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", + "title": "Time till Unactive", + "x": 1280.0, + "y": 0.0, + "width": 384.0, + "height": 256.0, + "type": "Radial Gauge", "properties": { - "topic": "/SmartDashboard/OPERATOR: Shooter Power Modifier", + "topic": "/SmartDashboard/Time till Unactive", "period": 0.06, "data_type": "double", - "show_submit_button": false + "start_angle": -120.0, + "end_angle": 120.0, + "min_value": 0.0, + "max_value": 100.0, + "number_of_labels": 6, + "wrap_value": false, + "show_pointer": true, + "show_ticks": true } }, { - "title": "Auto chooser", + "title": "Time till active", "x": 1280.0, - "y": 512.0, + "y": 256.0, "width": 384.0, - "height": 128.0, - "type": "ComboBox Chooser", + "height": 256.0, + "type": "Radial Gauge", "properties": { - "topic": "/SmartDashboard/Auto chooser", + "topic": "/SmartDashboard/Time till active", "period": 0.06, - "sort_options": false + "data_type": "double", + "start_angle": -120.0, + "end_angle": 120.0, + "min_value": 0.0, + "max_value": 30.0, + "number_of_labels": 6, + "wrap_value": false, + "show_pointer": true, + "show_ticks": false } }, { - "title": "Match Time", - "x": 768.0, - "y": 256.0, - "width": 512.0, - "height": 384.0, - "type": "Match Time", + "title": "Hub Active", + "x": 1280.0, + "y": 512.0, + "width": 128.0, + "height": 128.0, + "type": "Boolean Box", "properties": { - "topic": "/SmartDashboard/Match Time", + "topic": "/SmartDashboard/Hub Active", "period": 0.06, - "data_type": "double", - "time_display_mode": "Minutes and Seconds", - "red_start_time": 20, - "yellow_start_time": 30 + "data_type": "boolean", + "true_color": 4283215696, + "false_color": 4294198070, + "true_icon": "None", + "false_icon": "None" } }, { - "title": "Phase Countdown", + "title": "Auto chooser", "x": 0.0, "y": 640.0, - "width": 384.0, - "height": 256.0, - "type": "Match Time", + "width": 512.0, + "height": 128.0, + "type": "ComboBox Chooser", "properties": { - "topic": "/SmartDashboard/Phase Countdown", + "topic": "/SmartDashboard/Auto chooser", "period": 0.06, - "data_type": "double", - "time_display_mode": "Minutes and Seconds", - "red_start_time": 20, - "yellow_start_time": 30 + "sort_options": true } }, { - "title": "Current Phase", - "x": 384.0, - "y": 512.0, + "title": "Spindexer Jamming", + "x": 1280.0, + "y": 768.0, "width": 384.0, "height": 128.0, - "type": "Large Text Display", + "type": "Boolean Box", "properties": { - "topic": "/SmartDashboard/Current Phase", + "topic": "/SmartDashboard/Spindexer Jamming", "period": 0.06, - "data_type": "string" + "data_type": "boolean", + "true_color": 4283215696, + "false_color": 4294198070, + "true_icon": "None", + "false_icon": "None" } } ] diff --git a/src/main/java/frc/robot/commands/gpm/Superstructure.java b/src/main/java/frc/robot/commands/gpm/Superstructure.java index 3b3fe90..9da140f 100644 --- a/src/main/java/frc/robot/commands/gpm/Superstructure.java +++ b/src/main/java/frc/robot/commands/gpm/Superstructure.java @@ -209,6 +209,25 @@ public class Superstructure extends Command { //spindexer.stopSpindexer(); } + // shoot higher + public void bumpUpHoodOffset() { + hoodOffset += 1.0; // 1 degree + } + + // shoot lower + public void bumpDownHoodOffset() { + hoodOffset -= 1.0; // 1 degree + } + + // aim more left + public void bumpUpTurretOffset() { + turretOffset += 2.5; // 2.5 degree + } + // aim more right + public void bumpDownTurretOffset() { + turretOffset -= 2.5shoo; // 2.5 degree + } + @Override public void execute() { TOFAdjustment = SmartDashboard.getNumber("OPERATOR: TOF Adjustment", TOFAdjustment); diff --git a/src/main/java/frc/robot/constants/Constants.java b/src/main/java/frc/robot/constants/Constants.java index cfa252c..3c1e2dd 100644 --- a/src/main/java/frc/robot/constants/Constants.java +++ b/src/main/java/frc/robot/constants/Constants.java @@ -21,7 +21,7 @@ public class Constants { public static final boolean USE_TELEMETRY = true; // this would disable all logger calls - public static final boolean DISABLE_LOGGING = true; + public static final boolean DISABLE_LOGGING = false; public static enum Mode { /** Running on a real robot. */ diff --git a/src/main/java/frc/robot/controls/PS5ControllerDriverConfig.java b/src/main/java/frc/robot/controls/PS5ControllerDriverConfig.java index 36453fe..f9f6caa 100644 --- a/src/main/java/frc/robot/controls/PS5ControllerDriverConfig.java +++ b/src/main/java/frc/robot/controls/PS5ControllerDriverConfig.java @@ -139,6 +139,7 @@ public class PS5ControllerDriverConfig extends BaseDriverConfig { controller.get(PS5Button.SQUARE).toggleOnTrue(autoShoot); } + // Hood if (hood != null) { // Set the hood down -- for safety measures under trench diff --git a/src/main/java/frc/robot/subsystems/Intake/IntakeIO.java b/src/main/java/frc/robot/subsystems/Intake/IntakeIO.java index 09bd90e..15dc34b 100644 --- a/src/main/java/frc/robot/subsystems/Intake/IntakeIO.java +++ b/src/main/java/frc/robot/subsystems/Intake/IntakeIO.java @@ -4,7 +4,7 @@ import org.littletonrobotics.junction.AutoLog; public interface IntakeIO { @AutoLog - public static class IntakeIOInputs{ + public static class IntakeIOInputs { public double leftPosition = 0.0; public double rightPosition = 0.0; public double leftCurrent = 0.0; diff --git a/src/main/java/frc/robot/subsystems/shooter/Shooter.java b/src/main/java/frc/robot/subsystems/shooter/Shooter.java index 882ffc8..0e21a81 100644 --- a/src/main/java/frc/robot/subsystems/shooter/Shooter.java +++ b/src/main/java/frc/robot/subsystems/shooter/Shooter.java @@ -141,6 +141,14 @@ public class Shooter extends SubsystemBase implements ShooterIO { } } + public void bumpUpShooterModifier() { + powerModifier += 0.025; + } + + public void bumpDownShooterModifier() { + powerModifier -= 0.025; + } + /** * @return Whether the shooter is at the target speed with tolerance of 1 m/s */ diff --git a/src/main/java/frc/robot/util/HubActive.java b/src/main/java/frc/robot/util/HubActive.java index e6d7ade..5a5b80c 100644 --- a/src/main/java/frc/robot/util/HubActive.java +++ b/src/main/java/frc/robot/util/HubActive.java @@ -42,13 +42,11 @@ public class HubActive { } } - // Shift was is active for blue if red won auto, or red if blue won auto. boolean shift1Active = switch (alliance.get()) { case Red -> !redInactiveFirst; case Blue -> redInactiveFirst; }; - SmartDashboard.putNumber("Time till active", timeToActive().orElse(timeToInactive().orElse(0.0))); if (matchTime > 130) { // Transition shift, hub is active. return true; -- 2.39.5