From c1eae1e68be01afd9d647fb3d08d852727e71784 Mon Sep 17 00:00:00 2001 From: Cayden Date: Thu, 7 Nov 2024 14:50:13 -0500 Subject: [PATCH] Added controls and shuffboard --- shuffleboard.json | 64 +++++++++++++++++++ src/main/java/frc/robot/RobotContainer.java | 29 ++++++++- .../java/frc/robot/constants/OIConstants.java | 8 +++ 3 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 shuffleboard.json create mode 100644 src/main/java/frc/robot/constants/OIConstants.java diff --git a/shuffleboard.json b/shuffleboard.json new file mode 100644 index 0000000..2fb2ceb --- /dev/null +++ b/shuffleboard.json @@ -0,0 +1,64 @@ +{ + "tabPane": [ + { + "title": "SmartDashboard", + "autoPopulate": true, + "autoPopulatePrefix": "SmartDashboard/", + "widgetPane": { + "gridSize": 128.0, + "showGrid": true, + "hgap": 16.0, + "vgap": 16.0, + "titleType": 0, + "tiles": {} + } + }, + { + "title": "LiveWindow", + "autoPopulate": true, + "autoPopulatePrefix": "LiveWindow/", + "widgetPane": { + "gridSize": 128.0, + "showGrid": true, + "hgap": 16.0, + "vgap": 16.0, + "titleType": 0, + "tiles": {} + } + }, + { + "title": " Sensor", + "autoPopulate": false, + "autoPopulatePrefix": "", + "widgetPane": { + "gridSize": 128.0, + "showGrid": true, + "hgap": 16.0, + "vgap": 16.0, + "titleType": 0, + "tiles": { + "0,0": { + "size": [ + 2, + 1 + ], + "content": { + "_type": "Boolean Box", + "_title": "Frisbee Presence Sensor", + "_glyph": 148, + "_showGlyph": false, + "Colors/Color when true": "#7CFC00FF", + "Colors/Color when false": "#8B0000FF" + } + } + } + } + } + ], + "windowGeometry": { + "x": -7.199999809265137, + "y": -7.199999809265137, + "width": 1550.4000244140625, + "height": 830.4000244140625 + } +} \ 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 de2c9d0..31f5853 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -6,15 +6,40 @@ package frc.robot; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Commands; +import edu.wpi.first.wpilibj2.command.button.CommandXboxController; +import frc.robot.constants.OIConstants; +import frc.robot.subsystems.Drivetrain; +import frc.robot.subsystems.Flicker; + public class RobotContainer { + private Flicker flicker; + private Drivetrain drivetrain; + private CommandXboxController driver; + private CommandXboxController operator; public RobotContainer() { + drivetrain = new Drivetrain(); + flicker = new Flicker(); + driver = new CommandXboxController(OIConstants.kDriverUSB); + configureBindings(); } - private void configureBindings() {} + private void configureBindings() { + drivetrain.setDefaultCommand( + drivetrain.driveArcade( + driver::getLeftY, + driver::getLeftX + ) + ); + flicker.setDefaultCommand(flicker.stop()); + driver.a().onTrue(flicker.setSpeed(() ->1)); + + + + } public Command getAutonomousCommand() { - return Commands.print("No autonomous command configured"); + return flicker.setSpeed(() -> 1); } } diff --git a/src/main/java/frc/robot/constants/OIConstants.java b/src/main/java/frc/robot/constants/OIConstants.java new file mode 100644 index 0000000..a606067 --- /dev/null +++ b/src/main/java/frc/robot/constants/OIConstants.java @@ -0,0 +1,8 @@ +package frc.robot.constants; + +public class OIConstants { + public static final int kDriverUSB = 0; + public static final int kOperatorUSB = 1; + + public static final String kRobotIndicatorsTabName = "Robot Indicators"; +} \ No newline at end of file