]> git.taranathan.com Git - FRC2026.git/commitdiff
autos
authoreileha <eileenhan369@gmail.com>
Thu, 12 Feb 2026 00:30:25 +0000 (16:30 -0800)
committereileha <eileenhan369@gmail.com>
Thu, 12 Feb 2026 00:30:25 +0000 (16:30 -0800)
simgui-ds.json [new file with mode: 0644]
src/main/java/frc/robot/Robot.java
src/main/java/frc/robot/RobotContainer.java

diff --git a/simgui-ds.json b/simgui-ds.json
new file mode 100644 (file)
index 0000000..73cc713
--- /dev/null
@@ -0,0 +1,92 @@
+{
+  "keyboardJoysticks": [
+    {
+      "axisConfig": [
+        {
+          "decKey": 65,
+          "incKey": 68
+        },
+        {
+          "decKey": 87,
+          "incKey": 83
+        },
+        {
+          "decKey": 69,
+          "decayRate": 0.0,
+          "incKey": 82,
+          "keyRate": 0.009999999776482582
+        }
+      ],
+      "axisCount": 3,
+      "buttonCount": 4,
+      "buttonKeys": [
+        90,
+        88,
+        67,
+        86
+      ],
+      "povConfig": [
+        {
+          "key0": 328,
+          "key135": 323,
+          "key180": 322,
+          "key225": 321,
+          "key270": 324,
+          "key315": 327,
+          "key45": 329,
+          "key90": 326
+        }
+      ],
+      "povCount": 1
+    },
+    {
+      "axisConfig": [
+        {
+          "decKey": 74,
+          "incKey": 76
+        },
+        {
+          "decKey": 73,
+          "incKey": 75
+        }
+      ],
+      "axisCount": 2,
+      "buttonCount": 4,
+      "buttonKeys": [
+        77,
+        44,
+        46,
+        47
+      ],
+      "povCount": 0
+    },
+    {
+      "axisConfig": [
+        {
+          "decKey": 263,
+          "incKey": 262
+        },
+        {
+          "decKey": 265,
+          "incKey": 264
+        }
+      ],
+      "axisCount": 2,
+      "buttonCount": 6,
+      "buttonKeys": [
+        260,
+        268,
+        266,
+        261,
+        269,
+        267
+      ],
+      "povCount": 0
+    },
+    {
+      "axisCount": 0,
+      "buttonCount": 0,
+      "povCount": 0
+    }
+  ]
+}
index ac05b79dfbd810b64d3f0783610749c325b1c640..18e51d0293036f34e24eb3e0f2b52aaabc3f321a 100644 (file)
@@ -18,6 +18,7 @@ import edu.wpi.first.net.PortForwarder;
 import edu.wpi.first.wpilibj.DriverStation;
 import edu.wpi.first.wpilibj.DriverStation.Alliance;
 import edu.wpi.first.wpilibj.RobotController;
+import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
 import edu.wpi.first.wpilibj2.command.Command;
 import edu.wpi.first.wpilibj2.command.CommandScheduler;
 import frc.robot.constants.Constants;
@@ -40,6 +41,9 @@ public class Robot extends LoggedRobot {
         PortForwarder.add(5800,"10.9.72.12",5800);
         PortForwarder.add(1182,"10.9.72.12",1182);
 
+        // Adding auto options on to SendableChooser on SmartDashboard
+       
+
         // Set up data receivers & replay source
         switch (Constants.CURRENT_MODE) {
             case REAL:
@@ -75,11 +79,13 @@ public class Robot extends LoggedRobot {
         //     changes networktables.json, networktables.json.bck (both Untracked)
         //   Uncomment the next line, set the desired RobotId, deploy, and then comment the line out
         //  RobotId.setRobotId(RobotId.SwerveCompetition);
-        DriveConstants.update(RobotId.getRobotId());
+        
         RobotController.setBrownoutVoltage(6.0);
         // obtain this robot's identity
         RobotId robotId = RobotId.getRobotId();
 
+        DriveConstants.update(robotId);
+
         // Record metadata
         Logger.recordMetadata("ProjectName", BuildData.MAVEN_NAME);
         Logger.recordMetadata("BuildDate", BuildData.BUILD_DATE);
index 86104d20bf0f26e7b7827ac032d64247207ea9a4..4e4abc27979bf34aa52badc9c24c1b6ec9826fae 100644 (file)
@@ -7,14 +7,17 @@ import org.json.simple.parser.ParseException;
 import org.littletonrobotics.junction.Logger;
 
 import com.pathplanner.lib.auto.AutoBuilder;
+import com.pathplanner.lib.auto.NamedCommands;
 import com.pathplanner.lib.commands.PathPlannerAuto;
 
 import edu.wpi.first.math.geometry.Pose3d;
 import edu.wpi.first.wpilibj.DriverStation;
 import edu.wpi.first.wpilibj.RobotController;
 import edu.wpi.first.wpilibj.livewindow.LiveWindow;
+import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
 import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
 import edu.wpi.first.wpilibj2.command.Command;
+import edu.wpi.first.wpilibj2.command.InstantCommand;
 import frc.robot.commands.DoNothing;
 import frc.robot.commands.drive_comm.DefaultDriveCommand;
 import frc.robot.commands.vision.ShutdownAllPis;
@@ -49,12 +52,22 @@ public class RobotContainer {
   private BaseDriverConfig driver = null;
   private Operator operator = null;
 
+  // Auto
+  private final SendableChooser<Command> autoChooser = new SendableChooser<>();
+  private Command autoSelected;
+
   /**
    * The container for the robot. Contains subsystems, OI devices, and commands.
    * <p>
    * Different robots may have different subsystems.
    */
   public RobotContainer(RobotId robotId) {
+    // display the current robot id on smartdashboard
+    SmartDashboard.putString("RobotID", robotId.toString());
+
+    // Filling the SendableChooser on SmartDashboard
+    chooserInit();
+
     // dispatch on the robot
     switch (robotId) {
       case TestBed1:
@@ -117,6 +130,14 @@ public class RobotContainer {
     SmartDashboard.putData("Shutdown Orange Pis", new ShutdownAllPis());
   }
 
+  public void chooserInit(){
+    autoChooser.setDefaultOption("Do nothing", new DoNothing());
+    autoChooser.addOption("Do nada", new DoNothing());
+    autoChooser.addOption("Spin my wheels", new DoNothing());
+    autoChooser.addOption("Hello world", new InstantCommand(() -> System.out.println("Hello world")));
+    SmartDashboard.putData("Auto chooser", autoChooser);
+  }
+
   /**
    * Sets whether the drivetrain uses vision toupdate odometry
    */
@@ -144,7 +165,6 @@ public class RobotContainer {
   }
 
   public void registerCommands() {
-
   }
 
   public static BooleanSupplier getAllianceColorBooleanSupplier() {
@@ -171,8 +191,17 @@ public class RobotContainer {
     }
   }
 
+// Autos 
+
+
+
+  /**
+   * Gets the auto command from SmartDashboard
+   * @return
+   */
   public Command getAutoCommand(){
-    return auto;
+    autoSelected = autoChooser.getSelected();
+    return autoSelected;
   }
 
   public void logComponents(){