Skip to content

Commit

Permalink
Update library to 2022
Browse files Browse the repository at this point in the history
* feature/2022-update:
  Update examples to 2022
  Update WPILib to 2022.1.1. Update Pheonix to 5.20.2. Migrate SPARK MAX API to REVLib. Update Gradle to 7.3.3.
  • Loading branch information
JacobJBublitz committed Jan 24, 2022
2 parents feb950b + 7ce11d3 commit 24d9d53
Show file tree
Hide file tree
Showing 24 changed files with 1,006 additions and 845 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ allprojects {
maven { url = uri('https://devsite.ctr-electronics.com/maven/release/') }

// REV
maven { url = uri('https://www.revrobotics.com/content/sw/max/sdk/maven/') }
maven { url = uri('https://maven.revrobotics.com/') }
}
}

dependencies {
implementation 'edu.wpi.first.wpilibj:wpilibj-java:2021.3.1'
implementation 'edu.wpi.first.wpilibj:wpilibj-java:2022.1.1'

// CTRE is implementation because it is not a hard requirement
implementation 'com.ctre.phoenix:api-java:5.19.4'
implementation 'com.ctre.phoenix:wpiapi-java:5.19.4'
implementation 'com.ctre.phoenix:api-java:5.20.2'
implementation 'com.ctre.phoenix:wpiapi-java:5.20.2'

// REV is implementation because it is not a hard requirement
implementation 'com.revrobotics.frc:SparkMax-java:1.5.4'
implementation 'com.revrobotics.frc:REVLib-java:2022.1.0'

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
Expand Down
49 changes: 31 additions & 18 deletions examples/mk3-minibot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,52 @@ plugins {
}

application {
mainClassName('com.swervedrivespecialties.examples.mk3minibot.Main')
mainClass.set('com.swervedrivespecialties.examples.mk3minibot.Main')
}

targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11

deploy {
targets {
roboRIO('roborio') {
team frc.getTeamOrDefault(2910)
roborio(getTargetTypeClass('RoboRIO')) {
team = project.frc.getTeamOrDefault(2910)
debug = project.frc.getDebugOrDefault(false)

artifacts {
frcJava(getArtifactTypeClass('FRCJavaArtifact')) {
jarTask = shadowJar
}
}
}
}
artifacts {
frcJavaArtifact('frcJava') {
jar 'shadowJar'
targets << 'roborio'
}

debug frc.getDebugOrDefault(false)
}
}
wpi {
sim.addDriverstation()
sim.addGui().defaultEnabled.set(true)

java.configureExecutableTasks(shadowJar)
java.configureTestTasks(test)
}

dependencies {
implementation wpi.deps.wpilib()
implementation wpi.deps.vendor.java()
implementation wpi.java.deps.wpilib()
implementation wpi.java.vendor.java()

roborioDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.roborio)
roborioDebug wpi.java.vendor.jniDebug(wpi.platforms.roborio)

nativeZip wpi.deps.wpilibJni(wpi.platforms.roborio)
nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
roborioRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.roborio)
roborioRelease wpi.java.vendor.jniRelease(wpi.platforms.roborio)

nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop)
nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)
nativeDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.desktop)
nativeDebug wpi.java.vendor.jniDebug(wpi.platforms.desktop)
simulationDebug wpi.sim.enableDebug()

simulation wpi.deps.sim.gui(wpi.platforms.desktop, false)
nativeRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.desktop)
nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop)
simulationRelease wpi.sim.enableRelease()

implementation project(':')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public RobotContainer() {

drivetrain.setDefaultCommand(new DriveCommand(
drivetrain,
() -> -modifyAxis(controller.getY(GenericHID.Hand.kLeft)), // Axes are flipped here on purpose
() -> -modifyAxis(controller.getX(GenericHID.Hand.kLeft)),
() -> -modifyAxis(controller.getX(GenericHID.Hand.kRight))
() -> -modifyAxis(controller.getLeftY()), // Axes are flipped here on purpose
() -> -modifyAxis(controller.getLeftX()),
() -> -modifyAxis(controller.getRightX())
));

new Button(controller::getBackButtonPressed)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.swervedrivespecialties.examples.mk3minibot.commands;

import com.swervedrivespecialties.examples.mk3minibot.subsystems.DrivetrainSubsystem;
import edu.wpi.first.wpilibj.kinematics.ChassisSpeeds;
import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.wpilibj2.command.CommandBase;

import java.util.function.DoubleSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import com.swervedrivespecialties.examples.mk3minibot.Constants;
import com.swervedrivespecialties.swervelib.Mk3SwerveModuleHelper;
import com.swervedrivespecialties.swervelib.SwerveModule;
import edu.wpi.first.wpilibj.geometry.Pose2d;
import edu.wpi.first.wpilibj.geometry.Rotation2d;
import edu.wpi.first.wpilibj.geometry.Translation2d;
import edu.wpi.first.wpilibj.kinematics.ChassisSpeeds;
import edu.wpi.first.wpilibj.kinematics.SwerveDriveKinematics;
import edu.wpi.first.wpilibj.kinematics.SwerveDriveOdometry;
import edu.wpi.first.wpilibj.kinematics.SwerveModuleState;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.math.kinematics.SwerveDriveKinematics;
import edu.wpi.first.math.kinematics.SwerveDriveOdometry;
import edu.wpi.first.math.kinematics.SwerveModuleState;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
Expand Down
Loading

0 comments on commit 24d9d53

Please sign in to comment.