From 79d656cfde2c5b8208e0eb38e53173a99d9c9133 Mon Sep 17 00:00:00 2001 From: moo Date: Wed, 25 Mar 2026 15:47:33 -0700 Subject: [PATCH] :( --- src/main/deploy/elastic-layout.json | 236 ++++++++++++++++++ src/main/java/frc/robot/RobotContainer.java | 27 +- .../java/frc/robot/commands/LogCommand.java | 43 ++++ 3 files changed, 293 insertions(+), 13 deletions(-) create mode 100644 src/main/deploy/elastic-layout.json create mode 100644 src/main/java/frc/robot/commands/LogCommand.java diff --git a/src/main/deploy/elastic-layout.json b/src/main/deploy/elastic-layout.json new file mode 100644 index 0000000..efeb960 --- /dev/null +++ b/src/main/deploy/elastic-layout.json @@ -0,0 +1,236 @@ +{ + "version": 1.0, + "grid_size": 128, + "tabs": [ + { + "name": "Teleoperated", + "grid_layout": { + "layouts": [], + "containers": [ + { + "title": "WON AUTO?", + "x": 768.0, + "y": 128.0, + "width": 256.0, + "height": 128.0, + "type": "Large Text Display", + "properties": { + "topic": "/SmartDashboard/WON AUTO?", + "period": 0.06, + "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": 512.0, + "y": 0.0, + "width": 128.0, + "height": 128.0, + "type": "Text Display", + "properties": { + "topic": "/SmartDashboard/Target Velocity RPS", + "period": 0.06, + "data_type": "double", + "show_submit_button": false + } + }, + { + "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, + "type": "Field", + "properties": { + "topic": "/SmartDashboard/Field", + "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 + } + }, + { + "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", + "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": 640.0, + "y": 0.0, + "width": 384.0, + "height": 128.0, + "type": "Voltage View", + "properties": { + "topic": "/AdvantageKit/PowerDistribution/Voltage", + "period": 0.06, + "data_type": "double", + "min_value": 4.0, + "max_value": 13.0, + "divisions": 5, + "inverted": false, + "orientation": "horizontal" + } + }, + { + "title": "RobotID", + "x": 768.0, + "y": 256.0, + "width": 256.0, + "height": 128.0, + "type": "Text Display", + "properties": { + "topic": "/SmartDashboard/RobotID", + "period": 0.06, + "data_type": "string", + "show_submit_button": false + } + } + ] + } + }, + { + "name": "Autonomous", + "grid_layout": { + "layouts": [], + "containers": [] + } + } + ] +} \ No newline at end of file diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index fe64006..2ba5c4b 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -19,6 +19,7 @@ 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.InstantCommand; +import frc.robot.commands.LogCommand; import frc.robot.commands.drive_comm.DefaultDriveCommand; import frc.robot.commands.gpm.AutoShootCommand; import frc.robot.commands.gpm.ClimbDriveCommand; @@ -65,7 +66,7 @@ public class RobotContainer { private Intake intake = null; // this is inside addAuto() - //private Command auto = new DoNothing(); + // private Command auto = new DoNothing(); // Controllers are defined here private BaseDriverConfig driver = null; @@ -131,31 +132,31 @@ public class RobotContainer { driver.configureControls(); operator.configureControls(); - registerCommands(); PathGroupLoader.loadPathGroups(); - + initializeAutoBuilder(); autoChooserInit(); // put the Chooser on the SmartDashboard SmartDashboard.putData("Auto chooser", autoChooser); - - if (turret != null) { turret.setDefaultCommand(new Superstructure(turret, drive, hood, shooter, spindexer)); } + drive.setDefaultCommand(new DefaultDriveCommand(drive, driver)); break; } - if (intake != null && hood != null && turret != null) - CommandScheduler.getInstance().schedule(new HardstopWarning(hood, intake, turret)); + if (intake != null && hood != null && turret != null) + CommandScheduler.getInstance().schedule(new HardstopWarning(hood, intake, turret)); // This is really annoying so it's disabled DriverStation.silenceJoystickConnectionWarning(true); + CommandScheduler.getInstance().schedule(new LogCommand()); + // TODO: verify this claim. // LiveWindow is causing periodic loop overruns LiveWindow.disableAllTelemetry(); @@ -237,16 +238,16 @@ public class RobotContainer { } - public void addAuto(String name){ - try{ + public void addAuto(String name) { + try { Command auto = new PathPlannerAuto(name); autoChooser.addOption(name, auto); } // is this the right one?? catch (AutoBuilderException e) { - e.printStackTrace(); - System.out.println("HELLOOOO AUTO \"" + name + "\" NOT FOUND"); - } + e.printStackTrace(); + System.out.println("HELLOOOO AUTO \"" + name + "\" NOT FOUND"); + } } /** @@ -257,7 +258,7 @@ public class RobotContainer { // add the options to the Chooser String defaultAuto = "Test default auto"; String leftSideAuto = "Left Week V1"; - String rightSideAuto = "Right Week V1"; + String rightSideAuto = "Right Week V1"; String shootOnlyAuto = "Shoot Only Left Week V1"; autoChooser.setDefaultOption("Default", new PathPlannerAuto(defaultAuto)); diff --git a/src/main/java/frc/robot/commands/LogCommand.java b/src/main/java/frc/robot/commands/LogCommand.java new file mode 100644 index 0000000..041adc1 --- /dev/null +++ b/src/main/java/frc/robot/commands/LogCommand.java @@ -0,0 +1,43 @@ +package frc.robot.commands; + +import org.littletonrobotics.junction.Logger; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.util.Elastic; +import frc.robot.util.HubActive; +import frc.robot.util.ShooterPhysics; +import frc.robot.util.Elastic.Notification; +import frc.robot.util.Elastic.NotificationLevel; + +public class LogCommand extends Command { + + private boolean hubActive = false; + + public LogCommand() { + } + + @Override + public void execute() { + boolean current = HubActive.isHubActive(); + Logger.recordOutput("HubActive", current); + + if (current && !hubActive) { + Elastic.sendNotification(new Notification(NotificationLevel.INFO, "HUB ACTIVE", "")); + } else if (!current && hubActive) { + Elastic.sendNotification(new Notification(NotificationLevel.INFO, "HUB DEACTIVATED", "")); + } + + int x = 1/0; + + } + + @Override + public boolean runsWhenDisabled() { + return true; + } + + @Override + public boolean isFinished() { + return false; + } +} -- 2.39.5