Skip to content

Commit

Permalink
Merge pull request #19 from ThePinkAlliance/2k23
Browse files Browse the repository at this point in the history
  • Loading branch information
devsamuelv authored Jan 23, 2023
2 parents d85086a + d0f82de commit ced4573
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 100 deletions.
4 changes: 2 additions & 2 deletions ThePinkAlliance.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"fileName": "ThePinkAlliance.json",
"name": "ThePinkAlliance",
"version": "2.1.17",
"version": "2.2.17",
"uuid": "9619F7EA-7F96-4236-9D94-02338DFED572",
"mavenUrls": [
"https://jitpack.io",
Expand All @@ -13,7 +13,7 @@
{
"groupId": "com.github.ThePinkAlliance",
"artifactId": "core",
"version": "2.1.17"
"version": "2.2.17"
}
],
"jniDependencies": [],
Expand Down
26 changes: 10 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'java-library'
apply plugin: 'maven-publish'

group = 'com.ThePinkAlliance.core'
version = '2.1.17'
version = '2.2.17'

sourceCompatibility = JavaVersion.VERSION_11 // java 11
targetCompatibility = JavaVersion.VERSION_11
Expand All @@ -24,31 +24,25 @@ repositories {
dependencies {
implementation 'com.google.guava:guava:29.0-jre'

implementation 'edu.wpi.first.wpilibj:wpilibj-java:2022.4.1'
implementation 'edu.wpi.first.wpilibj:wpilibj-java:2023.2.1'
implementation 'edu.wpi.first.shuffleboard:shuffleboard:2022.4.1'
implementation 'edu.wpi.first.shuffleboard:api:2022.4.1'
implementation 'edu.wpi.first.wpilibNewCommands:wpilibNewCommands-java:2022.4.1'
implementation 'edu.wpi.first.wpiutil:wpiutil-java:2022.4.1'
implementation 'edu.wpi.first.cscore:cscore-java:2022.4.1'
implementation 'edu.wpi.first.ntcore:ntcore-java:2022.4.1'
implementation 'edu.wpi.first.wpimath:wpimath-java:2022.4.1'
implementation 'edu.wpi.first.shuffleboard:api:2023.2.1'
implementation 'edu.wpi.first.wpilibNewCommands:wpilibNewCommands-java:2023.2.1'
implementation 'edu.wpi.first.wpiutil:wpiutil-java:2023.2.1'
implementation 'edu.wpi.first.cscore:cscore-java:2023.2.1'
implementation 'edu.wpi.first.ntcore:ntcore-java:2023.2.1'
implementation 'edu.wpi.first.wpimath:wpimath-java:2023.2.1'

implementation 'com.ctre.phoenix:api-java:5.21.2'
implementation 'com.ctre.phoenix:api-java:5.30.2'

implementation 'com.revrobotics.frc:REVLib-java:2022.1.1'
implementation 'com.revrobotics.frc:REVLib-java:2023.1.1'

testImplementation 'junit:junit:4.12'
}


jar {
def env = System.getenv("JITPACK")

if (env == false || env == null) {
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(CORE_MAIN_CLASS)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}

publishing {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,4 @@ public class JoystickButton
public JoystickButton(Joystick joystick, Buttons button) {
super(joystick.getJoystick(), button.id);
}

/**
* Returns boolean if the operator is currently pressing the button.
*/
public boolean isPressed() {
return this.get();
}

/**
* Returns boolean if the operator has released the button or not.
*/
public boolean isReleased() {
return !this.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import java.util.List;
import java.util.stream.Stream;

import edu.wpi.first.wpilibj.drive.Vector2d;

/**
* The linear interpolation takes a table with two columns and will find two
* values in the first column, one that's smaller then the input and one
Expand Down
75 changes: 75 additions & 0 deletions src/main/java/com/ThePinkAlliance/core/math/Vector2d.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package com.ThePinkAlliance.core.math;

import java.util.Objects;

/**
* A vector in 2-dimensional Cartesian space.
*/
public class Vector2d {
public final double x;
public final double y;

/**
* Creates a vector from the origin to the point <code>(x, y)</code>.
*
* @param x the X-coordinate of the vector
* @param y the Y-coordinate of the vector
*/
public Vector2d(double x, double y) {
this.x = x;
this.y = y;
}

/**
* Gets the X-coordinate of this vector.
*/
public double getX() {
return x;
}

/**
* Gets the Y-coordinate of this vector.
*/
public double getY() {
return y;
}

/**
* Gets the magnitude of this vector.
*/
public double getMagnitude() {
return Math.sqrt(x * x + y * y);
}

/**
* Gets the angle of this vector, in radians in the range
* <code>(-pi, pi)</code>.
*/
public double getAngle() {
return Math.atan2(y, x);
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Vector2d that = (Vector2d) o;
return this.x == that.x
&& this.y == that.y;
}

@Override
public int hashCode() {
return Objects.hash(x, y);
}

@Override
public String toString() {
return "Vector2d(" + x + "," + y + ")";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import edu.wpi.first.math.kinematics.SwerveModuleState;
import edu.wpi.first.math.trajectory.Trajectory;
import edu.wpi.first.math.trajectory.TrapezoidProfile;
import edu.wpi.first.wpilibj.util.ErrorMessages;
import edu.wpi.first.util.ErrorMessages;
import edu.wpi.first.wpilibj2.command.Subsystem;
import edu.wpi.first.wpilibj2.command.SwerveControllerCommand;
import java.util.function.Consumer;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/LinearInterpolationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import java.util.List;

import edu.wpi.first.wpilibj.drive.Vector2d;
import com.ThePinkAlliance.core.math.LinearInterpolationTable;
import com.ThePinkAlliance.core.math.Vector2d;
import org.junit.Test;

public class LinearInterpolationTest {
Expand Down

0 comments on commit ced4573

Please sign in to comment.