From 29208aed2752bf8b0d42c117917bf0faf60a64a8 Mon Sep 17 00:00:00 2001 From: yamamara Date: Thu, 15 Aug 2024 00:31:30 -0400 Subject: [PATCH] Added "Set Zero" button to "Commands" Shuffleboard tab --- simgui.json | 1 + src/main/kotlin/com/team4099/robot2023/RobotContainer.kt | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/simgui.json b/simgui.json index c73084f6..ab9a410a 100644 --- a/simgui.json +++ b/simgui.json @@ -14,6 +14,7 @@ "NTProvider": { "types": { "/FMSInfo": "FMSInfo", + "/Shuffleboard/Commands/Set Zero": "Command", "/Shuffleboard/Pre-match/Alliance": "String Chooser", "/Shuffleboard/Pre-match/Mode": "String Chooser", "/SmartDashboard/AllianceColor": "String Chooser", diff --git a/src/main/kotlin/com/team4099/robot2023/RobotContainer.kt b/src/main/kotlin/com/team4099/robot2023/RobotContainer.kt index 401147b0..2ecdf05a 100644 --- a/src/main/kotlin/com/team4099/robot2023/RobotContainer.kt +++ b/src/main/kotlin/com/team4099/robot2023/RobotContainer.kt @@ -43,6 +43,8 @@ import com.team4099.robot2023.util.driver.Jessika import edu.wpi.first.wpilibj.AnalogInput import edu.wpi.first.wpilibj.DriverStation import edu.wpi.first.wpilibj.RobotBase +import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets +import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard import edu.wpi.first.wpilibj2.command.Command import edu.wpi.first.wpilibj2.command.Commands.runOnce import edu.wpi.first.wpilibj2.command.ParallelCommandGroup @@ -160,6 +162,13 @@ object RobotContainer { ) vision.drivetrainOdometry = { drivetrain.odomTRobot } limelight.poseSupplier = { drivetrain.odomTRobot } + + // TODO: Find a better way to implement this into Shuffleboard + Shuffleboard.getTab("Commands") + .add("Set Zero", SetZeroCommand(drivetrain) /* Command currently does nothing */) + .withSize(1, 1) + .withPosition(0, 0) + .withWidget(BuiltInWidgets.kCommand) } fun mapDefaultCommands() {