Skip to content

Commit a2cf365

Browse files
authored
Merge branch 'main' into zhangal/phoenixpro
2 parents 17f2b27 + 481ef54 commit a2cf365

File tree

10 files changed

+184
-168
lines changed

10 files changed

+184
-168
lines changed

.wpilib/wpilib_preferences.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"enableCppIntellisense": false,
33
"currentLanguage": "java",
4-
"projectYear": "2024beta",
4+
"projectYear": "2024",
55
"teamNumber": 1540
66
}

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id "java"
3-
id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-4"
3+
id "edu.wpi.first.GradleRIO" version "2024.1.1"
44
id "com.peterabeles.gversion" version "1.10"
55
}
66

@@ -20,7 +20,7 @@ deploy {
2020
// or from command line. If not found an exception will be thrown.
2121
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
2222
// want to store a team number in this file.
23-
team = project.frc.getTeamNumber()
23+
team = project.frc.getTeamOrDefault(1540)
2424
debug = project.frc.getDebugOrDefault(false)
2525

2626
artifacts {

src/main/java/org/team1540/robot2024/Constants.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
* constants are needed, to reduce verbosity.
1212
*/
1313
public final class Constants {
14-
public static final Mode currentMode = Robot.isReal() ? Mode.REAL : Mode.SIM;
14+
public static final boolean IS_COMPETITION_ROBOT = true;
15+
private static final Mode simMode = Mode.SIM; // Can also be Mode.REPLAY
16+
17+
18+
public static final Mode currentMode = Robot.isReal() ? Mode.REAL : simMode;
1519

1620
public enum Mode {
1721
/**
@@ -32,8 +36,14 @@ public enum Mode {
3236

3337
public static final double LOOP_PERIOD_SECS = 0.02;
3438

39+
public static class SwerveConfig {
40+
public static final String CAN_BUS = IS_COMPETITION_ROBOT ? "" : "";
41+
public static final int FRONT_LEFT = IS_COMPETITION_ROBOT ? 3 : 0;
42+
public static final int FRONT_RIGHT = IS_COMPETITION_ROBOT ? 4 : 0;
43+
public static final int BACK_LEFT = IS_COMPETITION_ROBOT ? 7 : 0;
44+
public static final int BACK_RIGHT = IS_COMPETITION_ROBOT ? 1 : 0;
45+
}
3546
public static class Drivetrain {
36-
public static final String CAN_BUS = "";
3747
public static final double DRIVE_GEAR_RATIO = (50.0 / 14.0) * (17.0 / 27.0) * (45.0 / 15.0);
3848
public static final double TURN_GEAR_RATIO = 150.0 / 7.0;
3949
public static final boolean IS_TURN_MOTOR_INVERTED = true;

src/main/java/org/team1540/robot2024/RobotContainer.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
import edu.wpi.first.wpilibj2.command.Command;
99
import edu.wpi.first.wpilibj2.command.Commands;
1010
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
11+
12+
1113
import org.team1540.robot2024.commands.FeedForwardCharacterization;
1214
import org.team1540.robot2024.commands.SwerveDriveCommand;
1315
import org.team1540.robot2024.subsystems.drive.*;
1416
import org.team1540.robot2024.util.swerve.SwerveFactory;
1517
import org.littletonrobotics.junction.networktables.LoggedDashboardChooser;
1618

19+
import static org.team1540.robot2024.Constants.SwerveConfig;
1720

1821
/**
1922
* This class is where the bulk of the robot should be declared. Since Command-based is a
@@ -42,10 +45,10 @@ public RobotContainer() {
4245
drivetrain =
4346
new Drivetrain(
4447
new GyroIONavx(),
45-
new ModuleIOTalonFX(SwerveFactory.getModuleMotors(3, SwerveFactory.SwerveCorner.FRONT_LEFT)),
46-
new ModuleIOTalonFX(SwerveFactory.getModuleMotors(4, SwerveFactory.SwerveCorner.FRONT_RIGHT)),
47-
new ModuleIOTalonFX(SwerveFactory.getModuleMotors(7, SwerveFactory.SwerveCorner.BACK_LEFT)),
48-
new ModuleIOTalonFX(SwerveFactory.getModuleMotors(1, SwerveFactory.SwerveCorner.BACK_RIGHT)));
48+
new ModuleIOTalonFX(SwerveFactory.getModuleMotors(SwerveConfig.FRONT_LEFT, SwerveFactory.SwerveCorner.FRONT_LEFT)),
49+
new ModuleIOTalonFX(SwerveFactory.getModuleMotors(SwerveConfig.FRONT_RIGHT, SwerveFactory.SwerveCorner.FRONT_RIGHT)),
50+
new ModuleIOTalonFX(SwerveFactory.getModuleMotors(SwerveConfig.BACK_LEFT, SwerveFactory.SwerveCorner.BACK_LEFT)),
51+
new ModuleIOTalonFX(SwerveFactory.getModuleMotors(SwerveConfig.BACK_RIGHT, SwerveFactory.SwerveCorner.BACK_RIGHT)));
4952
break;
5053

5154
case SIM:

src/main/java/org/team1540/robot2024/util/swerve/SwerveFactory.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
import com.ctre.phoenix6.signals.FeedbackSensorSourceValue;
99
import com.ctre.phoenix6.signals.InvertedValue;
1010
import com.ctre.phoenix6.signals.SensorDirectionValue;
11-
import org.team1540.robot2024.Constants;
11+
12+
import static org.team1540.robot2024.Constants.SwerveConfig.CAN_BUS;
13+
import static org.team1540.robot2024.Constants.Drivetrain.TURN_GEAR_RATIO;
14+
1215

1316
public class SwerveFactory {
1417
private static final double[] moduleOffsetsRots = new double[]{
@@ -23,7 +26,7 @@ public class SwerveFactory {
2326
};
2427

2528
public static SwerveModuleHW getModuleMotors(int id, SwerveCorner corner) {
26-
return new SwerveModuleHW(id, corner, Constants.Drivetrain.CAN_BUS);
29+
return new SwerveModuleHW(id, corner, CAN_BUS);
2730
}
2831

2932
public enum SwerveCorner {
@@ -71,7 +74,7 @@ private SwerveModuleHW(int id, SwerveCorner corner, String canbus) {
7174
turnConfig.Feedback.FeedbackRemoteSensorID = canCoderID;
7275
turnConfig.Feedback.FeedbackSensorSource = FeedbackSensorSourceValue.FusedCANcoder;
7376
turnConfig.Feedback.SensorToMechanismRatio = 1.0;
74-
turnConfig.Feedback.RotorToSensorRatio = Constants.Drivetrain.TURN_GEAR_RATIO;
77+
turnConfig.Feedback.RotorToSensorRatio = TURN_GEAR_RATIO;
7578

7679
canCoderConfig.MagnetSensor.MagnetOffset = moduleOffsetsRots[id-1] + corner.offsetRots;
7780
canCoderConfig.MagnetSensor.SensorDirection = SensorDirectionValue.CounterClockwise_Positive;

vendordeps/AdvantageKit.json

+41-41
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
{
2-
"fileName": "AdvantageKit.json",
3-
"name": "AdvantageKit",
4-
"version": "3.0.0-beta-6",
5-
"uuid": "d820cc26-74e3-11ec-90d6-0242ac120003",
6-
"frcYear": "2024",
7-
"mavenUrls": [],
8-
"jsonUrl": "https://github.com/Mechanical-Advantage/AdvantageKit/releases/latest/download/AdvantageKit.json",
9-
"javaDependencies": [
10-
{
11-
"groupId": "org.littletonrobotics.akit.junction",
12-
"artifactId": "wpilib-shim",
13-
"version": "3.0.0-beta-6"
14-
},
15-
{
16-
"groupId": "org.littletonrobotics.akit.junction",
17-
"artifactId": "junction-core",
18-
"version": "3.0.0-beta-6"
19-
},
20-
{
21-
"groupId": "org.littletonrobotics.akit.conduit",
22-
"artifactId": "conduit-api",
23-
"version": "3.0.0-beta-6"
24-
}
25-
],
26-
"jniDependencies": [
27-
{
28-
"groupId": "org.littletonrobotics.akit.conduit",
29-
"artifactId": "conduit-wpilibio",
30-
"version": "3.0.0-beta-6",
31-
"skipInvalidPlatforms": false,
32-
"isJar": false,
33-
"validPlatforms": [
34-
"linuxathena",
35-
"windowsx86-64",
36-
"linuxx86-64",
37-
"osxuniversal"
38-
]
39-
}
40-
],
41-
"cppDependencies": []
42-
}
2+
"fileName": "AdvantageKit.json",
3+
"name": "AdvantageKit",
4+
"version": "3.0.0",
5+
"uuid": "d820cc26-74e3-11ec-90d6-0242ac120003",
6+
"frcYear": "2024",
7+
"mavenUrls": [],
8+
"jsonUrl": "https://github.com/Mechanical-Advantage/AdvantageKit/releases/latest/download/AdvantageKit.json",
9+
"javaDependencies": [
10+
{
11+
"groupId": "org.littletonrobotics.akit.junction",
12+
"artifactId": "wpilib-shim",
13+
"version": "3.0.0"
14+
},
15+
{
16+
"groupId": "org.littletonrobotics.akit.junction",
17+
"artifactId": "junction-core",
18+
"version": "3.0.0"
19+
},
20+
{
21+
"groupId": "org.littletonrobotics.akit.conduit",
22+
"artifactId": "conduit-api",
23+
"version": "3.0.0"
24+
}
25+
],
26+
"jniDependencies": [
27+
{
28+
"groupId": "org.littletonrobotics.akit.conduit",
29+
"artifactId": "conduit-wpilibio",
30+
"version": "3.0.0",
31+
"skipInvalidPlatforms": false,
32+
"isJar": false,
33+
"validPlatforms": [
34+
"linuxathena",
35+
"windowsx86-64",
36+
"linuxx86-64",
37+
"osxuniversal"
38+
]
39+
}
40+
],
41+
"cppDependencies": []
42+
}

vendordeps/NavX.json

+38-38
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
{
2-
"fileName": "NavX.json",
3-
"name": "NavX",
4-
"version": "2024.0.1-beta-4",
5-
"uuid": "cb311d09-36e9-4143-a032-55bb2b94443b",
6-
"frcYear": "2024",
7-
"mavenUrls": [
8-
"https://dev.studica.com/maven/release/2024/"
9-
],
10-
"jsonUrl": "https://dev.studica.com/releases/2024/NavX.json",
11-
"javaDependencies": [
12-
{
13-
"groupId": "com.kauailabs.navx.frc",
14-
"artifactId": "navx-frc-java",
15-
"version": "2024.0.1-beta-4"
16-
}
17-
],
18-
"jniDependencies": [],
19-
"cppDependencies": [
20-
{
21-
"groupId": "com.kauailabs.navx.frc",
22-
"artifactId": "navx-frc-cpp",
23-
"version": "2024.0.1-beta-4",
24-
"headerClassifier": "headers",
25-
"sourcesClassifier": "sources",
26-
"sharedLibrary": false,
27-
"libName": "navx_frc",
28-
"skipInvalidPlatforms": true,
29-
"binaryPlatforms": [
30-
"linuxathena",
31-
"linuxraspbian",
32-
"linuxarm32",
33-
"linuxarm64",
34-
"linuxx86-64",
35-
"osxuniversal",
36-
"windowsx86-64"
37-
]
38-
}
39-
]
2+
"fileName": "NavX.json",
3+
"name": "NavX",
4+
"version": "2024.1.0",
5+
"uuid": "cb311d09-36e9-4143-a032-55bb2b94443b",
6+
"frcYear": "2024",
7+
"mavenUrls": [
8+
"https://dev.studica.com/maven/release/2024/"
9+
],
10+
"jsonUrl": "https://dev.studica.com/releases/2024/NavX.json",
11+
"javaDependencies": [
12+
{
13+
"groupId": "com.kauailabs.navx.frc",
14+
"artifactId": "navx-frc-java",
15+
"version": "2024.1.0"
16+
}
17+
],
18+
"jniDependencies": [],
19+
"cppDependencies": [
20+
{
21+
"groupId": "com.kauailabs.navx.frc",
22+
"artifactId": "navx-frc-cpp",
23+
"version": "2024.1.0",
24+
"headerClassifier": "headers",
25+
"sourcesClassifier": "sources",
26+
"sharedLibrary": false,
27+
"libName": "navx_frc",
28+
"skipInvalidPlatforms": true,
29+
"binaryPlatforms": [
30+
"linuxathena",
31+
"linuxraspbian",
32+
"linuxarm32",
33+
"linuxarm64",
34+
"linuxx86-64",
35+
"osxuniversal",
36+
"windowsx86-64"
37+
]
38+
}
39+
]
4040
}

vendordeps/PathplannerLib.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"fileName": "PathplannerLib.json",
33
"name": "PathplannerLib",
4-
"version": "2024.1.1",
4+
"version": "2024.1.3",
55
"uuid": "1b42324f-17c6-4875-8e77-1c312bc8c786",
66
"frcYear": "2024",
77
"mavenUrls": [
@@ -12,15 +12,15 @@
1212
{
1313
"groupId": "com.pathplanner.lib",
1414
"artifactId": "PathplannerLib-java",
15-
"version": "2024.1.1"
15+
"version": "2024.1.3"
1616
}
1717
],
1818
"jniDependencies": [],
1919
"cppDependencies": [
2020
{
2121
"groupId": "com.pathplanner.lib",
2222
"artifactId": "PathplannerLib-cpp",
23-
"version": "2024.1.1",
23+
"version": "2024.1.3",
2424
"libName": "PathplannerLib",
2525
"headerClassifier": "headers",
2626
"sharedLibrary": false,

vendordeps/REVLib-2024.json

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"fileName": "REVLib.json",
3+
"name": "REVLib",
4+
"version": "2024.2.0",
5+
"frcYear": "2024",
6+
"uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb",
7+
"mavenUrls": [
8+
"https://maven.revrobotics.com/"
9+
],
10+
"jsonUrl": "https://software-metadata.revrobotics.com/REVLib-2024.json",
11+
"javaDependencies": [
12+
{
13+
"groupId": "com.revrobotics.frc",
14+
"artifactId": "REVLib-java",
15+
"version": "2024.2.0"
16+
}
17+
],
18+
"jniDependencies": [
19+
{
20+
"groupId": "com.revrobotics.frc",
21+
"artifactId": "REVLib-driver",
22+
"version": "2024.2.0",
23+
"skipInvalidPlatforms": true,
24+
"isJar": false,
25+
"validPlatforms": [
26+
"windowsx86-64",
27+
"windowsx86",
28+
"linuxarm64",
29+
"linuxx86-64",
30+
"linuxathena",
31+
"linuxarm32",
32+
"osxuniversal"
33+
]
34+
}
35+
],
36+
"cppDependencies": [
37+
{
38+
"groupId": "com.revrobotics.frc",
39+
"artifactId": "REVLib-cpp",
40+
"version": "2024.2.0",
41+
"libName": "REVLib",
42+
"headerClassifier": "headers",
43+
"sharedLibrary": false,
44+
"skipInvalidPlatforms": true,
45+
"binaryPlatforms": [
46+
"windowsx86-64",
47+
"windowsx86",
48+
"linuxarm64",
49+
"linuxx86-64",
50+
"linuxathena",
51+
"linuxarm32",
52+
"osxuniversal"
53+
]
54+
},
55+
{
56+
"groupId": "com.revrobotics.frc",
57+
"artifactId": "REVLib-driver",
58+
"version": "2024.2.0",
59+
"libName": "REVLibDriver",
60+
"headerClassifier": "headers",
61+
"sharedLibrary": false,
62+
"skipInvalidPlatforms": true,
63+
"binaryPlatforms": [
64+
"windowsx86-64",
65+
"windowsx86",
66+
"linuxarm64",
67+
"linuxx86-64",
68+
"linuxathena",
69+
"linuxarm32",
70+
"osxuniversal"
71+
]
72+
}
73+
]
74+
}

0 commit comments

Comments
 (0)