From 6abdf34cf055df17d33a5500ad5b9b1ff55abd4c Mon Sep 17 00:00:00 2001 From: OnDYCLaptop Date: Fri, 10 Jul 2026 11:35:22 +0800 Subject: [PATCH] =?UTF-8?q?7.10=E5=8D=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- elastic-layout-debug.json | 116 -- elastic-layout.json | 1582 ----------------- src/main/java/frc/robot/Constants.java | 23 +- src/main/java/frc/robot/RobotContainer.java | 4 +- .../robot/subsystems/LimelightSubsystem.java | 15 +- .../robot/subsystems/ShooterSubsystem.java | 36 +- .../frc/robot/subsystems/Superstructure.java | 1 - .../robot/tuning/ConfigTalonFXMotorTuner.java | 27 +- 8 files changed, 38 insertions(+), 1766 deletions(-) delete mode 100644 elastic-layout.json diff --git a/elastic-layout-debug.json b/elastic-layout-debug.json index ecd3264..8a09b7b 100644 --- a/elastic-layout-debug.json +++ b/elastic-layout-debug.json @@ -100,23 +100,6 @@ "false_icon": "None" } }, - { - "title": "Shooter At Voltage", - "x": 192.0, - "y": 128.0, - "width": 192.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/Superstructure/shooterAtVoltage", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, { "title": "Drive Aimed", "x": 384.0, @@ -292,37 +275,6 @@ "line_width": 2.0 } }, - { - "title": "Flywheel Target Voltage", - "x": 384.0, - "y": 0.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Shooter/flywheelTargetVoltage", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "Flywheel At Voltage", - "x": 640.0, - "y": 0.0, - "width": 256.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/Shooter/flywheelAtVoltage", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, { "title": "Flywheel Velocity Difference", "x": 384.0, @@ -1058,33 +1010,6 @@ "data_type": "boolean" } }, - { - "title": "Flywheel Run", - "x": 128.0, - "y": 192.0, - "width": 128.0, - "height": 128.0, - "type": "Toggle Switch", - "properties": { - "topic": "/Tuning/flywheel/flywheelEnableRunning", - "period": 0.06, - "data_type": "boolean" - } - }, - { - "title": "Flywheel Run Volts", - "x": 256.0, - "y": 192.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/flywheel/flywheelRunningVolts", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, { "title": "Shooter Conv Enable", "x": 0.0, @@ -1098,33 +1023,6 @@ "data_type": "boolean" } }, - { - "title": "Shooter Conv Run", - "x": 128.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Toggle Switch", - "properties": { - "topic": "/Tuning/conveyor/conveyorEnableRunning", - "period": 0.06, - "data_type": "boolean" - } - }, - { - "title": "Shooter Conv Run Volts", - "x": 256.0, - "y": 384.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/conveyor/conveyorRunningVolts", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, { "title": "Backboard Enable", "x": 0.0, @@ -2689,20 +2587,6 @@ "line_width": 2.0 } }, - { - "title": "Target Volts Estimate", - "x": 0.0, - "y": 1024.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Shooter/flywheelTargetVoltage", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, { "title": "Left Output Volts", "x": 256.0, diff --git a/elastic-layout.json b/elastic-layout.json deleted file mode 100644 index 6e653bb..0000000 --- a/elastic-layout.json +++ /dev/null @@ -1,1582 +0,0 @@ -{ - "version": 1.0, - "grid_size": 128, - "tabs": [ - { - "name": "Teleoperated", - "grid_layout": { - "layouts": [], - "containers": [ - { - "title": "Field", - "x": 768.0, - "y": 0.0, - "width": 768.0, - "height": 384.0, - "type": "Field", - "properties": { - "topic": "/SmartDashboard/Field", - "period": 0.06, - "field_game": "Reefscape", - "robot_width": 0.85, - "robot_length": 0.85, - "show_other_objects": true, - "show_trajectories": true, - "field_rotation": -180.0, - "robot_color": 4294198070, - "trajectory_color": 4294967295, - "show_robot_outside_widget": true - } - }, - { - "title": "IsFieldCentric", - "x": 1408.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/Drive/IsFieldCentric", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "autoRotationAvailable", - "x": 1152.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/AutoControl/autoRotationAvailable", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "MetaTag2Available", - "x": 1280.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/Positioning/MetaTag2Available", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "Auto Chooser", - "x": 768.0, - "y": 384.0, - "width": 384.0, - "height": 128.0, - "type": "ComboBox Chooser", - "properties": { - "topic": "/SmartDashboard/Auto Chooser", - "period": 0.06, - "sort_options": false - } - }, - { - "title": "HubActive", - "x": 0.0, - "y": 0.0, - "width": 256.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/GameData2026/HubActive", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "HubStatus", - "x": 256.0, - "y": 0.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/GameData2026/HubStatus", - "period": 0.06, - "data_type": "string", - "show_submit_button": false - } - }, - { - "title": "SecondsUntilHubOpens", - "x": 0.0, - "y": 128.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/GameData2026/SecondsUntilHubOpens", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "Shift", - "x": 256.0, - "y": 128.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/GameData2026/Shift", - "period": 0.06, - "data_type": "string", - "show_submit_button": false - } - }, - { - "title": "FirstInactiveAlliance", - "x": 0.0, - "y": 256.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/GameData2026/FirstInactiveAlliance", - "period": 0.06, - "data_type": "string", - "show_submit_button": false - } - }, - { - "title": "MatchTime", - "x": 256.0, - "y": 256.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/GameData2026/MatchTime", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - } - ] - } - }, - { - "name": "Autonomous", - "grid_layout": { - "layouts": [ - { - "title": "Drive", - "x": 640.0, - "y": 0.0, - "width": 256.0, - "height": 256.0, - "type": "List Layout", - "properties": { - "label_position": "TOP" - }, - "children": [ - { - "title": "IsFieldCentric", - "x": 0.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/SmartDashboard/Drive/IsFieldCentric", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "Mode", - "x": 0.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/Drive/Mode", - "period": 0.06, - "data_type": "string", - "show_submit_button": false - } - } - ] - } - ], - "containers": [ - { - "title": "limelight-zy", - "x": 896.0, - "y": 0.0, - "width": 640.0, - "height": 384.0, - "type": "Camera Stream", - "properties": { - "topic": "/CameraPublisher/limelight-zy", - "period": 0.06, - "rotation_turns": 0 - } - }, - { - "title": "MetaTag2Available", - "x": 384.0, - "y": 0.0, - "width": 256.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/SmartDashboard/MetaTag2Available", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "Current Pose X", - "x": 384.0, - "y": 256.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/Current Pose X", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "Current Pose Y", - "x": 384.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/Current Pose Y", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "MetaTag2 Pose X", - "x": 512.0, - "y": 256.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/MetaTag2 Pose X", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "MetaTag2 Pose Y", - "x": 512.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/MetaTag2 Pose Y", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "Pose Distance", - "x": 640.0, - "y": 256.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/Pose Distance", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "Rotation Difference", - "x": 640.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/Rotation Difference", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "Rotation Difference", - "x": 768.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/Rotation Difference", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "Angle Difference", - "x": 1152.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/Angle Difference", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "autoRotationAvailable", - "x": 640.0, - "y": 512.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/SmartDashboard/autoRotationAvailable", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "autoRotationRate", - "x": 768.0, - "y": 512.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/autoRotationRate", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - } - ] - } - }, - { - "name": "MetaTagPositioning", - "grid_layout": { - "layouts": [], - "containers": [ - { - "title": "CurrentPoseX", - "x": 0.0, - "y": 0.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/CurrentPoseX", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "CurrentPoseY", - "x": 256.0, - "y": 0.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/CurrentPoseY", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "MetaTag2PoseX", - "x": 0.0, - "y": 128.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/MetaTag2PoseX", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "MetaTag2PoseY", - "x": 256.0, - "y": 128.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/MetaTag2PoseY", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "PoseDistance", - "x": 0.0, - "y": 256.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/PoseDistance", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "RotationDifference", - "x": 256.0, - "y": 256.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/RotationDifference", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "MetaTag2Available", - "x": 512.0, - "y": 0.0, - "width": 256.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/Positioning/MetaTag2Available", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "Field", - "x": 768.0, - "y": 0.0, - "width": 768.0, - "height": 384.0, - "type": "Field", - "properties": { - "topic": "/SmartDashboard/Field", - "period": 0.06, - "field_game": "Reefscape", - "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": "autoRotationAvailable", - "x": 512.0, - "y": 384.0, - "width": 256.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/AutoControl/autoRotationAvailable", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "AngleDifference", - "x": 0.0, - "y": 512.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/AutoControl/AngleDifference", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "CalculatedDifference", - "x": 256.0, - "y": 512.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/AutoControl/CalculatedDifference", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "CurrentAngle", - "x": 0.0, - "y": 384.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/AutoControl/CurrentAngle", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "TargetAngle", - "x": 256.0, - "y": 384.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/AutoControl/TargetAngle", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - }, - { - "title": "autoRotationRate", - "x": 512.0, - "y": 512.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/AutoControl/autoRotationRate", - "period": 0.06, - "data_type": "double", - "show_submit_button": false - } - } - ] - } - }, - { - "name": "PID", - "grid_layout": { - "layouts": [], - "containers": [ - { - "title": "backboardEnable", - "x": 128.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Toggle Switch", - "properties": { - "topic": "/Tuning/backboard/backboardEnable", - "period": 0.06, - "data_type": "boolean" - } - }, - { - "title": "backboardEnableRunning", - "x": 256.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Toggle Switch", - "properties": { - "topic": "/Tuning/backboard/backboardEnableRunning", - "period": 0.06, - "data_type": "boolean" - } - }, - { - "title": "backboardkA", - "x": 256.0, - "y": 256.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/backboard/backboardkA", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "backboardkP", - "x": 128.0, - "y": 128.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/backboard/backboardkP", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "backboardkS", - "x": 256.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/backboard/backboardkS", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "backboardkV", - "x": 256.0, - "y": 128.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/backboard/backboardkV", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "backboardkI", - "x": 128.0, - "y": 256.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/backboard/backboardkI", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "backboardkD", - "x": 128.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/backboard/backboardkD", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "backboardRunningSpeedRPS", - "x": 384.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/backboard/backboardRunningSpeedRPS", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "flywheelEnableRunning", - "x": 896.0, - "y": 0.0, - "width": 256.0, - "height": 128.0, - "type": "Toggle Switch", - "properties": { - "topic": "/Tuning/flywheel/flywheelEnableRunning", - "period": 0.06, - "data_type": "boolean" - } - }, - { - "title": "flywheelRunningVolts", - "x": 640.0, - "y": 128.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/flywheel/flywheelRunningVolts", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "flywheelEnable", - "x": 640.0, - "y": 0.0, - "width": 256.0, - "height": 128.0, - "type": "Toggle Switch", - "properties": { - "topic": "/Tuning/flywheel/flywheelEnable", - "period": 0.06, - "data_type": "boolean" - } - }, - { - "title": "flywheelkV", - "x": 640.0, - "y": 256.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/flywheel/flywheelkV", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "flywheelkS", - "x": 640.0, - "y": 384.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/flywheel/flywheelkS", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "flywheelkA", - "x": 640.0, - "y": 512.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Tuning/flywheel/flywheelkA", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - } - ] - } - }, - { - "name": "Limelights", - "grid_layout": { - "layouts": [], - "containers": [ - { - "title": "limelight-front", - "x": 0.0, - "y": 0.0, - "width": 256.0, - "height": 256.0, - "type": "Camera Stream", - "properties": { - "topic": "/CameraPublisher/limelight-front", - "period": 0.06, - "rotation_turns": 0 - } - }, - { - "title": "limelight-left", - "x": 768.0, - "y": 512.0, - "width": 640.0, - "height": 384.0, - "type": "Camera Stream", - "properties": { - "topic": "/CameraPublisher/limelight-left", - "period": 0.06, - "rotation_turns": 0 - } - }, - { - "title": "MetaTag2Available", - "x": 1408.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/Positioning/MetaTag2Available", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "Usingll", - "x": 1152.0, - "y": 256.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/Usingll", - "period": 0.06, - "data_type": "string", - "show_submit_button": true - } - }, - { - "title": "available", - "x": 256.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/Positioning/limelight-front/available", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "available", - "x": 640.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/Positioning/limelight-left/available", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "PositioningIntakerll", - "x": 0.0, - "y": 256.0, - "width": 384.0, - "height": 256.0, - "type": "Field", - "properties": { - "topic": "/SmartDashboard/PositioningIntakerll", - "period": 0.06, - "field_game": "Rebuilt", - "robot_width": 0.85, - "robot_length": 0.85, - "show_other_objects": true, - "show_trajectories": true, - "field_rotation": 180.0, - "robot_color": 4294198070, - "trajectory_color": 4294967295, - "show_robot_outside_widget": true - } - }, - { - "title": "PositioningShooterll", - "x": 384.0, - "y": 256.0, - "width": 384.0, - "height": 256.0, - "type": "Field", - "properties": { - "topic": "/SmartDashboard/PositioningShooterll", - "period": 0.06, - "field_game": "Rebuilt", - "robot_width": 0.85, - "robot_length": 0.85, - "show_other_objects": true, - "show_trajectories": true, - "field_rotation": 180.0, - "robot_color": 4294198070, - "trajectory_color": 4294967295, - "show_robot_outside_widget": true - } - }, - { - "title": "Field", - "x": 768.0, - "y": 256.0, - "width": 384.0, - "height": 256.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": 180.0, - "robot_color": 4294198070, - "trajectory_color": 4294967295, - "show_robot_outside_widget": true - } - }, - { - "title": "CurrentPoseX", - "x": 1152.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/CurrentPoseX", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "CurrentPoseY", - "x": 1280.0, - "y": 384.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/CurrentPoseY", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "Distance", - "x": 256.0, - "y": 128.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/limelight-front/Distance", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "MetaTag2DistanceDifference", - "x": 768.0, - "y": 0.0, - "width": 256.0, - "height": 256.0, - "type": "Graph", - "properties": { - "topic": "/Positioning/MetaTag2DistanceDifference", - "period": 0.033, - "data_type": "double", - "time_displayed": 5.0, - "color": 4278238420, - "line_width": 2.0 - } - }, - { - "title": "Distance", - "x": 640.0, - "y": 128.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/limelight-left/Distance", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "MetaTag2XDifference", - "x": 1024.0, - "y": 0.0, - "width": 256.0, - "height": 256.0, - "type": "Graph", - "properties": { - "topic": "/Positioning/MetaTag2XDifference", - "period": 0.033, - "data_type": "double", - "time_displayed": 5.0, - "color": 4278238420, - "line_width": 2.0 - } - }, - { - "title": "MetaTag2YDifference", - "x": 1280.0, - "y": 0.0, - "width": 256.0, - "height": 256.0, - "type": "Graph", - "properties": { - "topic": "/Positioning/MetaTag2YDifference", - "period": 0.033, - "data_type": "double", - "time_displayed": 5.0, - "color": 4278238420, - "line_width": 2.0 - } - }, - { - "title": "Robot", - "x": 0.0, - "y": 512.0, - "width": 384.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/PositioningIntakerll/Robot", - "period": 0.06, - "data_type": "double[]", - "show_submit_button": true - } - }, - { - "title": "Robot", - "x": 384.0, - "y": 512.0, - "width": 384.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/PositioningShooterll/Robot", - "period": 0.06, - "data_type": "double[]", - "show_submit_button": true - } - }, - { - "title": "X", - "x": 0.0, - "y": 640.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/limelight-front/X", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "Y", - "x": 128.0, - "y": 640.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/limelight-front/Y", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "X", - "x": 384.0, - "y": 640.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/limelight-left/X", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "Y", - "x": 512.0, - "y": 640.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/limelight-left/Y", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - } - ] - } - }, - { - "name": "Shooter", - "grid_layout": { - "layouts": [], - "containers": [ - { - "title": "limelight-left", - "x": 1152.0, - "y": 0.0, - "width": 384.0, - "height": 256.0, - "type": "Camera Stream", - "properties": { - "topic": "/CameraPublisher/limelight-left", - "period": 0.06, - "rotation_turns": 0 - } - }, - { - "title": "backboardCurrentRate", - "x": 896.0, - "y": 0.0, - "width": 256.0, - "height": 256.0, - "type": "Graph", - "properties": { - "topic": "/Shooter/backboardCurrentRate", - "period": 0.033, - "data_type": "double", - "time_displayed": 5.0, - "color": 4278238420, - "line_width": 2.0 - } - }, - { - "title": "conveyorVelocity", - "x": 384.0, - "y": 256.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Shooter/conveyorVelocity", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "distanceGetted", - "x": 0.0, - "y": 0.0, - "width": 384.0, - "height": 256.0, - "type": "Graph", - "properties": { - "topic": "/Shooter/distanceGetted", - "period": 0.033, - "data_type": "double", - "time_displayed": 5.0, - "color": 4278238420, - "line_width": 2.0 - } - }, - { - "title": "isBackboardAtTarget", - "x": 896.0, - "y": 640.0, - "width": 256.0, - "height": 128.0, - "type": "Boolean Box", - "properties": { - "topic": "/Shooter/isBackboardAtTarget", - "period": 0.06, - "data_type": "boolean", - "true_color": 4283215696, - "false_color": 4294198070, - "true_icon": "None", - "false_icon": "None" - } - }, - { - "title": "flywheelVelocity", - "x": 640.0, - "y": 0.0, - "width": 256.0, - "height": 256.0, - "type": "Graph", - "properties": { - "topic": "/Shooter/flywheelVelocity", - "period": 0.033, - "data_type": "double", - "time_displayed": 5.0, - "color": 4278238420, - "line_width": 2.0 - } - }, - { - "title": "Field", - "x": 1152.0, - "y": 256.0, - "width": 384.0, - "height": 256.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": 180.0, - "robot_color": 4294198070, - "trajectory_color": 4294967295, - "show_robot_outside_widget": true - } - }, - { - "title": "distanceGetted", - "x": 0.0, - "y": 256.0, - "width": 384.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Shooter/distanceGetted", - "period": 0.033, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "conveyorVelocity", - "x": 384.0, - "y": 0.0, - "width": 256.0, - "height": 256.0, - "type": "Graph", - "properties": { - "topic": "/Shooter/conveyorVelocity", - "period": 0.033, - "data_type": "double", - "time_displayed": 5.0, - "color": 4278238420, - "line_width": 2.0 - } - }, - { - "title": "flywheelVelocity", - "x": 640.0, - "y": 256.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Shooter/flywheelVelocity", - "period": 0.033, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "backboardCurrentRate", - "x": 896.0, - "y": 256.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Shooter/backboardCurrentRate", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "backboardTargetPosition", - "x": 1024.0, - "y": 256.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/ShooterControl/backboardTargetPosition", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "flywheelTargetVoltage", - "x": 768.0, - "y": 256.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Shooter/flywheelTargetVoltage", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "conveyerTargetSpeed", - "x": 512.0, - "y": 256.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/ShooterControl/conveyerTargetSpeed", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "conveyerTargetSpeed", - "x": 384.0, - "y": 384.0, - "width": 256.0, - "height": 256.0, - "type": "Graph", - "properties": { - "topic": "/ShooterControl/conveyerTargetSpeed", - "period": 0.033, - "data_type": "double", - "time_displayed": 5.0, - "color": 4278238420, - "line_width": 2.0 - } - }, - { - "title": "flywheelTargetVoltage", - "x": 640.0, - "y": 384.0, - "width": 256.0, - "height": 256.0, - "type": "Graph", - "properties": { - "topic": "/Shooter/flywheelTargetVoltage", - "period": 0.033, - "data_type": "double", - "time_displayed": 5.0, - "color": 4278238420, - "line_width": 2.0 - } - }, - { - "title": "backboardTargetPosition", - "x": 896.0, - "y": 384.0, - "width": 256.0, - "height": 256.0, - "type": "Graph", - "properties": { - "topic": "/ShooterControl/backboardTargetPosition", - "period": 0.033, - "data_type": "double", - "time_displayed": 5.0, - "color": 4278238420, - "line_width": 2.0 - } - }, - { - "title": "Usingll", - "x": 1152.0, - "y": 512.0, - "width": 384.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/Positioning/Usingll", - "period": 0.06, - "data_type": "string", - "show_submit_button": true - } - }, - { - "title": "robotStatus", - "x": 0.0, - "y": 512.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/robotStatus", - "period": 0.06, - "data_type": "string", - "show_submit_button": true - } - } - ] - } - }, - { - "name": "Tab 7", - "grid_layout": { - "layouts": [], - "containers": [ - { - "title": "ActualVOmega", - "x": 256.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/AutoControl/ActualVOmega", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "ActualVX", - "x": 0.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/AutoControl/ActualVX", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "ActualVY", - "x": 128.0, - "y": 0.0, - "width": 128.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/AutoControl/ActualVY", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "BumpDifference", - "x": 384.0, - "y": 128.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/AutoControl/BumpDifference", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "TrenchDifference", - "x": 384.0, - "y": 256.0, - "width": 256.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/AutoControl/TrenchDifference", - "period": 0.06, - "data_type": "double", - "show_submit_button": true - } - }, - { - "title": "robotStatus", - "x": 0.0, - "y": 256.0, - "width": 384.0, - "height": 128.0, - "type": "Text Display", - "properties": { - "topic": "/SmartDashboard/robotStatus", - "period": 0.06, - "data_type": "string", - "show_submit_button": true - } - } - ] - } - } - ] -} diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 56f71f8..f8026fc 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -11,7 +11,7 @@ public final class Constants { public static final boolean LEDUsing = false; public static class Shooter { - // 机构 CAN ID 目前是占位值;季后赛最终接线确认后,只需要改这里。 + // Placeholder mechanism CAN IDs; update here after final wiring. public static final int leftFlywheelID = 38; public static final int rightFlywheelID = 39; public static final int leftConveyorID = 40; @@ -26,16 +26,7 @@ public final class Constants { public static final double flywheelReadyVelocityTolerance = 2.0; public static final double flywheelReadyDelaySeconds = 0.5; - // 距离(米) -> 飞轮电压(V) 射表。当前为占位点; - // 真车试射后按实测数据加点即可,查表自动线性插值并在两端取边界值。 - public static final InterpolatingDoubleTreeMap flywheelVoltageByDistance = new InterpolatingDoubleTreeMap(); - static { - flywheelVoltageByDistance.put(1.2, 2.0); - flywheelVoltageByDistance.put(2.5, 2.1); - flywheelVoltageByDistance.put(3.5, 2.2); - flywheelVoltageByDistance.put(5.0, 2.3); - } - + // Distance (meters) -> flywheel velocity (rotations per second). public static final InterpolatingDoubleTreeMap flywheelVelocityByDistance = new InterpolatingDoubleTreeMap(); static { flywheelVelocityByDistance.put(1.2, 2.0 / flywheelNominalKv); @@ -140,7 +131,7 @@ public final class Constants { } public static class Intaker { - // 进球机构 CAN ID 同样是占位值,真实 ID 确认后集中在这里修改。 + // Placeholder intake CAN IDs; update here after wiring is confirmed. public static final int leftIntakeRollerID = 20; public static final int rightIntakeRollerID = 47; public static final int leftIntakeRotaterID = 48; @@ -162,7 +153,7 @@ public final class Constants { .withKV(0.00).withKA(0.00).withKS(0.00); public static final double IntakeGetterSpeedforAuto = 0.5; - // 这里给出可用的占位值,真车调好位置闭环后再收紧。 + // Placeholder values; tighten after the real mechanism is tuned. } public static class Conveyor { @@ -176,7 +167,7 @@ public final class Constants { } public static class Superstructure { - // 状态机时间和门控容差。真车基础动作验证后,需要现场调这些值。 + // State-machine timing and gate tolerances; tune on the real robot. public static final double shooterFeedVoltage = Shooter.shooterConveyorFeedVoltage; public static final double shooterReverseVoltage = Shooter.shooterConveyorReverseVoltage; public static final double shooterFeedVelocity = Shooter.shooterConveyorFeedVelocity; @@ -188,10 +179,10 @@ public final class Constants { public static final double passBallFlywheelVelocity = Shooter.defaultFlywheelVelocity; public static final double passBallBackboardPosition = 175.0; - // 射击时背板的目标位置(外接编码器计数)。 + // Shoot backboard target position in external encoder counts. public static final double backboardShootPosition = 175.0; public static final double backboardReadyPositionTolerance = 100.0; - // 射击门控是否要求底盘接近静止。 + // Whether the shooting gate requires the drivetrain to be nearly still. public static final boolean stationaryGateEnabled = true; } } diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 7755ec3..3077066 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -77,9 +77,9 @@ public class RobotContainer { private final DriveGainsTuner driveGainsTuner = new DriveGainsTuner(drivetrain); private final GameData2026 gameData2026 = new GameData2026(); private ConfigTalonFXMotorTuner configFlywheelTuner = - new ConfigTalonFXMotorTuner(shooterSubsystem.leftFlywheel, "flywheel", Constants.Shooter.flyWheelSlot0Configs); + new ConfigTalonFXMotorTuner(shooterSubsystem.leftFlywheel, "flywheel", Constants.Shooter.flyWheelSlot0Configs, false); private ConfigTalonFXMotorTuner configConveyorTuner = - new ConfigTalonFXMotorTuner(shooterSubsystem.leftConveyor, "conveyor", Constants.Shooter.conveyorSlot0Configs); + new ConfigTalonFXMotorTuner(shooterSubsystem.leftConveyor, "conveyor", Constants.Shooter.conveyorSlot0Configs, false); private ConfigTalonFXSMotorTuner configBackboardTuner = new ConfigTalonFXSMotorTuner(shooterSubsystem.backboardMotor, "backboard", Constants.Shooter.backboardSlot0Configs); private ConfigTalonFXMotorTuner configMainConveyorTuner = diff --git a/src/main/java/frc/robot/subsystems/LimelightSubsystem.java b/src/main/java/frc/robot/subsystems/LimelightSubsystem.java index c118983..2679c07 100644 --- a/src/main/java/frc/robot/subsystems/LimelightSubsystem.java +++ b/src/main/java/frc/robot/subsystems/LimelightSubsystem.java @@ -6,10 +6,10 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.Constants; /** - * 对现有 LimelightHelpers 的薄只读封装。 + * Thin read-only wrapper around the existing LimelightHelpers. * - * 本类不做视觉融合,也不控制任何机构;只给 Superstructure 提供稳定的 - * 目标和距离读取接口。 + * This subsystem does not fuse vision or command mechanisms; it only gives + * Superstructure stable target and distance read APIs. */ public class LimelightSubsystem extends SubsystemBase { private final String limelightName; @@ -35,8 +35,8 @@ public class LimelightSubsystem extends SubsystemBase { } public double getDistanceToTarget() { - // DriveControls 已经把基于场地位姿计算的距离发布到 AutoControl; - // 这里复用该值,保留旧定位和目标计算逻辑。 + // DriveControls publishes the field-pose distance under AutoControl. + // Reuse that value to preserve the existing target calculation path. return NetworkTableInstance.getDefault() .getTable("AutoControl") .getEntry("distanceToHub") @@ -47,11 +47,6 @@ public class LimelightSubsystem extends SubsystemBase { return LimelightHelpers.getBotPoseEstimate_wpiBlue_MegaTag2(limelightName).pose; } - public double getShooterVoltageByDistance() { - // 查 Constants 里的插值射表;真车试射后往表里加实测点即可。 - return Constants.Shooter.flywheelVoltageByDistance.get(getDistanceToTarget()); - } - public double getShooterVelocityByDistance() { return Constants.Shooter.flywheelVelocityByDistance.get(getDistanceToTarget()); } diff --git a/src/main/java/frc/robot/subsystems/ShooterSubsystem.java b/src/main/java/frc/robot/subsystems/ShooterSubsystem.java index 82bf278..424f9be 100644 --- a/src/main/java/frc/robot/subsystems/ShooterSubsystem.java +++ b/src/main/java/frc/robot/subsystems/ShooterSubsystem.java @@ -136,11 +136,6 @@ public class ShooterSubsystem extends SubsystemBase { rightFlywheel.getConfigurator().apply(configs); } - public void setFlywheelVoltage(double outputVolts) { - double clampedOutputVolts = MathUtil.clamp(outputVolts, -12.0, 12.0); - setFlywheelVelocity(clampedOutputVolts / Constants.Shooter.flywheelNominalKv); - } - public void setFlywheelVelocity(double targetVelocityRps) { double clampedTargetVelocity = MathUtil.clamp( targetVelocityRps, @@ -155,15 +150,6 @@ public class ShooterSubsystem extends SubsystemBase { setRightFlywheelFollowLeft(); } - public void setFlywheelVoltageByDistance(double distance) { - setFlywheelVelocityByDistance(distance); - } - - public void setFlywheelVelocityByDistance(double distance) { - double targetVelocity = Constants.Shooter.flywheelVelocityByDistance.get(distance); - setFlywheelVelocity(targetVelocity); - } - public void stopFlywheel() { setFlywheelVelocity(0.0); } @@ -181,9 +167,6 @@ public class ShooterSubsystem extends SubsystemBase { >= Constants.Shooter.flywheelReadyDelaySeconds; } - public boolean atVoltage() { - return atVelocity(); - } public double getLeftFlywheelVelocity() { return leftFlywheel.getVelocity().getValueAsDouble(); } @@ -208,10 +191,6 @@ public class ShooterSubsystem extends SubsystemBase { return Math.abs(flywheelTargetVelocity) - getAverageFlywheelVelocity(); } - public double getTargetFlywheelVoltage() { - return flywheelTargetVelocity * Constants.Shooter.flywheelNominalKv; - } - /* ====================== */ /* shooter conveyor */ /* ====================== */ @@ -226,11 +205,6 @@ public class ShooterSubsystem extends SubsystemBase { setRightConveyorFollowLeft(); } - public void runShooterConveyorVoltage(double outputVolts) { - double clampedOutputVolts = MathUtil.clamp(outputVolts, -12.0, 12.0); - runShooterConveyorVelocity(clampedOutputVolts / Constants.Shooter.shooterConveyorNominalKv); - } - public void stopShooterConveyor() { runShooterConveyorVelocity(0.0); } @@ -369,17 +343,13 @@ public class ShooterSubsystem extends SubsystemBase { } public boolean isFlywheelTuningControlActive() { - boolean voltageTunerEnabled = flywheelTuningTable.getEntry("flywheelEnable").getBoolean(false); - boolean voltageTunerRunning = flywheelTuningTable.getEntry("flywheelEnableRunning").getBoolean(false); boolean velocityTunerEnabled = flywheelTuningTable.getEntry("flywheelVelocityEnable").getBoolean(false); - return (voltageTunerEnabled && voltageTunerRunning) || velocityTunerEnabled; + return velocityTunerEnabled; } public boolean isShooterConveyorTuningControlActive() { - boolean voltageTunerEnabled = conveyorTuningTable.getEntry("conveyorEnable").getBoolean(false); - boolean voltageTunerRunning = conveyorTuningTable.getEntry("conveyorEnableRunning").getBoolean(false); boolean velocityTunerEnabled = conveyorTuningTable.getEntry("conveyorVelocityEnable").getBoolean(false); - return (voltageTunerEnabled && voltageTunerRunning) || velocityTunerEnabled; + return velocityTunerEnabled; } public void resetbackboardencoder() { @@ -490,9 +460,7 @@ public class ShooterSubsystem extends SubsystemBase { shooterNetworkTable.getEntry("flywheelAtVelocity").setBoolean(atVelocity()); shooterNetworkTable.getEntry("flywheelVelocityTuningActive").setBoolean(flywheelVelocityTuningActive); shooterNetworkTable.getEntry("flywheelFollowerOpposed").setBoolean(true); - shooterNetworkTable.getEntry("flywheelTargetVoltage").setDouble(getTargetFlywheelVoltage()); shooterNetworkTable.getEntry("flywheelOutputVolts").setDouble(flywheelOutputVolts); - shooterNetworkTable.getEntry("flywheelAtVoltage").setBoolean(atVoltage()); shooterNetworkTable.getEntry("leftFlywheelOutputVolts").setDouble(leftFlywheel.getMotorVoltage().getValueAsDouble()); shooterNetworkTable.getEntry("rightFlywheelOutputVolts").setDouble(rightFlywheel.getMotorVoltage().getValueAsDouble()); shooterNetworkTable.getEntry("leftFlywheelStatorCurrent").setDouble(leftFlywheel.getStatorCurrent().getValueAsDouble()); diff --git a/src/main/java/frc/robot/subsystems/Superstructure.java b/src/main/java/frc/robot/subsystems/Superstructure.java index 584036d..9d424d3 100644 --- a/src/main/java/frc/robot/subsystems/Superstructure.java +++ b/src/main/java/frc/robot/subsystems/Superstructure.java @@ -396,7 +396,6 @@ public class Superstructure extends SubsystemBase { table.getEntry("timeInState").setDouble(timeInState()); table.getEntry("canShoot").setBoolean(canShoot()); table.getEntry("shooterAtVelocity").setBoolean(shooter.atVelocity()); - table.getEntry("shooterAtVoltage").setBoolean(shooter.atVoltage()); table.getEntry("driveAimed").setBoolean(drive.isAimed()); table.getEntry("driveHeadingError").setDouble(drive.getHeadingError()); table.getEntry("driveStationary").setBoolean(isDriveStationary()); diff --git a/src/main/java/frc/robot/tuning/ConfigTalonFXMotorTuner.java b/src/main/java/frc/robot/tuning/ConfigTalonFXMotorTuner.java index 825a176..2006905 100644 --- a/src/main/java/frc/robot/tuning/ConfigTalonFXMotorTuner.java +++ b/src/main/java/frc/robot/tuning/ConfigTalonFXMotorTuner.java @@ -10,6 +10,7 @@ public class ConfigTalonFXMotorTuner { private final String motorName; private final Slot0Configs motorSlot0Configs; private final NetworkTable table; + private final boolean voltageRunEnabled; // ---- Subscribers:读取 Elastic 改过的新值 ---- private final BooleanSubscriber enableSub; @@ -27,9 +28,19 @@ public class ConfigTalonFXMotorTuner { private final VoltageOut voltageRequest = new VoltageOut(0); public ConfigTalonFXMotorTuner(TalonFX motor_, String motorName_, Slot0Configs motorSlot0Configs_) { + this(motor_, motorName_, motorSlot0Configs_, true); + } + + public ConfigTalonFXMotorTuner( + TalonFX motor_, + String motorName_, + Slot0Configs motorSlot0Configs_, + boolean voltageRunEnabled_ + ) { this.motor = motor_; this.motorName = motorName_; this.motorSlot0Configs = motorSlot0Configs_; + this.voltageRunEnabled = voltageRunEnabled_; this.table = NetworkTableInstance.getDefault().getTable("Tuning/" + motorName); @@ -41,8 +52,10 @@ public class ConfigTalonFXMotorTuner { table.getDoubleTopic(motorName+"kA").publish().set(motorSlot0Configs.kA); table.getDoubleTopic(motorName+"kS").publish().set(motorSlot0Configs.kS); - table.getBooleanTopic(motorName+"EnableRunning").publish().set(false);; - table.getDoubleTopic(motorName+"RunningVolts").publish().set(0);; + if (voltageRunEnabled) { + table.getBooleanTopic(motorName+"EnableRunning").publish().set(false);; + table.getDoubleTopic(motorName+"RunningVolts").publish().set(0);; + } this.enableSub = table.getBooleanTopic(motorName+"Enable").subscribe(false); this.KpSub = table.getDoubleTopic(motorName+"kP").subscribe(motorSlot0Configs.kP); @@ -51,8 +64,12 @@ public class ConfigTalonFXMotorTuner { this.KvSub = table.getDoubleTopic(motorName+"kV").subscribe(motorSlot0Configs.kV); this.KaSub = table.getDoubleTopic(motorName+"kA").subscribe(motorSlot0Configs.kA); this.KsSub = table.getDoubleTopic(motorName+"kS").subscribe(motorSlot0Configs.kS); - this.enableRuningSub = table.getBooleanTopic(motorName+"EnableRunning").subscribe(false); - this.runningVolts = table.getDoubleTopic(motorName+"RunningVolts").subscribe(0); + this.enableRuningSub = voltageRunEnabled + ? table.getBooleanTopic(motorName+"EnableRunning").subscribe(false) + : null; + this.runningVolts = voltageRunEnabled + ? table.getDoubleTopic(motorName+"RunningVolts").subscribe(0) + : null; } public void periodic(Runnable func) { @@ -79,7 +96,7 @@ public class ConfigTalonFXMotorTuner { } } - if (enableRuningSub.get()) {; + if (voltageRunEnabled && enableRuningSub.get()) {; double volts = MathUtil.clamp(runningVolts.get(), -12.0, 12.0); motor.setControl(voltageRequest.withOutput(volts)); wasRunning = true;