Skip to content

Commit

Permalink
upgraded to wpilib 2025
Browse files Browse the repository at this point in the history
  • Loading branch information
catr1xLiu committed Oct 29, 2024
1 parent 985cd00 commit 96087fb
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 32 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2024.3.2"
id "edu.wpi.first.GradleRIO" version "2025.1.1-beta-1"
id "com.peterabeles.gversion" version "1.10"
id "com.diffplug.spotless" version "6.12.0"
}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
String frcYear = '2024'
String frcYear = '2025'
File frcHome
if (OperatingSystem.current().isWindows()) {
String publicFolder = System.getenv('PUBLIC')
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/constants/VisionConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.List;

public class VisionConstants {
public static final AprilTagFieldLayout fieldLayout = AprilTagFields.kDefaultField.loadAprilTagLayoutField();
public static final AprilTagFieldLayout fieldLayout = AprilTagFieldLayout.loadField(AprilTagFields.kDefaultField);
public static final double
/* default standard error for vision observation, if only one apriltag observed */
TRANSLATIONAL_STANDARD_ERROR_METERS_FOR_SINGLE_OBSERVATION = 0.8,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// By 5516 Iron Maple https://github.com/Shenzhen-Robotics-Alliance/ under MIT License

package frc.robot.subsystems.drive;

import com.pathplanner.lib.auto.AutoBuilder;
Expand All @@ -8,26 +6,21 @@
import com.pathplanner.lib.controllers.PPHolonomicDriveController;
import com.pathplanner.lib.path.PathConstraints;
import com.pathplanner.lib.pathfinding.Pathfinding;
import com.pathplanner.lib.util.DriveFeedforward;
import com.pathplanner.lib.util.PathPlannerLogging;
import edu.wpi.first.math.Matrix;
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.numbers.N1;
import edu.wpi.first.math.numbers.N3;
import edu.wpi.first.wpilibj2.command.Subsystem;
import frc.robot.Robot;
import frc.robot.constants.DriveTrainConstants;
import frc.robot.constants.FieldConstants;
import frc.robot.subsystems.vision.apriltags.MapleMultiTagPoseEstimator;
import frc.robot.utils.LocalADStarAK;
import org.ironmaple.utils.FieldMirroringUtils;
import org.ironmaple.utils.mathutils.MapleCommonMath;
import org.littletonrobotics.junction.Logger;

import java.util.function.Consumer;

import static frc.robot.constants.JoystickConfigs.*;
import static frc.robot.constants.DriveControlLoops.*;

Expand Down Expand Up @@ -173,7 +166,9 @@ default ChassisSpeeds constrainAcceleration(

final double maxLinearVelocityChangeIn1Period = MAX_LINEAR_ACCELERATION_METERS_PER_SEC_SQ * dtSecs;
final boolean desiredLinearVelocityReachableWithin1Period = linearVelocityDifference.getNorm() <= maxLinearVelocityChangeIn1Period;
final Translation2d linearVelocityChangeVector = new Translation2d(maxLinearVelocityChangeIn1Period, linearVelocityDifference.getAngle()),
final Translation2d linearVelocityChangeVector = new Translation2d(
maxLinearVelocityChangeIn1Period,
MapleCommonMath.getAngle(linearVelocityDifference)),
newLinearVelocity = desiredLinearVelocityReachableWithin1Period ?
desiredLinearVelocityMetersPerSec
: currentLinearVelocityMetersPerSec.plus(linearVelocityChangeVector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private void log(Pose2d robotPose, Rotation2d requestedRotation) {
"ChassisHeadingController/Error",
error.getDegrees()
);
atSetPoint = Math.abs(error.getRadians()) < chassisRotationCloseLoop.getPositionTolerance();
atSetPoint = Math.abs(error.getRadians()) < chassisRotationCloseLoop.getErrorTolerance();
}

public boolean atSetPoint() {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/frc/robot/utils/MapleJoystickDriveInput.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package frc.robot.utils;

import edu.wpi.first.math.MathUtil;
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.wpilibj.XboxController;
Expand Down Expand Up @@ -53,7 +54,7 @@ public Translation2d getTranslationalSpeedsFromJoystick(double chassisMaxVelocit
final double translationalSpeedMagnitudeScaled = Math.pow(originalTranslationalSpeed.getNorm(), LINEAR_SPEED_INPUT_EXPONENT);
return new Translation2d(
translationalSpeedMagnitudeScaled * chassisMaxVelocityMetersPerSec,
originalTranslationalSpeed.getAngle()
translationalSpeedMagnitudeScaled == 0 ? Rotation2d.fromDegrees(0) : originalTranslationalSpeed.getAngle()
);
}

Expand Down
14 changes: 7 additions & 7 deletions vendordeps/AdvantageKit.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"fileName": "AdvantageKit.json",
"name": "AdvantageKit",
"version": "3.2.1",
"version": "4.0.0-alpha-1",
"uuid": "d820cc26-74e3-11ec-90d6-0242ac120003",
"frcYear": "2024",
"frcYear": "2025",
"mavenUrls": [],
"jsonUrl": "https://github.com/Mechanical-Advantage/AdvantageKit/releases/latest/download/AdvantageKit.json",
"javaDependencies": [
{
"groupId": "org.littletonrobotics.akit.junction",
"artifactId": "wpilib-shim",
"version": "3.2.1"
"version": "4.0.0-alpha-1"
},
{
"groupId": "org.littletonrobotics.akit.junction",
"artifactId": "junction-core",
"version": "3.2.1"
"version": "4.0.0-alpha-1"
},
{
"groupId": "org.littletonrobotics.akit.conduit",
"artifactId": "conduit-api",
"version": "3.2.1"
"version": "4.0.0-alpha-1"
}
],
"jniDependencies": [
{
"groupId": "org.littletonrobotics.akit.conduit",
"artifactId": "conduit-wpilibio",
"version": "3.2.1",
"version": "4.0.0-alpha-1",
"skipInvalidPlatforms": false,
"isJar": false,
"validPlatforms": [
Expand All @@ -39,4 +39,4 @@
}
],
"cppDependencies": []
}
}
9 changes: 5 additions & 4 deletions vendordeps/PathplannerLib-beta.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"fileName": "PathplannerLib-beta.json",
"name": "PathplannerLib",
"version": "2025.0.0-beta-2",
"version": "2025.0.0-beta-3.1",
"uuid": "1b42324f-17c6-4875-8e77-1c312bc8c786",
"frcYear": "2024",
"frcYear": "2025",
"mavenUrls": [
"https://3015rangerrobotics.github.io/pathplannerlib/repo"
],
Expand All @@ -12,21 +12,22 @@
{
"groupId": "com.pathplanner.lib",
"artifactId": "PathplannerLib-java",
"version": "2025.0.0-beta-2"
"version": "2025.0.0-beta-3.1"
}
],
"jniDependencies": [],
"cppDependencies": [
{
"groupId": "com.pathplanner.lib",
"artifactId": "PathplannerLib-cpp",
"version": "2025.0.0-beta-2",
"version": "2025.0.0-beta-3.1",
"libName": "PathplannerLib",
"headerClassifier": "headers",
"sharedLibrary": false,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"osxuniversal",
"linuxx86-64",
"linuxathena",
"linuxarm32",
Expand Down
2 changes: 1 addition & 1 deletion vendordeps/Phoenix5.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"fileName": "Phoenix5.json",
"name": "CTRE-Phoenix (v5)",
"version": "5.33.1",
"frcYear": 2024,
"frcYear": 2025,
"uuid": "ab676553-b602-441f-a38d-f1296eff6537",
"mavenUrls": [
"https://maven.ctr-electronics.com/release/"
Expand Down
2 changes: 1 addition & 1 deletion vendordeps/Phoenix6.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"fileName": "Phoenix6.json",
"name": "CTRE-Phoenix (v6)",
"version": "24.3.0",
"frcYear": 2024,
"frcYear": 2025,
"uuid": "e995de00-2c64-4df5-8831-c1441420ff19",
"mavenUrls": [
"https://maven.ctr-electronics.com/release/"
Expand Down
2 changes: 1 addition & 1 deletion vendordeps/REVLib.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"fileName": "REVLib.json",
"name": "REVLib",
"version": "2024.2.4",
"frcYear": "2024",
"frcYear": "2025",
"uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb",
"mavenUrls": [
"https://maven.revrobotics.com/"
Expand Down
2 changes: 1 addition & 1 deletion vendordeps/WPILibNewCommands.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "WPILib-New-Commands",
"version": "1.0.0",
"uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266",
"frcYear": "2024",
"frcYear": "2025",
"mavenUrls": [],
"jsonUrl": "",
"javaDependencies": [
Expand Down
4 changes: 2 additions & 2 deletions vendordeps/maple-sim.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"fileName": "maple-sim.json",
"name": "maplesim",
"version": "0.1.3",
"frcYear": "2024",
"version": "0.1.5",
"frcYear": "2025",
"uuid": "c39481e8-4a63-4a4c-9df6-48d91e4da37b",
"mavenUrls": [
"https://shenzhen-robotics-alliance.github.io/maple-sim/vendordep/repos/releases"
Expand Down
2 changes: 1 addition & 1 deletion vendordeps/photonlib-json-1.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "photonlib",
"version": "v2024.3.1",
"uuid": "515fe07e-bfc6-11fa-b3de-0242ac130004",
"frcYear": "2024",
"frcYear": "2025",
"mavenUrls": [
"https://maven.photonvision.org/repository/internal",
"https://maven.photonvision.org/repository/snapshots"
Expand Down

0 comments on commit 96087fb

Please sign in to comment.