Skip to content

Commit

Permalink
Problems fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
thehappycamden committed Oct 28, 2021
1 parent b8f63c8 commit 68d988d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 29 deletions.
25 changes: 1 addition & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/spartronics4915/frc/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
*/
public final class Constants
{

public static final int kTestMotorId = 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
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()
{
boolean success = true;
try
{
// ...and constructed here.
mTestMotor = new Talon(Constants.kTestMotorId);
}
catch (Exception exception)
{
Expand All @@ -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() {}
Expand Down

0 comments on commit 68d988d

Please sign in to comment.