Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"enableCppIntellisense": false,
"currentLanguage": "java",
"projectYear": "2027_alpha5",
"projectYear": "2027_alpha7",
"teamNumber": 10101
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ repositories {
Where `TAG` is the version of the library to include in your project.

Make sure the vendor dependency versions in your project match those in the version you're trying to use. For this version of the library, those are:
- REVLib 2027.0.0-alpha-6
- WPILib 2027 alpha 7
- REVLib 2027.0.0-alpha-7
21 changes: 3 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
plugins {
id "java-library"
id 'maven-publish'
id "java"
id "org.wpilib.GradleRIO" version "2027.0.0-alpha-6"
id "application"
id "org.wpilib.GradleRIO" version "2027.0.0-alpha-7"
id 'com.diffplug.spotless' version '8.10.1'
id "com.gradleup.shadow" version "9.3.0"
}

java {
Expand Down Expand Up @@ -32,7 +31,7 @@ deploy {
}

def deployArtifact = deploy.targets.systemcore.artifacts.wpilibJava
wpi.java.debugJni = false
wpi.java.runSimWithDebugJni = false
def includeDesktopSupport = true

// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
Expand Down Expand Up @@ -69,20 +68,6 @@ test {
wpi.sim.addGui().defaultEnabled = true
wpi.sim.addDriverstation()

// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar')
// in order to make them all available at runtime. Also adding the manifest so WPILib
// knows where to look for our Robot Class.
shadowJar {
mergeServiceFiles()
from('src') { into 'backup/src' }
from('vendordeps') { into 'backup/vendordeps' }
from('build.gradle') { into 'backup' }
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

// Configure jar and deploy tasks
deployArtifact.jarTask = shadowJar
wpi.java.configureExecutableTasks(shadowJar)
wpi.java.configureTestTasks(test)

// Configure string concat to always inline compile
Expand Down
14 changes: 11 additions & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@ import org.gradle.internal.os.OperatingSystem

pluginManagement {
repositories {
String wpilibYear = '2027_alpha5'
String wpilibYear = '2027_alpha7'
File wpilibHome
if (OperatingSystem.current().isWindows()) {
def os = OperatingSystem.current()
if (os.isWindows()) {
String publicFolder = System.getenv('PUBLIC')
if (publicFolder == null) {
publicFolder = "C:\\Users\\Public"
}
def homeRoot = new File(publicFolder, "wpilib")
wpilibHome = new File(homeRoot, wpilibYear)
} else if (os.isLinux()) {
String xdgDataHome = System.getenv('XDG_DATA_HOME')
if (xdgDataHome == null || xdgDataHome.trim().isEmpty() || !new File(xdgDataHome).isAbsolute()) {
xdgDataHome = new File(System.getProperty("user.home"), ".local/share").getPath()
}
def homeRoot = new File(xdgDataHome, "wpilib")
wpilibHome = new File(homeRoot, wpilibYear)
} else {
def userFolder = System.getProperty("user.home")
def homeRoot = new File(userFolder, "wpilib")
def homeRoot = new File(userFolder, ".wpilib")
wpilibHome = new File(homeRoot, wpilibYear)
}
def wpilibHomeMaven = new File(wpilibHome, 'maven')
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/org/frc10101/womp/can/SparkMaxWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.revrobotics.spark.SparkLowLevel.MotorType;
import com.revrobotics.spark.SparkMax;
import org.wpilib.hardware.bus.CANPort;

/** A REV SPARK Max */
public class SparkMaxWrapper {
Expand All @@ -10,14 +11,14 @@ public class SparkMaxWrapper {
/**
* Creates a REV SPARK Max.
*
* @param busId the ID of the Systemcore Bus
* @param bus the Systemcore Bus
* @param canId the CAN ID of the SPARK Max
* @param motorType the type of motor to control (brushed or brushless)
*/
public SparkMaxWrapper(int busId, int canId, MotorType motorType) {
public SparkMaxWrapper(CANPort bus, int canId, MotorType motorType) {
if (canId < 1) throw new IllegalArgumentException("CAN ID must be greater than or equal to 1.");
if (motorType == null) throw new IllegalArgumentException("Motor Type must be specified.");
_sparkMax = new SparkMax(busId, canId, motorType);
_sparkMax = new SparkMax(bus, canId, motorType);
}

/**
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/org/frc10101/womp/can/SparkMaxWrapperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@

import com.revrobotics.spark.SparkLowLevel.MotorType;
import org.junit.jupiter.api.Test;
import org.wpilib.hardware.bus.CANPort;

public class SparkMaxWrapperTest {
@Test
void create() {
new SparkMaxWrapper(0, 1, MotorType.kBrushed);
new SparkMaxWrapper(0, 2, MotorType.kBrushless);
new SparkMaxWrapper(CANPort.CAN_S0, 1, MotorType.kBrushed);
new SparkMaxWrapper(CANPort.CAN_S0, 2, MotorType.kBrushless);
}

@Test
void illegalCanId() {
assertThrows(
IllegalArgumentException.class,
() -> {
new SparkMaxWrapper(0, 0, MotorType.kBrushed);
new SparkMaxWrapper(CANPort.CAN_S0, 0, MotorType.kBrushed);
});
}

Expand All @@ -26,7 +27,7 @@ void missingMotorType() {
assertThrows(
IllegalArgumentException.class,
() -> {
new SparkMaxWrapper(0, 1, null);
new SparkMaxWrapper(CANPort.CAN_S0, 1, null);
});
}
}
20 changes: 10 additions & 10 deletions vendordeps/REVLib.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"fileName": "REVLib.json",
"name": "REVLib",
"version": "2027.0.0-alpha-6",
"wpilibYear": "2027_alpha5",
"version": "2027.0.0-alpha-7",
"wpilibYear": "2027_alpha7",
"uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb",
"mavenUrls": [
"https://maven.revrobotics.com/"
Expand All @@ -12,14 +12,14 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "REVLib-java",
"version": "2027.0.0-alpha-6"
"version": "2027.0.0-alpha-7"
}
],
"jniDependencies": [
{
"groupId": "com.revrobotics.frc",
"artifactId": "REVLib-driver",
"version": "2027.0.0-alpha-6",
"version": "2027.0.0-alpha-7",
"skipInvalidPlatforms": true,
"isJar": false,
"validPlatforms": [
Expand All @@ -33,7 +33,7 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "RevLibBackendDriver",
"version": "2027.0.0-alpha-6",
"version": "2027.0.0-alpha-7",
"skipInvalidPlatforms": true,
"isJar": false,
"validPlatforms": [
Expand All @@ -47,7 +47,7 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "RevLibWpiBackendDriver",
"version": "2027.0.0-alpha-6",
"version": "2027.0.0-alpha-7",
"skipInvalidPlatforms": true,
"isJar": false,
"validPlatforms": [
Expand All @@ -63,7 +63,7 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "REVLib-cpp",
"version": "2027.0.0-alpha-6",
"version": "2027.0.0-alpha-7",
"libName": "REVLib",
"headerClassifier": "headers",
"sharedLibrary": false,
Expand All @@ -79,7 +79,7 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "REVLib-driver",
"version": "2027.0.0-alpha-6",
"version": "2027.0.0-alpha-7",
"libName": "REVLibDriver",
"headerClassifier": "headers",
"sharedLibrary": false,
Expand All @@ -95,7 +95,7 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "RevLibBackendDriver",
"version": "2027.0.0-alpha-6",
"version": "2027.0.0-alpha-7",
"libName": "BackendDriver",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
Expand All @@ -110,7 +110,7 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "RevLibWpiBackendDriver",
"version": "2027.0.0-alpha-6",
"version": "2027.0.0-alpha-7",
"libName": "REVLibWpi",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
Expand Down