diff --git a/README.md b/README.md index 15964d2..6143e04 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,4 @@ -# Spartronics 4915's Robot Template - -## Setup - -This repository is marked as a "Template" on Github, which allows you to create a new codebase from the latest snapshot of this code. -Use it to create a new repository under the Spartronics4915 organization titled `XXXX-GameName`, where `XXXX` is the current year. -Whether the repository is public (visible to other teams) or private (only visible to members of the Spartronics4915 organization) is up to you, but in the spirit of Coopertition, it should be made public at the end of the season regardless. - -After creating the new season's codebase, the following four changes must be made: - -- Update the current year in `wpilib_preferences.json`. -- Update the current year in `settings.gradle`. -- Refactor the `frc` folder into `frcXXXX`, where `XXXX` is the current year. -- Change `ROBOT_MAIN_CLASS` in `build.gradle` to point to the new `Main` class: `com.spartronics4915.frcXXXX.Main`. - -Additionally, the following steps are advised: - -- Copy the contents of `SpartronicsLib` into the new codebase to facilitate [simultaneous development](https://github.com/Spartronics4915/SpartronicsLib#for-spartronics). - - This will override the Jitpack setup, so no need to do anything there. -- Update vendor dependencies (the WPILib extension provides an option for this). -- Remove this "Setup" section from the README. - -The `ExampleSubsystem` and `ExampleCommand` classes are non-functional and can -be left in as a reference or taken out at your discretion. +# Spartronics 4915's Test Bed 2021 ## Usage diff --git a/build.gradle b/build.gradle index 33f6063..1e94c7a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2021.2.2" + id "edu.wpi.first.GradleRIO" version "2021.3.1" } sourceCompatibility = JavaVersion.VERSION_11 diff --git a/src/main/java/com/spartronics4915/frc/Constants.java b/src/main/java/com/spartronics4915/frc/Constants.java index 47ef4fb..df97d6f 100644 --- a/src/main/java/com/spartronics4915/frc/Constants.java +++ b/src/main/java/com/spartronics4915/frc/Constants.java @@ -11,5 +11,5 @@ */ public final class Constants { - + public static final int kTestMotorId = 0; } diff --git a/src/main/java/com/spartronics4915/frc/commands/ExampleCommand.java b/src/main/java/com/spartronics4915/frc/commands/ExampleCommand.java index 87c6525..f7168df 100644 --- a/src/main/java/com/spartronics4915/frc/commands/ExampleCommand.java +++ b/src/main/java/com/spartronics4915/frc/commands/ExampleCommand.java @@ -24,7 +24,9 @@ public ExampleCommand(ExampleSubsystem subsystem) // Called when the command is initially scheduled. @Override - public void initialize() {} + public void initialize() { + mExampleSubsystem.startTestMotor(1.0); + } // Called every time the scheduler runs while the command is scheduled. @Override @@ -39,5 +41,7 @@ public boolean isFinished() // Called once the command ends or is interrupted. @Override - public void end(boolean interrupted) {} + public void end(boolean interrupted) { + mExampleSubsystem.stopTestMotor(); + } } diff --git a/src/main/java/com/spartronics4915/frc/subsystems/ExampleSubsystem.java b/src/main/java/com/spartronics4915/frc/subsystems/ExampleSubsystem.java index a96649e..ec97310 100644 --- a/src/main/java/com/spartronics4915/frc/subsystems/ExampleSubsystem.java +++ b/src/main/java/com/spartronics4915/frc/subsystems/ExampleSubsystem.java @@ -1,13 +1,18 @@ package com.spartronics4915.frc.subsystems; +import com.spartronics4915.frc.Constants; import com.spartronics4915.lib.subsystems.SpartronicsSubsystem; +import edu.wpi.first.wpilibj.Talon; + /** * Detailed description of ExampleSubsystem. */ public class ExampleSubsystem extends SpartronicsSubsystem { + private static ExampleSubsystem sInstance = null; // The subsystem's hardware is defined here... + private static Talon mTestMotor; /** Creates a new ExampleSubsystem. */ public ExampleSubsystem() @@ -15,7 +20,7 @@ public ExampleSubsystem() boolean success = true; try { - // ...and constructed here. + mTestMotor = new Talon(Constants.kTestMotorId); } catch (Exception exception) { @@ -25,8 +30,24 @@ public ExampleSubsystem() logInitialized(success); } + public static ExampleSubsystem getsInstance() + { + if (sInstance == null) { + sInstance = new ExampleSubsystem(); + } + return sInstance; + } + // Subsystem methods - actions the robot can take - should be placed here. + public void startTestMotor(double speed) { + mTestMotor.set(speed); + } + + public void stopTestMotor() { + mTestMotor.set(0.0); + } + /** This method will be called once per scheduler run. */ @Override public void periodic() {}