Skip to content

Commit

Permalink
Revert "Dev"
Browse files Browse the repository at this point in the history
  • Loading branch information
Spikes-2212 authored Jan 28, 2025
1 parent 5375e33 commit 06f17ee
Show file tree
Hide file tree
Showing 55 changed files with 1,055 additions and 1,281 deletions.
34 changes: 14 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,48 @@
<body style="font-family: Calibri">
<h1 style="color: #00156B">SpikesLib</h1>
<h1 style="color: #00156E">SpikesLib</h1>
SpikesLib is a library that extends <a href="https://github.com/wpilibsuite/allwpilib">WPILib</a> written by the FRC team The
Spikes#2212.

<h2 style="color: #00156B;">Examples</h2>
Examples of how to use the library can be
found <a href = "https://github.com/Spikes-2212-Programming-Guild/SpikesLib2-Examples">here</a>.
<h2 style="color: #00156E;">Examples</h2>
Examples of how to use the library can be found <a href = "https://github.com/Spikes-2212-Programming-Guild/SpikesLib2-Examples">here</a>.

<h2 style="color: #00156B;">Packages</h2>
<h2 style="color: #00156E;">Packages</h2>

- command - extensions for WPILib's Command Based framework
- control - controller wrappers and custom controllers
- dashboard - wrappers for SmartDashboard elements
- path - path following code and pure pursuit algorithm
- util - additional utilities

<h2 style="color: #00156B;">Installation</h2>
<h2 style="color: #00156E;">Installation</h2>
After creating a Robot Project, import SpikesLib as an online vendor libray, using this link: <br> <br>
https://spikes2212.com/SpikesLib.json

<h2 style="color: #00156B;">2025 Season</h2>
<h2 style="color: #00156E;">2024 Season</h2>

Spikeslib has been <a href = "https://github.com/Spikes-2212-Programming-Guild/SpikesLib2/compare/v4.1.0...v5.0.0-beta"> updated </a> to support WPILib 2025.
Spikeslib has been <a href = "https://github.com/Spikes-2212-Programming-Guild/SpikesLib2/compare/v3.2.1...v4.1.0"> updated </a> to support WPILib 2024.

<h2 style="color: #00156B;">2024 Season</h2>
<h2 style="color: #00156E;">2023 Season</h2>

Spikeslib has been <a href = "https://github.com/Spikes-2212-Programming-Guild/SpikesLib2/compare/v3.2.1...v4.1.0">
updated </a> to support WPILib 2024.
Spikeslib has been <a href = "https://github.com/Spikes-2212-Programming-Guild/SpikesLib2/compare/v2.0.0...v3.0.0"> updated </a> to support WPILib 2023.

<h2 style="color: #00156B;">2023 Season</h2>

Spikeslib has been <a href = "https://github.com/Spikes-2212-Programming-Guild/SpikesLib2/compare/v2.0.0...v3.0.0">
updated </a> to support WPILib 2023.

<h2 style="color: #00156B;">2022 Season</h2>
<h2 style="color: #00156E;">2022 Season</h2>

Spikeslib has been updated to support WPILib 2022.

<h2 style="color: #00156B;" >2020 Season</h2>
<h2 style="color: #00156E;" >2020 Season</h2>

For this season, SpikesLib has been moved to this repository due to the extensive changes in WPILib. <br>
The old version is still available at the [old repository](https://github.com/Spikes-2212-Programming-Guild/SpikesLib).

<h2 style="color: #00156B;">Development</h2>
<h2 style="color: #00156E;">Development</h2>
SpikesLib is developed in a feature branches workflow. <br>
All feature branches are merged into <code><i>dev</i></code> branch after testing, which in turn is merged into
<code><i>master</i></code> after it passing complete testing <br>
Branches should be named according to the following convention - <code><i>name_package_feature</i></code>

<h2 style="color: #00156B;">Help us out!</h2>

<h2 style="color: #00156E;">Help us out!</h2>
We accept help from everyone! <br>
If you want to contribute, simply create a branch and open up a pull request, according to the instructions above.

Expand Down
6 changes: 3 additions & 3 deletions SpikesLib2.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"fileName": "SpikesLib2.json",
"name": "SpikesLib2",
"version": "v5.0.0-beta",
"frcYear": "2025",
"version": "v4.1.0",
"frcYear": "2024",
"uuid": "018a8f54-8662-11ec-a8a3-0242ac120002",
"jsonUrl": "https://raw.githubusercontent.com/Spikes-2212-Programming-Guild/SpikesLib2/master/SpikesLib2.json",
"mavenUrls": [
Expand All @@ -15,7 +15,7 @@
{
"groupId": "com.github.Spikes-2212-Programming-Guild",
"artifactId": "SpikesLib2",
"version": "v5.0.0-beta"
"version": "4.1.0"
}
]
}
28 changes: 13 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

plugins {
id 'java-library'
id 'maven-publish'
Expand All @@ -20,33 +21,30 @@ repositories {
maven {
url 'https://maven.revrobotics.com'
}
maven {
url 'https://jitpack.io'
}
}

publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'org.gradle.sample'
artifactId = 'library'
version = '5.0.0-beta'
version = '4.1.0'

from components.java
}
}
}

dependencies {
implementation group: 'com.ctre.phoenix6', name: 'wpiapi-java', version: '25.2.1'
implementation group: 'edu.wpi.first.ntcore', name: 'ntcore-java', version: '2025.1.1'
implementation group: 'edu.wpi.first.wpilibNewCommands', name: 'wpilibNewCommands-java', version: '2025.1.1'
implementation group: 'edu.wpi.first.wpilibj', name: 'wpilibj-java', version: '2025.1.1'
implementation group: 'edu.wpi.first.cameraserver', name: 'cameraserver-java', version: '2025.1.1'
implementation group: 'edu.wpi.first.wpiutil', name: 'wpiutil-java', version: '2025.1.1'
implementation group: 'edu.wpi.first.wpimath', name: 'wpimath-java', version: '2025.1.1'
implementation group: 'edu.wpi.first.wpiunits', name: 'wpiunits-java', version: '2025.1.1'
implementation group: 'com.revrobotics.frc', name: 'REVLib-java', version: '2025.0.2'
implementation group: 'com.ctre.phoenix', name: 'api-java', version: '5.35.1'
implementation group: 'com.ctre.phoenix', name: 'wpiapi-java', version: '5.35.1'
implementation group: 'com.ctre.phoenix6', name: 'wpiapi-java', version: '24.1.0'
implementation group: 'edu.wpi.first.ntcore', name: 'ntcore-java', version: '2024.2.1'
implementation group: 'edu.wpi.first.wpilibNewCommands', name: 'wpilibNewCommands-java', version: '2024.2.1'
implementation group: 'edu.wpi.first.wpilibj', name: 'wpilibj-java', version: '2024.2.1'
implementation group: 'edu.wpi.first.cameraserver', name: 'cameraserver-java', version: '2024.2.1'
implementation group: 'edu.wpi.first.wpiutil', name: 'wpiutil-java', version: '2024.2.1'
implementation group: 'edu.wpi.first.wpimath', name: 'wpimath-java', version: '2024.2.1'
implementation group: 'edu.wpi.first.wpiunits', name: 'wpiunits-java', version: '2024.2.1'
implementation group: 'com.revrobotics.frc', name: 'REVLib-java', version: '2024.2.0'
implementation group: 'com.ctre.phoenix', name: 'api-java', version: '5.33.0'
implementation group: 'com.ctre.phoenix', name: 'wpiapi-java', version: '5.33.0'
}
20 changes: 8 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,43 @@ SpikesLib is a library that extends <a href="https://github.com/wpilibsuite/allw
Spikes#2212.


<h2 style="color: #00156B;">Packages</h2>
<h2 style="color: #0015AB;">Packages</h2>

<li>command - extensions for WPILib's Command Based framework</li>
<li>control - controller wrappers and custom controllers</li>
<li>dashboard - wrappers for SmartDashboard elements</li>
<li>path - path following code and pure pursuit algorithm</li>
<li>util - additional utilities</li>

<h2 style="color: #00156B;">Installation</h2>
<h2 style="color: #0015AB;">Installation</h2>
After creating a Robot Project, import SpikesLib as an online vendor libray, using this link: <br> <br>
https://spikes2212.com/SpikesLib.json

<h2 style="color: #00156B;">2025 Season</h2>

Spikeslib has been <a href = "https://github.com/Spikes-2212-Programming-Guild/SpikesLib2/compare/v4.1.0...v5.0.0-beta"> updated </a> to support WPILib 2025.

<h2 style="color: #00156B;">2024 Season</h2>
<h2 style="color: #00156E;">2024 Season</h2>

Spikeslib has been <a href = "https://github.com/Spikes-2212-Programming-Guild/SpikesLib2/compare/v3.2.1...v4.1.0"> updated </a> to support WPILib 2024.

<h2 style="color: #00156B;">2023 Season</h2>
<h2 style="color: #00156E;">2023 Season</h2>

Spikeslib has been <a href = "https://github.com/Spikes-2212-Programming-Guild/SpikesLib2/compare/v2.0.0...v3.0.0"> updated </a> to support WPILib 2023.

<h2 style="color: #00156B;">2022 Season</h2>
<h2 style="color: #0015AB;">2022 Season</h2>

Spikeslib has been updated to support WPILib 2022.

<h2 style="color: #00156B;" >2020 Season</h2>
<h2 style="color: #0015AB;" >2020 Season</h2>

For this season, SpikesLib has been moved to this repository due to the extensive changes in WPILib. <br>
The old version is still available at the <a href="https://github.com/Spikes-2212-Programming-Guild/SpikesLib"
target="_blank" rel="noopener noreferrer">old repository</a>.

<h2 style="color: #00156B;">Development</h2>
<h2 style="color: #0015AB;">Development</h2>
SpikesLib is developed in a feature branches workflow. <br>
All feature branches are merged into <code><i>dev</i></code> branch after testing, which in turn is merged into
<code><i>master</i></code> after it passing complete testing <br>
Branches should be named according to the following convention - <code><i>name_package_feature</i></code>

<h2 style="color: #00156B;">Help us out!</h2>
<h2 style="color: #0015AB;">Help us out!</h2>
We accept help from everyone! <br>
If you want to contribute, simply create a branch and open up a pull request, according to the instructions above.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.spikes2212.path.OdometryHandler;
import edu.wpi.first.wpilibj.motorcontrol.MotorController;

@Deprecated(forRemoval = true, since = "2025")
public abstract class OdometryDrivetrain extends TankDrivetrain {

public OdometryDrivetrain(String namespaceName, MotorController left, MotorController right) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.spikes2212.command.drivetrains;

import com.spikes2212.command.DashboardedSubsystem;
import com.spikes2212.util.MotorControllerGroup;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.wpilibj.RobotController;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
Expand All @@ -21,8 +20,8 @@ public class TankDrivetrain extends DashboardedSubsystem {

private static final String DEFAULT_NAMESPACE_NAME = "tank drivetrain";

protected final MotorController leftController;
protected final MotorController rightController;
protected MotorController leftController;
protected MotorController rightController;

private final DifferentialDrive drive;

Expand All @@ -39,18 +38,6 @@ public TankDrivetrain(MotorController leftController, MotorController rightContr
this(getClassName(DEFAULT_NAMESPACE_NAME), leftController, rightController);
}

public TankDrivetrain(String namespaceName, MotorController leftMaster, MotorController leftSlave,
MotorController rightMaster, MotorController rightSlave) {
this(namespaceName, new MotorControllerGroup(leftMaster, leftSlave),
new MotorControllerGroup(rightMaster, rightSlave));
}

public TankDrivetrain(MotorController leftMaster, MotorController leftSlave,
MotorController rightMaster, MotorController rightSlave) {
this(new MotorControllerGroup(leftMaster, leftSlave),
new MotorControllerGroup(rightMaster, rightSlave));
}

/**
* Moves both sides of this drivetrain by the given speeds for each side.
*
Expand Down Expand Up @@ -140,7 +127,7 @@ public void setLeft(double leftSpeed) {
* @param rightSpeed the speed to set to the right side (-1 to 1). Positive values move this side forward
*/
public void setRight(double rightSpeed) {
rightController.set(rightSpeed);
rightController.set(-rightSpeed);
}

/**
Expand Down Expand Up @@ -171,7 +158,6 @@ public void stop() {

/**
* Sets the motor safety feature of the speed controllers on/off.
*
* @param enabled whether motor safety should be enabled
*/
public void setMotorSafety(boolean enabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class DriveArcadeWithPID extends Command {
/**
* The PID controller for the turning PID loop.
*/
protected final PIDController pidController;
protected PIDController pidController;

/**
* The FeedForward settings for the turning FeedForwards loop.
Expand All @@ -41,87 +41,69 @@ public class DriveArcadeWithPID extends Command {
/**
* The FeedForward controller for the turning FeedForwards loop.
*/
protected final FeedForwardController feedForwardController;
protected FeedForwardController feedForwardController;

/**
* The angle of the drivetrain.
*/
protected final Supplier<Double> source;
protected Supplier<Double> source;

/**
* The angle the drivetrain should reach.
* The last time the drivetrain's angle wasn't within the target range.
*/
protected final Supplier<Double> setpoint;
private double lastTimeNotOnTarget;

/**
* The acceleration the drivetrain should be at.
* The angle the drivetrain should reach.
*/
protected final Supplier<Double> acceleration;
protected Supplier<Double> setpoint;

/**
* The speed at which to move the drivetrain forward.
*/
protected final Supplier<Double> moveValue;

/**
* The last time the drivetrain's angle wasn't within the target range.
*/
private double lastTimeNotOnTarget;
protected Supplier<Double> moveValue;

public DriveArcadeWithPID(TankDrivetrain drivetrain, Supplier<Double> source, Supplier<Double> setpoint,
Supplier<Double> acceleration, Supplier<Double> moveValue, PIDSettings pidSettings,
Supplier<Double> moveValue, PIDSettings pidSettings,
FeedForwardSettings feedForwardSettings) {
addRequirements(drivetrain);
this.drivetrain = drivetrain;
this.setpoint = setpoint;
this.acceleration = acceleration;
this.pidSettings = pidSettings;
this.feedForwardSettings = feedForwardSettings;
this.source = source;
this.moveValue = moveValue;
this.pidController = new PIDController(pidSettings.getkP(), pidSettings.getkI(), pidSettings.getkD());
this.pidController.setSetpoint(setpoint.get());
this.feedForwardController = new FeedForwardController(feedForwardSettings.getkS(), feedForwardSettings.getkV(),
feedForwardSettings.getkA(), feedForwardSettings.getkG(), feedForwardSettings.getControlMode());
}

public DriveArcadeWithPID(TankDrivetrain drivetrain, Supplier<Double> source, double setpoint,
Supplier<Double> acceleration, double moveValue, PIDSettings pidSettings,
FeedForwardSettings feedForwardSettings) {
this(drivetrain, source, () -> setpoint, acceleration, () -> moveValue, pidSettings, feedForwardSettings);
}

public DriveArcadeWithPID(TankDrivetrain drivetrain, Supplier<Double> source, Supplier<Double> setpoint,
Supplier<Double> moveValue, PIDSettings pidSettings,
FeedForwardSettings feedForwardSettings) {
this(drivetrain, source, setpoint, () -> 0.0, moveValue, pidSettings, feedForwardSettings);
feedForwardSettings.getkA(), feedForwardSettings.getkG(), FeedForwardController.DEFAULT_PERIOD);
}

public DriveArcadeWithPID(TankDrivetrain drivetrain, Supplier<Double> source, double setpoint,
double moveValue, PIDSettings pidSettings, FeedForwardSettings feedForwardSettings) {
this(drivetrain, source, () -> setpoint, () -> 0.0, () -> moveValue, pidSettings, feedForwardSettings);
public DriveArcadeWithPID(TankDrivetrain drivetrain, Supplier<Double> source, double setpoint, double moveValue,
PIDSettings pidSettings, FeedForwardSettings feedForwardSettings) {
this(drivetrain, source, () -> setpoint, () -> moveValue, pidSettings, feedForwardSettings);
}

public DriveArcadeWithPID(TankDrivetrain drivetrain, Supplier<Double> source, Supplier<Double> setpoint,
Supplier<Double> moveValue, PIDSettings pidSettings) {
this(drivetrain, source, setpoint, () -> 0.0, moveValue, pidSettings, FeedForwardSettings.EMPTY_FF_SETTINGS);
this(drivetrain, source, setpoint, moveValue, pidSettings, FeedForwardSettings.EMPTY_FFSETTINGS);
}

public DriveArcadeWithPID(TankDrivetrain drivetrain, Supplier<Double> source, double setpoint,
double moveValue, PIDSettings pidSettings) {
public DriveArcadeWithPID(TankDrivetrain drivetrain, Supplier<Double> source, double setpoint, double moveValue,
PIDSettings pidSettings) {
this(drivetrain, source, () -> setpoint, () -> moveValue, pidSettings);
}

@Override
public void execute() {
pidController.setTolerance(pidSettings.getTolerance());
pidController.setPID(pidSettings.getkP(), pidSettings.getkI(), pidSettings.getkD());
pidController.setIZone(pidSettings.getIZone());

feedForwardController.setGains(feedForwardSettings);
feedForwardController.setGains(feedForwardSettings.getkS(), feedForwardSettings.getkV(),
feedForwardSettings.getkA(), feedForwardSettings.getkG());

drivetrain.arcadeDrive(moveValue.get(), pidController.calculate(source.get(), setpoint.get()) +
feedForwardController.calculate(source.get(), setpoint.get(), acceleration.get()));
feedForwardController.calculate(setpoint.get()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import java.util.function.Supplier;

import java.util.function.Supplier;

/**
* A command that moves a {@link TankDrivetrain} using linear and rotational voltages.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
*/
public class DriveCurvature extends Command {

protected final TankDrivetrain drivetrain;
protected final Supplier<Double> speed;
protected final Supplier<Double> rotation;
protected TankDrivetrain drivetrain;
protected Supplier<Double> speed;
protected Supplier<Double> rotation;

public DriveCurvature(TankDrivetrain drivetrain, Supplier<Double> speed, Supplier<Double> rotation) {
this.drivetrain = drivetrain;
Expand Down
Loading

0 comments on commit 06f17ee

Please sign in to comment.