Skip to content

Commit

Permalink
Update to 2024 (#5)
Browse files Browse the repository at this point in the history
* migrated libraries to 2024, imports not yet fixed

* fixed pathplanner imports and autons/swerve drive commands

Co-authored-by: MaterialEnergy <[email protected]>

* Change license to 2024

* Fix build errors, deprecations

* Change follow trajetory to FollowPathHolonomic

---------

Co-authored-by: Naowal Rahman <[email protected]>
Co-authored-by: Kalimul Kaif <[email protected]>
Co-authored-by: MaterialEnergy <[email protected]>
  • Loading branch information
4 people authored Jan 12, 2024
1 parent db16630 commit 5d8e000
Show file tree
Hide file tree
Showing 37 changed files with 782 additions and 279 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.11
- name: Set up JDK 1.17
uses: actions/setup-java@v1
with:
java-version: 1.11
java-version: 1.17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,7 @@ bin/

# Simulation GUI and other tools window save file
*-window.json

# Logs
*.wpilog
*.log
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": "2023",
"projectYear": "2024",
"teamNumber": 694
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 StuyPulse
Copyright (c) 2024 StuyPulse

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion WPILib-License.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2009-2021 FIRST and other WPILib contributors
Copyright (c) 2009-2024 FIRST and other WPILib contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
23 changes: 9 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2023.4.3"
id "com.diffplug.spotless" version "6.17.0"
id "edu.wpi.first.GradleRIO" version "2024.1.1"
id "com.diffplug.spotless" version "6.22.0"
}

allprojects {
Expand All @@ -12,12 +12,12 @@ allprojects {

// Set this to the latest version of StuyLib.
// You can check here: https://github.com/StuyPulse/StuyLib/releases.
final String STUYLIB_VERSION = 'v2023.3.3'
final String STUYLIB_VERSION = 'v2024.1.3'

def ROBOT_MAIN_CLASS = "com.stuypulse.robot.Main"

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

// Define my targets (RoboRIO) and artifacts (deployable files)
// This is added by GradleRIO's backing project DeployUtils.
Expand Down Expand Up @@ -57,7 +57,7 @@ wpi.java.debugJni = false
def includeDesktopSupport = false

// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
// Also defines JUnit 4.
// Also defines JUnit 5.
dependencies {
implementation wpi.java.deps.wpilib()
implementation wpi.java.vendor.java()
Expand Down Expand Up @@ -89,14 +89,9 @@ spotless {
enforceCheck = false
java {
targetExclude("src/main/java/com/stuypulse/robot/commands/autons/*.java")
licenseHeader '''/************************ PROJECT MIJ *************************/
/* Copyright (c) 2023 StuyPulse Robotics. All rights reserved.*/
/* This work is licensed under the terms of the MIT license. */
/**************************************************************/
licenseHeaderFile "LICENSE"

'''

// googleJavaFormat().aosp()
googleJavaFormat().aosp()

trimTrailingWhitespace()
endWithNewline()
Expand Down Expand Up @@ -133,4 +128,4 @@ wpi.java.configureTestTasks(test)
// Configure string concat to always inline compile
tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
}
}
315 changes: 315 additions & 0 deletions eclipse-formatter.xml

Large diffs are not rendered by default.

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.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=permwrapper/dists
1 change: 1 addition & 0 deletions networktables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
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 = '2023'
String frcYear = '2024'
File frcHome
if (OperatingSystem.current().isWindows()) {
String publicFolder = System.getenv('PUBLIC')
Expand Down
97 changes: 97 additions & 0 deletions simgui-ds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"keyboardJoysticks": [
{
"axisConfig": [
{
"decKey": 65,
"incKey": 68
},
{
"decKey": 87,
"incKey": 83
},
{
"decKey": 69,
"decayRate": 0.0,
"incKey": 82,
"keyRate": 0.009999999776482582
}
],
"axisCount": 3,
"buttonCount": 4,
"buttonKeys": [
90,
88,
67,
86
],
"povConfig": [
{
"key0": 328,
"key135": 323,
"key180": 322,
"key225": 321,
"key270": 324,
"key315": 327,
"key45": 329,
"key90": 326
}
],
"povCount": 1
},
{
"axisConfig": [
{
"decKey": 74,
"incKey": 76
},
{
"decKey": 73,
"incKey": 75
}
],
"axisCount": 2,
"buttonCount": 4,
"buttonKeys": [
77,
44,
46,
47
],
"povCount": 0
},
{
"axisConfig": [
{
"decKey": 263,
"incKey": 262
},
{
"decKey": 265,
"incKey": 264
}
],
"axisCount": 2,
"buttonCount": 6,
"buttonKeys": [
260,
268,
266,
261,
269,
267
],
"povCount": 0
},
{
"axisCount": 0,
"buttonCount": 0,
"povCount": 0
}
],
"robotJoysticks": [
{
"guid": "Keyboard0"
}
]
}
2 changes: 1 addition & 1 deletion src/main/java/com/stuypulse/robot/Main.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/************************ PROJECT PHIL ************************/
/* 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. */
/**************************************************************/

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/stuypulse/robot/Robot.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/************************ PROJECT PHIL ************************/
/* 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. */
/**************************************************************/

Expand Down
9 changes: 6 additions & 3 deletions src/main/java/com/stuypulse/robot/RobotContainer.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/************************ PROJECT PHIL ************************/
/* 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. */
/**************************************************************/

package com.stuypulse.robot;

import java.util.Optional;

import com.stuypulse.robot.commands.auton.DoNothingAuton;
import com.stuypulse.robot.commands.auton.DriveAndTurnBump;
import com.stuypulse.robot.commands.auton.EightFootAuton;
Expand All @@ -19,6 +21,7 @@
import com.stuypulse.stuylib.input.Gamepad;

import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DutyCycleEncoder;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
Expand Down Expand Up @@ -86,8 +89,8 @@ public Command getAutonomousCommand() {
return autonChooser.getSelected();
}

public static void setCachedAlliance(Alliance alliance) {
cachedAlliance = alliance;
public static void setCachedAlliance(Optional<Alliance> alliance) {
cachedAlliance = DriverStation.getAlliance().get();
}

public static Alliance getCachedAlliance() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/************************ PROJECT PHIL ************************/
/* 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. */
/**************************************************************/

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/stuypulse/robot/commands/TeleopInit.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/************************ PROJECT MIJ *************************/
/* 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. */
/**************************************************************/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/************************ PROJECT PHIL ************************/
/* 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. */
/**************************************************************/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
/************************ PROJECT PHIL ************************/
/* 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. */
/**************************************************************/

package com.stuypulse.robot.commands.auton;

import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;

import com.pathplanner.lib.PathConstraints;
import com.pathplanner.lib.PathPlanner;
import com.pathplanner.lib.path.PathConstraints;
import com.pathplanner.lib.path.PathPlannerPath;
import com.pathplanner.lib.commands.PathPlannerAuto;
import com.stuypulse.robot.util.SwerveDriveFollowTrajectory;

public class DriveAndTurnBump extends SequentialCommandGroup {
private static final PathConstraints CONSTRAINTS = new PathConstraints(2, 2);
private static final PathConstraints CONSTRAINTS = new PathConstraints(2, 2, 2, 2);

public DriveAndTurnBump() {
addCommands(
new SwerveDriveFollowTrajectory(
PathPlanner.loadPath("DriveAndTurnBump", CONSTRAINTS)
PathPlannerPath.fromPathFile("DriveAndTurnBump")
).robotRelative()
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
/************************ PROJECT PHIL ************************/
/* 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. */
/**************************************************************/

package com.stuypulse.robot.commands.auton;

import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;

import java.util.Arrays;

import com.pathplanner.lib.PathConstraints;
import com.pathplanner.lib.PathPlanner;
import com.pathplanner.lib.PathPlannerTrajectory;
import com.pathplanner.lib.PathPoint;
import com.pathplanner.lib.path.GoalEndState;
import com.pathplanner.lib.path.PathConstraints;
import com.pathplanner.lib.path.PathPlannerPath;
import com.pathplanner.lib.path.PathPoint;
import com.stuypulse.robot.util.SwerveDriveFollowTrajectory;

import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;

public class EightFootAuton extends SequentialCommandGroup {
private static final PathConstraints CONSTRAINTS = new PathConstraints(0.01, 0.01);
private static final PathPlannerTrajectory PATH = PathPlanner.generatePath(CONSTRAINTS, Arrays.asList(
new PathPoint(new Translation2d(), new Rotation2d(), new Rotation2d()),
new PathPoint(new Translation2d(0, 0), new Rotation2d(), new Rotation2d())
));
private static final PathConstraints CONSTRAINTS = new PathConstraints(0.01, 0.01, 0.01, 0.01);
private static final PathPlannerPath PATH = PathPlannerPath.fromPathPoints(
Arrays.asList(
new PathPoint(new Translation2d(0, 0)),
new PathPoint(new Translation2d(2.4384, 0.0))),
CONSTRAINTS, new GoalEndState(0, new Rotation2d()));

public EightFootAuton() {
addCommands(
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/stuypulse/robot/commands/auton/Mobility.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
/************************ PROJECT PHIL ************************/
/* 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. */
/**************************************************************/

package com.stuypulse.robot.commands.auton;

import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;

import com.pathplanner.lib.PathConstraints;
import com.pathplanner.lib.PathPlanner;
import com.pathplanner.lib.path.PathConstraints;
import com.pathplanner.lib.path.PathPlannerPath;
import com.pathplanner.lib.commands.PathPlannerAuto;
import com.stuypulse.robot.util.SwerveDriveFollowTrajectory;

public class Mobility extends SequentialCommandGroup {
private static final PathConstraints CONSTRAINTS = new PathConstraints(2, 2);
private static final PathConstraints CONSTRAINTS = new PathConstraints(2, 2, 2, 2);

public Mobility() {
addCommands(
new SwerveDriveFollowTrajectory(
PathPlanner.loadPath("Mobility", CONSTRAINTS)
PathPlannerPath.fromPathFile("Mobility")
).robotRelative()
);
}
Expand Down
Loading

0 comments on commit 5d8e000

Please sign in to comment.