Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import StuyLib to 2024 WPILib #82

Merged
merged 12 commits into from
Jan 8, 2024
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Build
on: [push, fork, pull_request]

env:
JAVA_VERSION: 1.11
GRADLE_VERSION: 7.2
JAVA_VERSION: 1.17
GRADLE_VERSION: 8.4

jobs:
spotless-check:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ permissions:
id-token: write

env:
JAVA_VERSION: 1.11
GRADLE_VERSION: 7.2
JAVA_VERSION: 1.17
GRADLE_VERSION: 8.4

jobs:
pages:
Expand Down
12 changes: 7 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.WPI_VER = "2023.4.3"
ext.WPI_VER = "2024.1.1"
}

plugins {
Expand All @@ -8,14 +8,16 @@ plugins {
id "maven-publish"

id "edu.wpi.first.GradleRIO" version "${WPI_VER}"
id "com.diffplug.spotless" version "6.11.0"
id "com.github.spotbugs" version "5.0.13"
id "com.diffplug.spotless" version "6.22.0"
id "com.github.spotbugs" version "5.2.0"
}

group = 'com.stuypulse'

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

sourceSets {
main {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=permwrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=permwrapper/dists
4 changes: 2 additions & 2 deletions src/com/stuypulse/stuylib/control/Controller.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

package com.stuypulse.stuylib.control;

import com.stuypulse.stuylib.streams.filters.IFilter;
import com.stuypulse.stuylib.streams.numbers.filters.IFilter;

/**
* A controller calculates an output variable given a setpoint and measurement of a single variable.
Expand Down
2 changes: 1 addition & 1 deletion src/com/stuypulse/stuylib/control/ControllerGroup.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
4 changes: 2 additions & 2 deletions src/com/stuypulse/stuylib/control/angle/AngleController.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

package com.stuypulse.stuylib.control.angle;

import com.stuypulse.stuylib.math.Angle;
import com.stuypulse.stuylib.streams.angles.filters.AFilter;
import com.stuypulse.stuylib.streams.filters.IFilter;
import com.stuypulse.stuylib.streams.numbers.filters.IFilter;

/**
* Base class of controller classes of continuous systems. This means that both the setpoint and
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand All @@ -8,9 +8,9 @@
import com.stuypulse.stuylib.math.Angle;
import com.stuypulse.stuylib.math.SLMath;
import com.stuypulse.stuylib.network.SmartNumber;
import com.stuypulse.stuylib.streams.filters.IFilter;
import com.stuypulse.stuylib.streams.filters.IFilterGroup;
import com.stuypulse.stuylib.streams.filters.TimedMovingAverage;
import com.stuypulse.stuylib.streams.numbers.filters.IFilter;
import com.stuypulse.stuylib.streams.numbers.filters.IFilterGroup;
import com.stuypulse.stuylib.streams.numbers.filters.TimedMovingAverage;
import com.stuypulse.stuylib.util.StopWatch;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand All @@ -8,8 +8,8 @@
import com.stuypulse.stuylib.math.Angle;
import com.stuypulse.stuylib.math.SLMath;
import com.stuypulse.stuylib.network.SmartNumber;
import com.stuypulse.stuylib.streams.filters.IFilter;
import com.stuypulse.stuylib.streams.filters.IFilterGroup;
import com.stuypulse.stuylib.streams.numbers.filters.IFilter;
import com.stuypulse.stuylib.streams.numbers.filters.IFilterGroup;
import com.stuypulse.stuylib.util.StopWatch;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
8 changes: 4 additions & 4 deletions src/com/stuypulse/stuylib/control/feedback/PIDCalculator.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand All @@ -7,9 +7,9 @@
import com.stuypulse.stuylib.control.Controller;
import com.stuypulse.stuylib.math.SLMath;
import com.stuypulse.stuylib.network.SmartNumber;
import com.stuypulse.stuylib.streams.filters.IFilter;
import com.stuypulse.stuylib.streams.filters.IFilterGroup;
import com.stuypulse.stuylib.streams.filters.TimedMovingAverage;
import com.stuypulse.stuylib.streams.numbers.filters.IFilter;
import com.stuypulse.stuylib.streams.numbers.filters.IFilterGroup;
import com.stuypulse.stuylib.streams.numbers.filters.TimedMovingAverage;
import com.stuypulse.stuylib.util.StopWatch;

/**
Expand Down
6 changes: 3 additions & 3 deletions src/com/stuypulse/stuylib/control/feedback/PIDController.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand All @@ -7,8 +7,8 @@
import com.stuypulse.stuylib.control.Controller;
import com.stuypulse.stuylib.math.SLMath;
import com.stuypulse.stuylib.network.SmartNumber;
import com.stuypulse.stuylib.streams.filters.IFilter;
import com.stuypulse.stuylib.streams.filters.IFilterGroup;
import com.stuypulse.stuylib.streams.numbers.filters.IFilter;
import com.stuypulse.stuylib.streams.numbers.filters.IFilterGroup;
import com.stuypulse.stuylib.util.StopWatch;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

package com.stuypulse.stuylib.control.feedforward;

import com.stuypulse.stuylib.control.Controller;
import com.stuypulse.stuylib.streams.filters.IFilter;
import com.stuypulse.stuylib.streams.numbers.filters.IFilter;

/**
* A feedforward term to account for gravity for motorized arms.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand All @@ -7,7 +7,7 @@
import com.stuypulse.stuylib.control.Controller;
import com.stuypulse.stuylib.control.angle.AngleController;
import com.stuypulse.stuylib.control.angle.feedforward.AnglePositionFeedforwardController;
import com.stuypulse.stuylib.streams.filters.Derivative;
import com.stuypulse.stuylib.streams.numbers.filters.Derivative;

/**
* A motor feedforward model, which can be used to calculate an output voltage given a desired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

package com.stuypulse.stuylib.control.feedforward;

import com.stuypulse.stuylib.control.Controller;
import com.stuypulse.stuylib.streams.filters.Derivative;
import com.stuypulse.stuylib.streams.numbers.filters.Derivative;

/**
* A positional controller that uses a feedforward model to calculate motor outputs given positional
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
2 changes: 1 addition & 1 deletion src/com/stuypulse/stuylib/input/Gamepad.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
2 changes: 1 addition & 1 deletion src/com/stuypulse/stuylib/input/GamepadState.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
2 changes: 1 addition & 1 deletion src/com/stuypulse/stuylib/input/WPIGamepad.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
2 changes: 1 addition & 1 deletion src/com/stuypulse/stuylib/input/gamepads/AutoGamepad.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
2 changes: 1 addition & 1 deletion src/com/stuypulse/stuylib/input/gamepads/Logitech.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
2 changes: 1 addition & 1 deletion src/com/stuypulse/stuylib/input/gamepads/PS4.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
18 changes: 15 additions & 3 deletions src/com/stuypulse/stuylib/input/gamepads/Xbox.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand All @@ -18,9 +18,17 @@ public class Xbox extends Gamepad {

private XboxController mJoystick;

private final boolean flipped;

// Constructor //
public Xbox(XboxController joystick) {
this(joystick, true);
}

protected Xbox(XboxController joystick, boolean flipped) {
mJoystick = joystick;

this.flipped = flipped;
}

public Xbox(int port) {
Expand All @@ -46,7 +54,7 @@ public double getLeftX() {

@Override
public double getLeftY() {
return getJoystick().getLeftY();
return (flipped ? -1 : +1) * getJoystick().getLeftY();
}

// Right Stick //
Expand All @@ -57,7 +65,7 @@ public double getRightX() {

@Override
public double getRightY() {
return getJoystick().getRightY();
return (flipped ? -1 : +1) * getJoystick().getRightY();
}

// D-Pad //
Expand Down Expand Up @@ -152,4 +160,8 @@ public void setRumble(double intensity) {
mJoystick.setRumble(RumbleType.kLeftRumble, intensity);
mJoystick.setRumble(RumbleType.kRightRumble, intensity);
}

public Xbox flipped() {
return new Xbox(mJoystick, !flipped);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand All @@ -19,7 +19,7 @@
*
* <br>
*
* @see com.stuypulse.stuylib.streams.filters.IFilter
* @see com.stuypulse.stuylib.streams.numbers.filters.IFilter
* @author Myles Pasetsky (selym3)
*/
public class KeyGamepad extends Gamepad {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
2 changes: 1 addition & 1 deletion src/com/stuypulse/stuylib/input/keyboard/NetKeyboard.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
2 changes: 1 addition & 1 deletion src/com/stuypulse/stuylib/math/Angle.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
2 changes: 1 addition & 1 deletion src/com/stuypulse/stuylib/math/Polar2D.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
2 changes: 1 addition & 1 deletion src/com/stuypulse/stuylib/math/SLMath.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved. */
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* This work is licensed under the terms of the MIT license */
/* found in the root directory of this project. */

Expand Down
Loading
Loading