Compare commits
55 Commits
ec73c42cfb
...
tuning
| Author | SHA1 | Date | |
|---|---|---|---|
| 918876923f | |||
|
|
208cfa3ce4 | ||
| fb937d86dc | |||
| db443cfe63 | |||
| cbcfc9cab0 | |||
| 96fb68cb32 | |||
| 80ef3a3431 | |||
| 866e6b99df | |||
| 3791333f56 | |||
|
|
7621cfd009 | ||
| e2c2eaafc9 | |||
| acf78b8ccd | |||
| 678ff1a198 | |||
| 206abe5816 | |||
| 8762e82078 | |||
| 958bc92ca0 | |||
| 88c021f05e | |||
| 01b7e1b878 | |||
| 701fbfc43e | |||
| 7f291e42a1 | |||
| 91a5281202 | |||
| f8429dc899 | |||
| 9549c5343d | |||
| cdccc8ae84 | |||
| faec33984d | |||
| e70e681366 | |||
| 9fa09a354a | |||
| 415a5b02c4 | |||
| d0945f5e23 | |||
| ee4955485c | |||
| b68d7b7399 | |||
| faff80fb9a | |||
| ffc1c0cd8b | |||
| e4a58f00df | |||
| 66049f1357 | |||
| 95108b7da7 | |||
| 22c7ec79e2 | |||
| c5df269a49 | |||
| 359a9a6bbb | |||
| 4666a74877 | |||
| 4296e2f27f | |||
| 436667d0e4 | |||
| dae39c30a0 | |||
| c6cc0c6b60 | |||
| 7c4a381f2b | |||
| c2cb06748c | |||
|
|
e531c8e191 | ||
|
|
6a59518ad8 | ||
| 7f9214ae58 | |||
| 929dd81329 | |||
| e05415452c | |||
| 47f0de2ebb | |||
| 95e15ed75e | |||
| 9e247389e8 | |||
| 58a6971704 |
10
build.gradle
10
build.gradle
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "java"
|
id "java"
|
||||||
id "edu.wpi.first.GradleRIO" version "2026.1.1"
|
id "edu.wpi.first.GradleRIO" version "2026.2.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
@@ -50,6 +50,11 @@ wpi.java.debugJni = false
|
|||||||
// Set this to true to enable desktop support.
|
// Set this to true to enable desktop support.
|
||||||
def includeDesktopSupport = true
|
def includeDesktopSupport = true
|
||||||
|
|
||||||
|
task(replayWatch, type: JavaExec) {
|
||||||
|
mainClass = "org.littletonrobotics.junction.ReplayWatch"
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
}
|
||||||
|
|
||||||
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
|
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
|
||||||
// Also defines JUnit 5.
|
// Also defines JUnit 5.
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -73,6 +78,9 @@ dependencies {
|
|||||||
|
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
|
||||||
|
def akitJson = new groovy.json.JsonSlurper().parseText(new File(projectDir.getAbsolutePath() + "/vendordeps/AdvantageKit.json").text)
|
||||||
|
annotationProcessor "org.littletonrobotics.akit:akit-autolog:$akitJson.version"
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
|||||||
31
src/main/deploy/pathplanner/autos/Outpost.auto
Normal file
31
src/main/deploy/pathplanner/autos/Outpost.auto
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"version": "2025.0",
|
||||||
|
"command": {
|
||||||
|
"type": "sequential",
|
||||||
|
"data": {
|
||||||
|
"commands": [
|
||||||
|
{
|
||||||
|
"type": "path",
|
||||||
|
"data": {
|
||||||
|
"pathName": "Start to outpost"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "path",
|
||||||
|
"data": {
|
||||||
|
"pathName": "Outpost to Ranged Shot"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "named",
|
||||||
|
"data": {
|
||||||
|
"name": "Auto Shoot"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resetOdom": true,
|
||||||
|
"folder": null,
|
||||||
|
"choreoAuto": false
|
||||||
|
}
|
||||||
1
src/main/deploy/pathplanner/navgrid.json
Normal file
1
src/main/deploy/pathplanner/navgrid.json
Normal file
File diff suppressed because one or more lines are too long
54
src/main/deploy/pathplanner/paths/Example Path.path
Normal file
54
src/main/deploy/pathplanner/paths/Example Path.path
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"version": "2025.0",
|
||||||
|
"waypoints": [
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 2.0,
|
||||||
|
"y": 7.0
|
||||||
|
},
|
||||||
|
"prevControl": null,
|
||||||
|
"nextControl": {
|
||||||
|
"x": 3.0,
|
||||||
|
"y": 7.0
|
||||||
|
},
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 4.0,
|
||||||
|
"y": 6.0
|
||||||
|
},
|
||||||
|
"prevControl": {
|
||||||
|
"x": 3.0,
|
||||||
|
"y": 6.0
|
||||||
|
},
|
||||||
|
"nextControl": null,
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rotationTargets": [],
|
||||||
|
"constraintZones": [],
|
||||||
|
"pointTowardsZones": [],
|
||||||
|
"eventMarkers": [],
|
||||||
|
"globalConstraints": {
|
||||||
|
"maxVelocity": 3.0,
|
||||||
|
"maxAcceleration": 3.0,
|
||||||
|
"maxAngularVelocity": 540.0,
|
||||||
|
"maxAngularAcceleration": 720.0,
|
||||||
|
"nominalVoltage": 12.0,
|
||||||
|
"unlimited": false
|
||||||
|
},
|
||||||
|
"goalEndState": {
|
||||||
|
"velocity": 0,
|
||||||
|
"rotation": 0.0
|
||||||
|
},
|
||||||
|
"reversed": false,
|
||||||
|
"folder": null,
|
||||||
|
"idealStartingState": {
|
||||||
|
"velocity": 0,
|
||||||
|
"rotation": 0.0
|
||||||
|
},
|
||||||
|
"useDefaultConstraints": true
|
||||||
|
}
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
{
|
||||||
|
"version": "2025.0",
|
||||||
|
"waypoints": [
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 2.0,
|
||||||
|
"y": 4.0
|
||||||
|
},
|
||||||
|
"prevControl": null,
|
||||||
|
"nextControl": {
|
||||||
|
"x": 2.572076308784383,
|
||||||
|
"y": 3.3951907719609573
|
||||||
|
},
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 3.1112866015971603,
|
||||||
|
"y": 2.6628305235137533
|
||||||
|
},
|
||||||
|
"prevControl": {
|
||||||
|
"x": 2.8612866015971603,
|
||||||
|
"y": 2.6628305235137533
|
||||||
|
},
|
||||||
|
"nextControl": {
|
||||||
|
"x": 3.3612866015971603,
|
||||||
|
"y": 2.6628305235137533
|
||||||
|
},
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 5.839529724933453,
|
||||||
|
"y": 2.357009760425909
|
||||||
|
},
|
||||||
|
"prevControl": {
|
||||||
|
"x": 5.055196983507387,
|
||||||
|
"y": 2.7986728575396165
|
||||||
|
},
|
||||||
|
"nextControl": {
|
||||||
|
"x": 6.668464951197871,
|
||||||
|
"y": 1.890230700976042
|
||||||
|
},
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 6.612129547471162,
|
||||||
|
"y": 0.8279059449866895
|
||||||
|
},
|
||||||
|
"prevControl": {
|
||||||
|
"x": 6.3623142538133335,
|
||||||
|
"y": 0.8182976644613882
|
||||||
|
},
|
||||||
|
"nextControl": {
|
||||||
|
"x": 7.030621118012423,
|
||||||
|
"y": 0.844001774622892
|
||||||
|
},
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 8.189520851818989,
|
||||||
|
"y": 0.8279059449866895
|
||||||
|
},
|
||||||
|
"prevControl": {
|
||||||
|
"x": 8.08578683847011,
|
||||||
|
"y": 0.49077040160283747
|
||||||
|
},
|
||||||
|
"nextControl": {
|
||||||
|
"x": 8.318287488908608,
|
||||||
|
"y": 1.246397515527949
|
||||||
|
},
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 8.189520851818989,
|
||||||
|
"y": 7.111241666666667
|
||||||
|
},
|
||||||
|
"prevControl": {
|
||||||
|
"x": 8.36001268105017,
|
||||||
|
"y": 7.294087328812116
|
||||||
|
},
|
||||||
|
"nextControl": {
|
||||||
|
"x": 6.244366666666667,
|
||||||
|
"y": 5.025141666666666
|
||||||
|
},
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 2.518108333333333,
|
||||||
|
"y": 5.592016666666666
|
||||||
|
},
|
||||||
|
"prevControl": {
|
||||||
|
"x": 3.205916666666667,
|
||||||
|
"y": 5.644925000000001
|
||||||
|
},
|
||||||
|
"nextControl": null,
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rotationTargets": [
|
||||||
|
{
|
||||||
|
"waypointRelativePos": 1,
|
||||||
|
"rotationDegrees": 45.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"waypointRelativePos": 2,
|
||||||
|
"rotationDegrees": 45.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"waypointRelativePos": 3,
|
||||||
|
"rotationDegrees": -135.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"waypointRelativePos": 5,
|
||||||
|
"rotationDegrees": -135.0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constraintZones": [],
|
||||||
|
"pointTowardsZones": [],
|
||||||
|
"eventMarkers": [],
|
||||||
|
"globalConstraints": {
|
||||||
|
"maxVelocity": 3.0,
|
||||||
|
"maxAcceleration": 3.0,
|
||||||
|
"maxAngularVelocity": 540.0,
|
||||||
|
"maxAngularAcceleration": 720.0,
|
||||||
|
"nominalVoltage": 12.0,
|
||||||
|
"unlimited": false
|
||||||
|
},
|
||||||
|
"goalEndState": {
|
||||||
|
"velocity": 0,
|
||||||
|
"rotation": -133.87669728592465
|
||||||
|
},
|
||||||
|
"reversed": false,
|
||||||
|
"folder": null,
|
||||||
|
"idealStartingState": {
|
||||||
|
"velocity": 0,
|
||||||
|
"rotation": 0.0
|
||||||
|
},
|
||||||
|
"useDefaultConstraints": true
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"version": "2025.0",
|
||||||
|
"waypoints": [
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 0.7089624329216013,
|
||||||
|
"y": 0.668228980317108
|
||||||
|
},
|
||||||
|
"prevControl": null,
|
||||||
|
"nextControl": {
|
||||||
|
"x": 2.1043470483005366,
|
||||||
|
"y": 0.7169051878354196
|
||||||
|
},
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": "Outpost"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 2.3639534883720925,
|
||||||
|
"y": 2.9722361359570666
|
||||||
|
},
|
||||||
|
"prevControl": {
|
||||||
|
"x": 2.234150268336314,
|
||||||
|
"y": 2.5666010733452596
|
||||||
|
},
|
||||||
|
"nextControl": null,
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rotationTargets": [],
|
||||||
|
"constraintZones": [],
|
||||||
|
"pointTowardsZones": [],
|
||||||
|
"eventMarkers": [],
|
||||||
|
"globalConstraints": {
|
||||||
|
"maxVelocity": 3.0,
|
||||||
|
"maxAcceleration": 3.0,
|
||||||
|
"maxAngularVelocity": 540.0,
|
||||||
|
"maxAngularAcceleration": 720.0,
|
||||||
|
"nominalVoltage": 12.0,
|
||||||
|
"unlimited": false
|
||||||
|
},
|
||||||
|
"goalEndState": {
|
||||||
|
"velocity": 0,
|
||||||
|
"rotation": 24.304549265936604
|
||||||
|
},
|
||||||
|
"reversed": false,
|
||||||
|
"folder": "Right Outpost",
|
||||||
|
"idealStartingState": {
|
||||||
|
"velocity": 0,
|
||||||
|
"rotation": 180.0
|
||||||
|
},
|
||||||
|
"useDefaultConstraints": true
|
||||||
|
}
|
||||||
66
src/main/deploy/pathplanner/paths/Start to outpost.path
Normal file
66
src/main/deploy/pathplanner/paths/Start to outpost.path
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
"version": "2025.0",
|
||||||
|
"waypoints": [
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 3.6619856887266913,
|
||||||
|
"y": 2.2583184257605784
|
||||||
|
},
|
||||||
|
"prevControl": null,
|
||||||
|
"nextControl": {
|
||||||
|
"x": 2.4937567084046877,
|
||||||
|
"y": 1.3172450805011864
|
||||||
|
},
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"anchor": {
|
||||||
|
"x": 0.7089624329216013,
|
||||||
|
"y": 0.668228980317108
|
||||||
|
},
|
||||||
|
"prevControl": {
|
||||||
|
"x": 1.6987119856944102,
|
||||||
|
"y": 1.0414132379199703
|
||||||
|
},
|
||||||
|
"nextControl": null,
|
||||||
|
"isLocked": false,
|
||||||
|
"linkedName": "Outpost"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rotationTargets": [
|
||||||
|
{
|
||||||
|
"waypointRelativePos": 0.7234468937875753,
|
||||||
|
"rotationDegrees": 180.0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constraintZones": [],
|
||||||
|
"pointTowardsZones": [],
|
||||||
|
"eventMarkers": [
|
||||||
|
{
|
||||||
|
"name": "Intake Start",
|
||||||
|
"waypointRelativePos": 0.4500000000000002,
|
||||||
|
"endWaypointRelativePos": null,
|
||||||
|
"command": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"globalConstraints": {
|
||||||
|
"maxVelocity": 3.0,
|
||||||
|
"maxAcceleration": 3.0,
|
||||||
|
"maxAngularVelocity": 540.0,
|
||||||
|
"maxAngularAcceleration": 720.0,
|
||||||
|
"nominalVoltage": 12.0,
|
||||||
|
"unlimited": false
|
||||||
|
},
|
||||||
|
"goalEndState": {
|
||||||
|
"velocity": 0,
|
||||||
|
"rotation": 180.0
|
||||||
|
},
|
||||||
|
"reversed": false,
|
||||||
|
"folder": "Right Outpost",
|
||||||
|
"idealStartingState": {
|
||||||
|
"velocity": 0,
|
||||||
|
"rotation": 180.0
|
||||||
|
},
|
||||||
|
"useDefaultConstraints": true
|
||||||
|
}
|
||||||
36
src/main/deploy/pathplanner/settings.json
Normal file
36
src/main/deploy/pathplanner/settings.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"robotWidth": 0.921,
|
||||||
|
"robotLength": 0.787,
|
||||||
|
"holonomicMode": true,
|
||||||
|
"pathFolders": [
|
||||||
|
"Right Outpost"
|
||||||
|
],
|
||||||
|
"autoFolders": [],
|
||||||
|
"defaultMaxVel": 3.0,
|
||||||
|
"defaultMaxAccel": 3.0,
|
||||||
|
"defaultMaxAngVel": 540.0,
|
||||||
|
"defaultMaxAngAccel": 720.0,
|
||||||
|
"defaultNominalVoltage": 12.0,
|
||||||
|
"robotMass": 64.864,
|
||||||
|
"robotMOI": 37.809,
|
||||||
|
"robotTrackwidth": 0.546,
|
||||||
|
"driveWheelRadius": 0.051,
|
||||||
|
"driveGearing": 6.122,
|
||||||
|
"maxDriveSpeed": 4.66,
|
||||||
|
"driveMotorType": "krakenX60",
|
||||||
|
"driveCurrentLimit": 65.0,
|
||||||
|
"wheelCOF": 1.2,
|
||||||
|
"flModuleX": 0.238,
|
||||||
|
"flModuleY": 0.3015,
|
||||||
|
"frModuleX": 0.238,
|
||||||
|
"frModuleY": -0.3015,
|
||||||
|
"blModuleX": -0.238,
|
||||||
|
"blModuleY": 0.3015,
|
||||||
|
"brModuleX": -0.238,
|
||||||
|
"brModuleY": -0.3015,
|
||||||
|
"bumperOffsetX": 0.0,
|
||||||
|
"bumperOffsetY": 0.0,
|
||||||
|
"robotFeatures": [
|
||||||
|
"{\"name\":\"Rectangle\",\"type\":\"rounded_rect\",\"data\":{\"center\":{\"x\":0.55,\"y\":0.0},\"size\":{\"width\":0.921,\"length\":0.305},\"borderRadius\":0.05,\"strokeWidth\":0.02,\"filled\":false}}"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -4,16 +4,45 @@
|
|||||||
|
|
||||||
package frc.robot;
|
package frc.robot;
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj.TimedRobot;
|
import org.littletonrobotics.junction.LogFileUtil;
|
||||||
|
import org.littletonrobotics.junction.LoggedRobot;
|
||||||
|
import org.littletonrobotics.junction.Logger;
|
||||||
|
import org.littletonrobotics.junction.networktables.NT4Publisher;
|
||||||
|
import org.littletonrobotics.junction.wpilog.WPILOGReader;
|
||||||
|
import org.littletonrobotics.junction.wpilog.WPILOGWriter;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj.PowerDistribution;
|
||||||
|
import edu.wpi.first.wpilibj.PowerDistribution.ModuleType;
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import edu.wpi.first.wpilibj2.command.CommandScheduler;
|
import edu.wpi.first.wpilibj2.command.CommandScheduler;
|
||||||
|
import frc.robot.constants.CompetitionConstants;
|
||||||
|
|
||||||
public class Robot extends TimedRobot {
|
public class Robot extends LoggedRobot {
|
||||||
private Command m_autonomousCommand;
|
private Command m_autonomousCommand;
|
||||||
|
|
||||||
private final RobotContainer m_robotContainer;
|
private final RobotContainer m_robotContainer;
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
public Robot() {
|
public Robot() {
|
||||||
|
Logger.recordMetadata("ProjectName", "2026_Robot_Code");
|
||||||
|
|
||||||
|
if(isReal()) {
|
||||||
|
if(CompetitionConstants.kLogToNetworkTables) {
|
||||||
|
Logger.addDataReceiver(new NT4Publisher());
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.addDataReceiver(new WPILOGWriter());
|
||||||
|
|
||||||
|
new PowerDistribution(1, ModuleType.kRev);
|
||||||
|
} else {
|
||||||
|
setUseTiming(false);
|
||||||
|
String logPath = LogFileUtil.findReplayLog();
|
||||||
|
Logger.setReplaySource(new WPILOGReader(logPath));
|
||||||
|
Logger.addDataReceiver(new WPILOGWriter(LogFileUtil.addPathSuffix(logPath, "_sim")));
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.start();
|
||||||
|
|
||||||
m_robotContainer = new RobotContainer();
|
m_robotContainer = new RobotContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,17 +4,393 @@
|
|||||||
|
|
||||||
package frc.robot;
|
package frc.robot;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj.DriverStation.Alliance;
|
||||||
|
|
||||||
|
import java.util.OptionalDouble;
|
||||||
|
|
||||||
|
import org.littletonrobotics.junction.Logger;
|
||||||
|
|
||||||
|
import com.pathplanner.lib.auto.AutoBuilder;
|
||||||
|
import com.pathplanner.lib.auto.NamedCommands;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.geometry.Pose2d;
|
||||||
|
import edu.wpi.first.wpilibj.Timer;
|
||||||
|
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
||||||
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import edu.wpi.first.wpilibj2.command.Commands;
|
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
||||||
|
import edu.wpi.first.wpilibj2.command.PrintCommand;
|
||||||
|
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||||
|
import edu.wpi.first.wpilibj2.command.button.RobotModeTriggers;
|
||||||
|
import edu.wpi.first.wpilibj2.command.button.Trigger;
|
||||||
|
import frc.robot.constants.AutoConstants;
|
||||||
|
import frc.robot.constants.CompetitionConstants;
|
||||||
|
import frc.robot.constants.HoodConstants;
|
||||||
|
import frc.robot.constants.OIConstants;
|
||||||
|
import frc.robot.constants.ShooterConstants;
|
||||||
|
import frc.robot.constants.IntakePivotConstants.IntakePivotPosition;
|
||||||
|
import frc.robot.constants.ShooterConstants.ShooterSpeeds;
|
||||||
|
import frc.robot.subsystems.Climber;
|
||||||
|
import frc.robot.subsystems.Drivetrain;
|
||||||
|
import frc.robot.subsystems.Hood;
|
||||||
|
import frc.robot.subsystems.IntakePivot;
|
||||||
|
import frc.robot.subsystems.IntakeRoller;
|
||||||
|
import frc.robot.subsystems.PhotonVision;
|
||||||
|
import frc.robot.subsystems.Shooter;
|
||||||
|
import frc.robot.subsystems.Spindexer;
|
||||||
|
import frc.robot.utilities.Elastic;
|
||||||
|
import frc.robot.utilities.Utilities;
|
||||||
|
|
||||||
public class RobotContainer {
|
public class RobotContainer {
|
||||||
public RobotContainer() {
|
private PhotonVision vision;
|
||||||
configureBindings();
|
private Drivetrain drivetrain;
|
||||||
}
|
private Hood hood;
|
||||||
|
private Shooter shooter;
|
||||||
|
private IntakePivot intakePivot;
|
||||||
|
private IntakeRoller intakeRoller;
|
||||||
|
private Spindexer spindexer;
|
||||||
|
//private Climber climber;
|
||||||
|
|
||||||
private void configureBindings() {}
|
private CommandXboxController driver;
|
||||||
|
private CommandXboxController secondary;
|
||||||
|
|
||||||
public Command getAutonomousCommand() {
|
private SendableChooser<Command> autoChooser;
|
||||||
return Commands.print("No autonomous command configured");
|
|
||||||
}
|
private Timer shiftTimer;
|
||||||
|
|
||||||
|
public RobotContainer() {
|
||||||
|
vision = new PhotonVision();
|
||||||
|
drivetrain = new Drivetrain(null);
|
||||||
|
hood = new Hood();
|
||||||
|
shooter = new Shooter();
|
||||||
|
intakePivot = new IntakePivot();
|
||||||
|
intakeRoller = new IntakeRoller();
|
||||||
|
spindexer = new Spindexer();
|
||||||
|
//climber = new Climber();
|
||||||
|
|
||||||
|
|
||||||
|
vision.addPoseEstimateConsumer(drivetrain::consumeVisualPose);
|
||||||
|
vision.addPoseEstimateConsumer((vp) -> {
|
||||||
|
Logger.recordOutput(
|
||||||
|
"Vision/" + vp.cameraName() + "/Pose",
|
||||||
|
vp.visualPose()
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
driver = new CommandXboxController(OIConstants.kDriverControllerPort);
|
||||||
|
secondary = new CommandXboxController(OIConstants.kOperatorControllerPort);
|
||||||
|
|
||||||
|
shiftTimer = new Timer();
|
||||||
|
shiftTimer.reset();
|
||||||
|
|
||||||
|
//configureBindings();
|
||||||
|
testConfigureBindings();
|
||||||
|
configureShiftDisplay();
|
||||||
|
|
||||||
|
if(AutoConstants.kAutoConfigOk) {
|
||||||
|
autoChooser = AutoBuilder.buildAutoChooser();
|
||||||
|
configureNamedCommands();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Before you @ mention me for terrible match controls, these are <i>TEST BINDINGS</i>
|
||||||
|
*
|
||||||
|
* The are configured in such a way to make testing of multiple systems possible without
|
||||||
|
* having to constantly change bindings.
|
||||||
|
*
|
||||||
|
* Most of the configurations here won't make sense for actual competition play. See
|
||||||
|
* {@link #configureBindings()} for actual competition play
|
||||||
|
*
|
||||||
|
* The intent of each binding is outlined by comments above each binding.
|
||||||
|
*/
|
||||||
|
private void testConfigureBindings() {
|
||||||
|
// This should just work, if it doesn't it's likely modules aren't assigned the right IDs
|
||||||
|
// after the electronics rebuild. For testing normal operation nothing about the Drivetrain
|
||||||
|
// class should need to change
|
||||||
|
//drivetrain.setDefaultCommand(drivetrain.drive(() -> 0, () -> 0, () -> 0, () -> true));
|
||||||
|
drivetrain.setDefaultCommand(
|
||||||
|
drivetrain.drive(
|
||||||
|
driver::getLeftY,
|
||||||
|
driver::getLeftX,
|
||||||
|
driver::getRightX,
|
||||||
|
() -> true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
driver.y().whileTrue(drivetrain.zeroHeading());
|
||||||
|
/*
|
||||||
|
// This needs to be tested after a prolonged amount of driving around <i>aggressively</i>.
|
||||||
|
// Do things like going over the bump repeatedly, spin around a bunch, etc.
|
||||||
|
// If this works well over time, then this is likely all we need
|
||||||
|
driver.a().whileTrue(
|
||||||
|
drivetrain.lockRotationToHub(
|
||||||
|
driver::getLeftY,
|
||||||
|
driver::getLeftX,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// This can be tested as an alternative to the above, it's less dynamic, but is a simpler
|
||||||
|
// alternative.
|
||||||
|
driver.b().whileTrue(
|
||||||
|
drivetrain.lockToYaw(
|
||||||
|
() -> {
|
||||||
|
OptionalDouble maybeYaw = vision.getBestYawForTag(Utilities.getHubCenterAprilTagID());
|
||||||
|
|
||||||
|
return maybeYaw.isEmpty() ? 0 : maybeYaw.getAsDouble();
|
||||||
|
},
|
||||||
|
driver::getLeftY,
|
||||||
|
driver::getLeftX
|
||||||
|
)
|
||||||
|
);*/
|
||||||
|
|
||||||
|
// Stop everything by default other than the drivetrain
|
||||||
|
shooter.setDefaultCommand(shooter.stop());
|
||||||
|
intakePivot.setDefaultCommand(intakePivot.stop());
|
||||||
|
intakeRoller.setDefaultCommand(intakeRoller.stop());
|
||||||
|
hood.setDefaultCommand(hood.stop());
|
||||||
|
spindexer.setDefaultCommand(spindexer.stop());
|
||||||
|
//climber.setDefaultCommand(climber.stop());
|
||||||
|
|
||||||
|
// While holding POV up of the driver controller, the climber
|
||||||
|
// should move such that its motor moves the climber down with the left
|
||||||
|
// driver controller trigger axis, and up with the right driver controller
|
||||||
|
// trigger axis.
|
||||||
|
// DO NOT INVERT MOTION WITH UNARY MINUS (-). Every motor can be inverted
|
||||||
|
// from the constants file for the subsystem having the problem.
|
||||||
|
//driver.povUp().whileTrue(climber.manualSpeed(() -> {
|
||||||
|
// return driver.getLeftTriggerAxis() * -1 + driver.getRightTriggerAxis();
|
||||||
|
//}));
|
||||||
|
|
||||||
|
// While holding the right bumper of the driver controller, the intake rollers
|
||||||
|
// and the spindexer and feeder should move such that all motors are moving in such a way
|
||||||
|
// that it would draw balls from the floor, through the spindexer, and into the
|
||||||
|
// feeder.
|
||||||
|
// DO NOT INVERT MOTION WITH UNARY MINUS (-). Every motor can be inverted from the
|
||||||
|
// constants file for the subsystem having the problem
|
||||||
|
driver.rightBumper().whileTrue(
|
||||||
|
spindexer.spinToShooter()
|
||||||
|
);
|
||||||
|
|
||||||
|
// While holding the left bumper of the driver controller, the intake rollers
|
||||||
|
// and the spindexer and feeder should move such that all motors are moving in such a way
|
||||||
|
// that it would try to eject balls through the intake.
|
||||||
|
// DO NOT INVERT MOTION WITH UNARY MINUS (-). Every motor can be inverted from the
|
||||||
|
// constants file for the subsystem having the problem
|
||||||
|
driver.leftBumper().whileTrue(
|
||||||
|
intakeRoller.runIn()
|
||||||
|
//intakeRoller.runOut().alongWith(spindexer.spinToIntake())
|
||||||
|
);
|
||||||
|
|
||||||
|
// While holding D-Pad up on the secondary controller, the shooter should spin
|
||||||
|
// while holding down the secondary controllers right trigger some amount.
|
||||||
|
// DO NOT INVERT MOTION WITH UNARY MINUS (-). Every motor can be inverted from the
|
||||||
|
// constants file for the subsystem having the problem
|
||||||
|
secondary.povUp().whileTrue(
|
||||||
|
shooter.manualSpeed(secondary::getRightTriggerAxis)
|
||||||
|
);
|
||||||
|
|
||||||
|
// While holding D-Pad down on the seconadry controller, the intakePivot should move
|
||||||
|
// such that left trigger on the secondary controller moves the pivot down, and
|
||||||
|
// right trigger on the secondary controller moves the pivot up.
|
||||||
|
// DO NOT INVERT MOTION WITH UNARY MINUS (-). Every motor can be inverted from the
|
||||||
|
// constants file for the subsystem having the problem
|
||||||
|
secondary.povDown().whileTrue(
|
||||||
|
intakePivot.manualSpeed(() -> {
|
||||||
|
return secondary.getLeftTriggerAxis() * -1 + secondary.getRightTriggerAxis();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// While holding D-Pad left on the secondary controller, the hood should move
|
||||||
|
// such that the left trigger on the secondary controller moves the hood down, and
|
||||||
|
// right trigger on the secondary controller moves the hood up.
|
||||||
|
// DO NOT INVERT MOTION WITH UNARY MINUS (-). Every motor can be inverted from the
|
||||||
|
// constants file for the subsystem having the problem
|
||||||
|
secondary.povLeft().whileTrue(
|
||||||
|
hood.manualSpeed(() -> {
|
||||||
|
return secondary.getLeftTriggerAxis() * -1 + secondary.getRightTriggerAxis();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP
|
||||||
|
// Don't proceed unless you've verified by hand or with the above bindings, that sensing
|
||||||
|
// systems are providing correct values in the correct direction of rotation.
|
||||||
|
|
||||||
|
|
||||||
|
// Useful for testing PID and FF responses of the shooter
|
||||||
|
// You need to have graphs up of the logged data to make sure the response is correct
|
||||||
|
secondary.a().whileTrue(shooter.maintainSpeed(ShooterSpeeds.kHubSpeed));
|
||||||
|
secondary.b().whileTrue(shooter.maintainSpeed(ShooterSpeeds.kFeedSpeed));
|
||||||
|
|
||||||
|
// Useful for testing PID and FF responses of the intake pivot
|
||||||
|
// You need to have graphs up of the logged data to make sure the response is correct
|
||||||
|
secondary.x().whileTrue(intakePivot.maintainPosition(IntakePivotPosition.kDown));
|
||||||
|
secondary.y().whileTrue(intakePivot.maintainPosition(IntakePivotPosition.kUp));
|
||||||
|
|
||||||
|
secondary.povUp().whileTrue(hood.trackToAngle(() -> Math.toRadians(40.0)));
|
||||||
|
secondary.povDown().whileTrue(hood.trackToAngle(() -> Math.toRadians(0.0)));
|
||||||
|
|
||||||
|
|
||||||
|
// TODO Some means of testing hood PIDF
|
||||||
|
// TODO Some means of testing climber PIDF
|
||||||
|
}
|
||||||
|
|
||||||
|
private void configureBindings() {
|
||||||
|
drivetrain.setDefaultCommand(
|
||||||
|
drivetrain.drive(
|
||||||
|
driver::getLeftY,
|
||||||
|
driver::getLeftX,
|
||||||
|
driver::getRightX,
|
||||||
|
() -> true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
driver.a().whileTrue(
|
||||||
|
drivetrain.lockRotationToHub(
|
||||||
|
driver::getLeftY,
|
||||||
|
driver::getLeftX,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
driver.b().whileTrue(
|
||||||
|
drivetrain.lockToYaw(
|
||||||
|
() -> {
|
||||||
|
OptionalDouble maybeYaw = vision.getBestYawForTag(Utilities.getHubCenterAprilTagID());
|
||||||
|
|
||||||
|
return maybeYaw.isEmpty() ? 0 : maybeYaw.getAsDouble();
|
||||||
|
},
|
||||||
|
driver::getLeftY,
|
||||||
|
driver::getLeftX
|
||||||
|
)
|
||||||
|
);*/
|
||||||
|
|
||||||
|
shooter.setDefaultCommand(
|
||||||
|
shooter.maintainSpeed(ShooterSpeeds.kHubSpeed)
|
||||||
|
);
|
||||||
|
|
||||||
|
hood.setDefaultCommand(hood.trackToAngle(() -> {
|
||||||
|
Pose2d drivetrainPose = drivetrain.getPose();
|
||||||
|
Pose2d hubPose = Utilities.getHubPose();
|
||||||
|
|
||||||
|
double distance = drivetrainPose.getTranslation()
|
||||||
|
.plus(CompetitionConstants.kRobotToShooter.getTranslation().toTranslation2d())
|
||||||
|
.getDistance(hubPose.getTranslation());
|
||||||
|
|
||||||
|
if(HoodConstants.kUseInterpolatorForAngle) {
|
||||||
|
return HoodConstants.kDistanceToAngle.get(distance);
|
||||||
|
} else {
|
||||||
|
// TODO The average actual speeds isn't <i>really</i> the exit velocity of the ball
|
||||||
|
// on a hooded shooter, based on documentation, it's more like 30-50% depending on
|
||||||
|
// hood material, surface friction, etc.
|
||||||
|
return Utilities.shotAngle(
|
||||||
|
shooter.getAverageActualSpeeds(),
|
||||||
|
distance,
|
||||||
|
CompetitionConstants.kHubGoalHeightMeters - ShooterConstants.kShooterHeightMeters,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void configureNamedCommands() {
|
||||||
|
NamedCommands.registerCommand(
|
||||||
|
"Drivetrain Set X",
|
||||||
|
drivetrain.setX()
|
||||||
|
);
|
||||||
|
|
||||||
|
NamedCommands.registerCommand(
|
||||||
|
"Drivetrain Face Hub",
|
||||||
|
drivetrain.rotateToPose(
|
||||||
|
Utilities.getHubPose(),
|
||||||
|
false // TODO Should this be true by default?
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command getAutonomousCommand() {
|
||||||
|
if(AutoConstants.kAutoConfigOk) {
|
||||||
|
return autoChooser.getSelected();
|
||||||
|
} else {
|
||||||
|
return new PrintCommand("Robot Config loading failed, autonomous disabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The "shift display" relies on Elastic's ability to show 1 or more colors
|
||||||
|
* in a box on the dashboard.
|
||||||
|
*
|
||||||
|
* Using the RobotModeTriggers and a Timer based on the FPGA, a reasonably
|
||||||
|
* accurate "shift display" can be created to indicate whose hub is active
|
||||||
|
* and when.
|
||||||
|
*
|
||||||
|
* During autonomous, and the first 10 seconds of teleop, the shift display
|
||||||
|
* will display a gradient of both red and blue, indicating the fact that
|
||||||
|
* both hubs are active.
|
||||||
|
*
|
||||||
|
* For the rest of teleop, with the exception of the endgame, the display
|
||||||
|
* will present either the color red, or the color blue, based on the returned
|
||||||
|
* value of Utilities.whoHasFirstShift(). Because shifts change on a known cycle,
|
||||||
|
* we can use the known state of who has first shift, to determine the remaining three shifts
|
||||||
|
* that come after.
|
||||||
|
*
|
||||||
|
* For the endgame portion of teleop, the shift display returns to the gradient
|
||||||
|
* of both red and blue.
|
||||||
|
*
|
||||||
|
* Because this relies on the RobotModeTriggers and an FPGA timer, it should be
|
||||||
|
* <i>reasonably</i> accurate, it's unlikely to be perfect relative to field time
|
||||||
|
* but it will be very very very (likely unnoticably) close.
|
||||||
|
*/
|
||||||
|
private void configureShiftDisplay() {
|
||||||
|
SmartDashboard.putStringArray(OIConstants.kCurrentActiveHub, OIConstants.kRedBlueDisplay);
|
||||||
|
|
||||||
|
RobotModeTriggers.autonomous().onTrue(new InstantCommand(() -> {
|
||||||
|
shiftTimer.stop();
|
||||||
|
SmartDashboard.putStringArray(OIConstants.kCurrentActiveHub, OIConstants.kRedBlueDisplay);
|
||||||
|
}));
|
||||||
|
|
||||||
|
RobotModeTriggers.teleop().onTrue(new InstantCommand(() -> {
|
||||||
|
Elastic.selectTab(OIConstants.kTeleopTab);
|
||||||
|
shiftTimer.reset();
|
||||||
|
shiftTimer.start();
|
||||||
|
}));
|
||||||
|
|
||||||
|
new Trigger(() -> shiftTimer.get() <= 10).onTrue(new InstantCommand(() -> {
|
||||||
|
SmartDashboard.putStringArray(OIConstants.kCurrentActiveHub, OIConstants.kRedBlueDisplay);
|
||||||
|
}));
|
||||||
|
|
||||||
|
new Trigger(() -> shiftTimer.get() > 10 && shiftTimer.get() <= 35).onTrue(new InstantCommand(() -> {
|
||||||
|
SmartDashboard.putStringArray(
|
||||||
|
OIConstants.kCurrentActiveHub,
|
||||||
|
Utilities.whoHasFirstShift() == Alliance.Red ? OIConstants.kRedDisplay : OIConstants.kBlueDisplay
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
|
||||||
|
new Trigger(() -> shiftTimer.get() > 35 && shiftTimer.get() <= 60).onTrue(new InstantCommand(() -> {
|
||||||
|
SmartDashboard.putStringArray(
|
||||||
|
OIConstants.kCurrentActiveHub,
|
||||||
|
Utilities.whoHasFirstShift() == Alliance.Red ? OIConstants.kBlueDisplay : OIConstants.kRedDisplay
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
|
||||||
|
new Trigger(() -> shiftTimer.get() > 60 && shiftTimer.get() <= 85).onTrue(new InstantCommand(() -> {
|
||||||
|
SmartDashboard.putStringArray(
|
||||||
|
OIConstants.kCurrentActiveHub,
|
||||||
|
Utilities.whoHasFirstShift() == Alliance.Red ? OIConstants.kRedDisplay : OIConstants.kBlueDisplay
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
|
||||||
|
new Trigger(() -> shiftTimer.get() > 85 && shiftTimer.get() <= 110).onTrue(new InstantCommand(() -> {
|
||||||
|
SmartDashboard.putStringArray(
|
||||||
|
OIConstants.kCurrentActiveHub,
|
||||||
|
Utilities.whoHasFirstShift() == Alliance.Red ? OIConstants.kBlueDisplay : OIConstants.kRedDisplay
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
|
||||||
|
new Trigger(() -> shiftTimer.get() > 110).onTrue(new InstantCommand(() -> {
|
||||||
|
SmartDashboard.putStringArray(OIConstants.kCurrentActiveHub, OIConstants.kRedBlueDisplay);
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
65
src/main/java/frc/robot/constants/AutoConstants.java
Normal file
65
src/main/java/frc/robot/constants/AutoConstants.java
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.json.simple.parser.ParseException;
|
||||||
|
|
||||||
|
import com.pathplanner.lib.config.PIDConstants;
|
||||||
|
import com.pathplanner.lib.config.RobotConfig;
|
||||||
|
import com.pathplanner.lib.controllers.PPHolonomicDriveController;
|
||||||
|
import com.pathplanner.lib.path.PathConstraints;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.trajectory.TrapezoidProfile;
|
||||||
|
import edu.wpi.first.math.util.Units;
|
||||||
|
|
||||||
|
// TODO This is all hold over from 2025, does any of it need to change?
|
||||||
|
public class AutoConstants {
|
||||||
|
public static final double kMaxSpeedMetersPerSecond = 4;
|
||||||
|
public static final double kMaxAccelerationMetersPerSecondSquared = 4;
|
||||||
|
public static final double kMaxAngularSpeedRadiansPerSecond = Math.PI;
|
||||||
|
public static final double kMaxAngularAccelerationRadiansPerSecondSquared = Math.PI;
|
||||||
|
|
||||||
|
public static final double kMaxSpeedMetersPerSecondAutoAlign = 2.5;
|
||||||
|
|
||||||
|
public static final double kPXYController = 3.5;
|
||||||
|
public static final double kPThetaController = 5;
|
||||||
|
|
||||||
|
public static final double kYawPIDTolerance = Units.degreesToRadians(2);
|
||||||
|
|
||||||
|
public static final double kAlignPXYController = 2;
|
||||||
|
public static final double kAlignPThetaController = 5;
|
||||||
|
|
||||||
|
// Constraint for the motion profiled robot angle controller
|
||||||
|
public static final TrapezoidProfile.Constraints kThetaControllerConstraints = new TrapezoidProfile.Constraints(
|
||||||
|
kMaxAngularSpeedRadiansPerSecond, kMaxAngularAccelerationRadiansPerSecondSquared);
|
||||||
|
|
||||||
|
public static final TrapezoidProfile.Constraints kAlignThetaControllerConstraints = new TrapezoidProfile.Constraints(
|
||||||
|
kMaxAngularSpeedRadiansPerSecond, kMaxAngularAccelerationRadiansPerSecondSquared);
|
||||||
|
|
||||||
|
// TODO This is a constant being managed like a static rewriteable variable
|
||||||
|
public static RobotConfig kRobotConfig;
|
||||||
|
public static boolean kAutoConfigOk;
|
||||||
|
|
||||||
|
public static final PPHolonomicDriveController kPPDriveController = new PPHolonomicDriveController(
|
||||||
|
new PIDConstants(kPXYController, 0, 0),
|
||||||
|
new PIDConstants(kPThetaController, 0, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final PathConstraints kOnTheFlyConstraints = new PathConstraints(
|
||||||
|
kMaxSpeedMetersPerSecond,
|
||||||
|
kMaxAccelerationMetersPerSecondSquared,
|
||||||
|
kMaxAngularSpeedRadiansPerSecond,
|
||||||
|
kMaxAngularAccelerationRadiansPerSecondSquared
|
||||||
|
);
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
kRobotConfig = RobotConfig.fromGUISettings();
|
||||||
|
kAutoConfigOk = true;
|
||||||
|
} catch (IOException | ParseException e) {
|
||||||
|
System.err.println("FAILED TO READ ROBOTCONFIG, WAS THE CONFIG SET UP IN PATHPLANNER?");
|
||||||
|
e.printStackTrace();
|
||||||
|
kAutoConfigOk = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
61
src/main/java/frc/robot/constants/ClimberConstants.java
Normal file
61
src/main/java/frc/robot/constants/ClimberConstants.java
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
import com.revrobotics.spark.FeedbackSensor;
|
||||||
|
import com.revrobotics.spark.config.SparkMaxConfig;
|
||||||
|
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
|
||||||
|
|
||||||
|
public class ClimberConstants {
|
||||||
|
// TODO Real values
|
||||||
|
public enum ClimberPositions {
|
||||||
|
kStow(0),
|
||||||
|
kClimbOffGround(0),
|
||||||
|
kUp(0);
|
||||||
|
|
||||||
|
private double positionMeters;
|
||||||
|
|
||||||
|
private ClimberPositions(double positionMeters) {
|
||||||
|
this.positionMeters = positionMeters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPositionMeters() {
|
||||||
|
return positionMeters;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final int kMotorCANID = 0;
|
||||||
|
|
||||||
|
public static final double kConversionFactor = 0;
|
||||||
|
|
||||||
|
public static final double kP = 0;
|
||||||
|
public static final double kI = 0;
|
||||||
|
public static final double kD = 0;
|
||||||
|
public static final double kS = 0;
|
||||||
|
public static final double kV = 0;
|
||||||
|
public static final double kA = 0;
|
||||||
|
|
||||||
|
public static final boolean kMotorInverted = false;
|
||||||
|
|
||||||
|
public static final int kCurrentLimit = 40;
|
||||||
|
|
||||||
|
public static final IdleMode kIdleMode = IdleMode.kBrake;
|
||||||
|
|
||||||
|
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A CONFIGURATION ITEM
|
||||||
|
|
||||||
|
public static final SparkMaxConfig kMotorConfig = new SparkMaxConfig();
|
||||||
|
|
||||||
|
static {
|
||||||
|
kMotorConfig
|
||||||
|
.inverted(kMotorInverted)
|
||||||
|
.smartCurrentLimit(kCurrentLimit)
|
||||||
|
.idleMode(kIdleMode);
|
||||||
|
kMotorConfig.encoder
|
||||||
|
.positionConversionFactor(kConversionFactor)
|
||||||
|
.velocityConversionFactor(kConversionFactor / 60);
|
||||||
|
kMotorConfig.closedLoop
|
||||||
|
.feedbackSensor(FeedbackSensor.kPrimaryEncoder)
|
||||||
|
.pid(kP, kI, kD)
|
||||||
|
.outputRange(-1, 1)
|
||||||
|
.feedForward
|
||||||
|
.sva(kS, kV, kA);
|
||||||
|
}
|
||||||
|
}
|
||||||
42
src/main/java/frc/robot/constants/CompetitionConstants.java
Normal file
42
src/main/java/frc/robot/constants/CompetitionConstants.java
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
import edu.wpi.first.apriltag.AprilTagFieldLayout;
|
||||||
|
import edu.wpi.first.apriltag.AprilTagFields;
|
||||||
|
import edu.wpi.first.math.geometry.Pose2d;
|
||||||
|
import edu.wpi.first.math.geometry.Rotation2d;
|
||||||
|
import edu.wpi.first.math.geometry.Transform3d;
|
||||||
|
import edu.wpi.first.math.util.Units;
|
||||||
|
|
||||||
|
public class CompetitionConstants {
|
||||||
|
// THIS SHOULD BE FALSE DURING COMPETITION PLAY
|
||||||
|
public static final boolean kLogToNetworkTables = true;
|
||||||
|
|
||||||
|
public static final AprilTagFieldLayout kTagLayout = AprilTagFieldLayout.loadField(
|
||||||
|
AprilTagFields.kDefaultField
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final double kHubGoalHeightMeters = Units.inchesToMeters(72);
|
||||||
|
|
||||||
|
// TODO Real Values
|
||||||
|
public static final Transform3d kRobotToShooter = new Transform3d();
|
||||||
|
|
||||||
|
public static final Pose2d kBlueHubLocation = new Pose2d(
|
||||||
|
Units.inchesToMeters(182.11),
|
||||||
|
Units.inchesToMeters(158.84),
|
||||||
|
Rotation2d.fromDegrees(0)
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO The origination value produced by the April Tag Field Layout object may
|
||||||
|
// influence what this value should actually be. See AprilTagFieldLayout.getOrigin
|
||||||
|
// For now, the X axis position (forward/backward) is calculated as though the blue
|
||||||
|
// alliance wall right hand side is the originiation point, so, the distance from
|
||||||
|
// the blue alliance wall, to the blue alliance hub center point, plus
|
||||||
|
// the distance between the center of the blue alliance hub and the center of
|
||||||
|
// the red alliance hub
|
||||||
|
public static final Pose2d kRedHubLocation = new Pose2d(
|
||||||
|
Units.inchesToMeters(182.11 + 143.5 * 2),
|
||||||
|
Units.inchesToMeters(158.84),
|
||||||
|
Rotation2d.fromDegrees(0)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
57
src/main/java/frc/robot/constants/DrivetrainConstants.java
Normal file
57
src/main/java/frc/robot/constants/DrivetrainConstants.java
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.Matrix;
|
||||||
|
import edu.wpi.first.math.VecBuilder;
|
||||||
|
import edu.wpi.first.math.geometry.Translation2d;
|
||||||
|
import edu.wpi.first.math.kinematics.SwerveDriveKinematics;
|
||||||
|
import edu.wpi.first.math.numbers.N1;
|
||||||
|
import edu.wpi.first.math.numbers.N3;
|
||||||
|
import edu.wpi.first.math.util.Units;
|
||||||
|
|
||||||
|
public class DrivetrainConstants {
|
||||||
|
public static final double kMaxSpeedMetersPerSecond = 4.663;
|
||||||
|
public static final double kMaxAngularSpeed = 2 * Math.PI;
|
||||||
|
|
||||||
|
public static final double kTrackWidth = Units.inchesToMeters(23.75);
|
||||||
|
public static final double kWheelBase = Units.inchesToMeters(18.75);
|
||||||
|
|
||||||
|
public static final double kFrontLeftMagEncoderOffset = 2.965;
|
||||||
|
public static final double kFrontRightMagEncoderOffset = 1.120;
|
||||||
|
public static final double kRearLeftMagEncoderOffset = 3.761;
|
||||||
|
public static final double kRearRightMagEncoderOffset = 2.573;
|
||||||
|
|
||||||
|
public static final int kFrontLeftDrivingCANID = 4;
|
||||||
|
public static final int kFrontRightDrivingCANID = 3;
|
||||||
|
public static final int kRearLeftDrivingCANID = 1;
|
||||||
|
public static final int kRearRightDrivingCANID = 2;
|
||||||
|
|
||||||
|
public static final int kFrontLeftTurningCANID = 7; // 8
|
||||||
|
public static final int kFrontRightTurningCANID = 21; //9
|
||||||
|
public static final int kRearLeftTurningCANID = 6; //7
|
||||||
|
public static final int kRearRightTurningCANID = 8; //6
|
||||||
|
|
||||||
|
public static final int kFrontLeftAnalogInPort = 3;
|
||||||
|
public static final int kFrontRightAnalogInPort = 2;
|
||||||
|
public static final int kRearLeftAnalogInPort = 0;
|
||||||
|
public static final int kRearRightAnalogInPort = 1;
|
||||||
|
|
||||||
|
public static final boolean kGyroReversed = true;
|
||||||
|
|
||||||
|
// TODO Hold over from 2025, adjust?
|
||||||
|
public static final double kHeadingP = .1;
|
||||||
|
public static final double kXTranslationP = .5;
|
||||||
|
public static final double kYTranslationP = .5;
|
||||||
|
|
||||||
|
// TODO How much do we trust gyro and encoders vs vision estimates.
|
||||||
|
// NOTE: Bigger values indicate LESS trust. Generally all three values for a given matrix should be the same
|
||||||
|
public static final Matrix<N3, N1> kSensorFusionOdometryStdDevs = VecBuilder.fill(0.1, 0.1, 0.1);
|
||||||
|
public static final Matrix<N3, N1> kVisionOdometryStdDevs = VecBuilder.fill(0.9, 0.9, 0.9);
|
||||||
|
|
||||||
|
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A NEW CONFIGURATION ITEM
|
||||||
|
public static final SwerveDriveKinematics kDriveKinematics = new SwerveDriveKinematics(
|
||||||
|
new Translation2d(kWheelBase / 2, kTrackWidth / 2),
|
||||||
|
new Translation2d(kWheelBase / 2, -kTrackWidth / 2),
|
||||||
|
new Translation2d(-kWheelBase / 2, kTrackWidth / 2),
|
||||||
|
new Translation2d(-kWheelBase / 2, -kTrackWidth / 2)
|
||||||
|
);
|
||||||
|
}
|
||||||
92
src/main/java/frc/robot/constants/HoodConstants.java
Normal file
92
src/main/java/frc/robot/constants/HoodConstants.java
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
import com.revrobotics.spark.ClosedLoopSlot;
|
||||||
|
import com.revrobotics.spark.FeedbackSensor;
|
||||||
|
import com.revrobotics.spark.config.SparkMaxConfig;
|
||||||
|
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.interpolation.InterpolatingDoubleTreeMap;
|
||||||
|
import edu.wpi.first.wpilibj.Filesystem;
|
||||||
|
|
||||||
|
public class HoodConstants {
|
||||||
|
// TODO Real Values
|
||||||
|
public static final int kMotorCANID = 12;
|
||||||
|
|
||||||
|
public static final double kConversionFactor = (1.0/3.0)*(8.0/147.0)*2*Math.PI;
|
||||||
|
|
||||||
|
public static final double kP = 1.75;
|
||||||
|
public static final double kI = 0;
|
||||||
|
public static final double kD = 0;
|
||||||
|
public static final double kS = 0.435;
|
||||||
|
public static final double kV = 0;
|
||||||
|
public static final double kA = 0;
|
||||||
|
public static final double kStartupAngle = 0.0;
|
||||||
|
public static final double kMaxManualSpeedMultiplier = 0.1;
|
||||||
|
public static final double kTolerance = Math.toRadians(0.5);
|
||||||
|
|
||||||
|
public static final double kAmpsToTriggerPositionReset = 10;
|
||||||
|
|
||||||
|
// TODO This is just barely longer than the default frame time for output current information
|
||||||
|
// Should this be longer?
|
||||||
|
public static final double kTimeAboveThresholdToReset = .25;
|
||||||
|
|
||||||
|
public static final int kCurrentLimit = 15;
|
||||||
|
|
||||||
|
public static final boolean kInverted = true;
|
||||||
|
public static final boolean kUseInterpolatorForAngle = false;
|
||||||
|
|
||||||
|
public static final IdleMode kIdleMode = IdleMode.kBrake;
|
||||||
|
|
||||||
|
// TODO This needs to be filled in from some source
|
||||||
|
public static final InterpolatingDoubleTreeMap kDistanceToAngle = new InterpolatingDoubleTreeMap();
|
||||||
|
|
||||||
|
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A CONFIGURATION ITEM
|
||||||
|
|
||||||
|
public static final SparkMaxConfig kConfig = new SparkMaxConfig();
|
||||||
|
|
||||||
|
static {
|
||||||
|
kConfig
|
||||||
|
.idleMode(kIdleMode)
|
||||||
|
.inverted(kInverted)
|
||||||
|
.smartCurrentLimit(kCurrentLimit);
|
||||||
|
kConfig.encoder
|
||||||
|
.positionConversionFactor(kConversionFactor)
|
||||||
|
.velocityConversionFactor(kConversionFactor / 60);
|
||||||
|
kConfig.closedLoop
|
||||||
|
.feedbackSensor(FeedbackSensor.kPrimaryEncoder)
|
||||||
|
.pid(kP, kI, kD)
|
||||||
|
.outputRange(-1, 1)
|
||||||
|
.allowedClosedLoopError(kTolerance, ClosedLoopSlot.kSlot0)
|
||||||
|
.feedForward
|
||||||
|
.sva(kS, kV, kA);
|
||||||
|
|
||||||
|
|
||||||
|
File interpolatorFile = Path.of(
|
||||||
|
Filesystem.getDeployDirectory().getAbsolutePath().toString(),
|
||||||
|
"interpolatorData.csv"
|
||||||
|
).toFile();
|
||||||
|
|
||||||
|
if(interpolatorFile.exists()) {
|
||||||
|
try (BufferedReader reader = new BufferedReader(new FileReader(interpolatorFile))) {
|
||||||
|
reader.lines().forEach((s) -> {
|
||||||
|
if(s.trim() != "") { //Empty or whitespace line protection
|
||||||
|
String[] lineSplit = s.split(",");
|
||||||
|
|
||||||
|
kDistanceToAngle.put(
|
||||||
|
Double.valueOf(lineSplit[0].replace("\"", "")),
|
||||||
|
Double.valueOf(lineSplit[1].replace("\"", ""))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (IOException e) {
|
||||||
|
// This condition is never reached because of the if exists line above
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
73
src/main/java/frc/robot/constants/IntakePivotConstants.java
Normal file
73
src/main/java/frc/robot/constants/IntakePivotConstants.java
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
import com.revrobotics.spark.FeedbackSensor;
|
||||||
|
import com.revrobotics.spark.config.SparkMaxConfig;
|
||||||
|
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
|
||||||
|
|
||||||
|
public class IntakePivotConstants {
|
||||||
|
// TODO Real values
|
||||||
|
public enum IntakePivotPosition {
|
||||||
|
kUp(Math.toRadians(116.0)),
|
||||||
|
kDown(Math.toRadians(0.0));
|
||||||
|
private double positionRadians;
|
||||||
|
|
||||||
|
private IntakePivotPosition(double positionRadians) {
|
||||||
|
this.positionRadians = positionRadians;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPositionRadians() {
|
||||||
|
return positionRadians;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final int kLeftMotorCANID = 16;
|
||||||
|
public static final int kRightMotorCANID = 9;
|
||||||
|
|
||||||
|
public static final double kConversionFactor = 60.0/11.0*60.0/18.0*38.0/16.0;
|
||||||
|
|
||||||
|
// Ultra conservative multiplier to prevent 1/8" lexan destruction, modify at your own peril
|
||||||
|
public static final double kMaxManualSpeedMultiplier = .3;
|
||||||
|
|
||||||
|
public static final double kP = 0;
|
||||||
|
public static final double kI = 0;
|
||||||
|
public static final double kD = 0;
|
||||||
|
public static final double kS = 0;
|
||||||
|
public static final double kV = 5.26;
|
||||||
|
public static final double kA = 0.05;
|
||||||
|
public static final double kG = 0.25;
|
||||||
|
|
||||||
|
public static final boolean kInvertMotors = false;
|
||||||
|
|
||||||
|
public static final int kCurrentLimit = 30;
|
||||||
|
|
||||||
|
public static final IdleMode kIdleMode = IdleMode.kCoast;
|
||||||
|
|
||||||
|
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A CONFIGURATION ITEM
|
||||||
|
|
||||||
|
public static final SparkMaxConfig KLeftMotorConfig = new SparkMaxConfig();
|
||||||
|
public static final SparkMaxConfig kRightMotorConfig = new SparkMaxConfig();
|
||||||
|
|
||||||
|
static {
|
||||||
|
KLeftMotorConfig
|
||||||
|
.idleMode(kIdleMode)
|
||||||
|
.smartCurrentLimit(kCurrentLimit)
|
||||||
|
.inverted(kInvertMotors);
|
||||||
|
KLeftMotorConfig.encoder
|
||||||
|
.positionConversionFactor(kConversionFactor)
|
||||||
|
.velocityConversionFactor(kConversionFactor / 60);
|
||||||
|
KLeftMotorConfig.closedLoop
|
||||||
|
.feedbackSensor(FeedbackSensor.kPrimaryEncoder)
|
||||||
|
.pid(kP, kI, kD)
|
||||||
|
.outputRange(-1, 1)
|
||||||
|
.positionWrappingEnabled(true)
|
||||||
|
.positionWrappingInputRange(0, 2 * Math.PI)
|
||||||
|
.feedForward
|
||||||
|
.svag(kS, kV, kA, kG);
|
||||||
|
|
||||||
|
kRightMotorConfig
|
||||||
|
.idleMode(kIdleMode)
|
||||||
|
.smartCurrentLimit(kCurrentLimit)
|
||||||
|
.inverted(kInvertMotors)
|
||||||
|
.follow(kLeftMotorCANID);
|
||||||
|
}
|
||||||
|
}
|
||||||
28
src/main/java/frc/robot/constants/IntakeRollerConstants.java
Normal file
28
src/main/java/frc/robot/constants/IntakeRollerConstants.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
import com.revrobotics.spark.config.SparkMaxConfig;
|
||||||
|
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
|
||||||
|
|
||||||
|
public class IntakeRollerConstants {
|
||||||
|
// TODO Real values
|
||||||
|
public static final int kMotorCANID = 20;
|
||||||
|
|
||||||
|
public static final int kCurrentLimit = 40;
|
||||||
|
|
||||||
|
public static final boolean kInvertMotors = true;
|
||||||
|
|
||||||
|
public static final double kSpeed = .6;
|
||||||
|
|
||||||
|
public static final IdleMode kIdleMode = IdleMode.kCoast;
|
||||||
|
|
||||||
|
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A CONFIGURATION ITEM
|
||||||
|
|
||||||
|
public static final SparkMaxConfig leftMotorConfig = new SparkMaxConfig();
|
||||||
|
|
||||||
|
static {
|
||||||
|
leftMotorConfig
|
||||||
|
.idleMode(kIdleMode)
|
||||||
|
.smartCurrentLimit(kCurrentLimit)
|
||||||
|
.inverted(kInvertMotors);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
public class KrakenMotorConstants {
|
||||||
|
public static final double kFreeSpeedRPM = 6000;
|
||||||
|
}
|
||||||
129
src/main/java/frc/robot/constants/ModuleConstants.java
Normal file
129
src/main/java/frc/robot/constants/ModuleConstants.java
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
import com.ctre.phoenix6.configs.AudioConfigs;
|
||||||
|
import com.ctre.phoenix6.configs.CurrentLimitsConfigs;
|
||||||
|
import com.ctre.phoenix6.configs.FeedbackConfigs;
|
||||||
|
import com.ctre.phoenix6.configs.MotorOutputConfigs;
|
||||||
|
import com.ctre.phoenix6.configs.Slot0Configs;
|
||||||
|
import com.ctre.phoenix6.signals.InvertedValue;
|
||||||
|
import com.ctre.phoenix6.signals.NeutralModeValue;
|
||||||
|
import com.revrobotics.spark.ClosedLoopSlot;
|
||||||
|
import com.revrobotics.spark.FeedbackSensor;
|
||||||
|
import com.revrobotics.spark.config.SparkMaxConfig;
|
||||||
|
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.util.Units;
|
||||||
|
|
||||||
|
public class ModuleConstants {
|
||||||
|
public enum ModuleName {
|
||||||
|
kFrontLeft("FrontLeft"),
|
||||||
|
kFrontRight("FrontRight"),
|
||||||
|
kRearLeft("RearLeft"),
|
||||||
|
kRearRight("RearRight");
|
||||||
|
|
||||||
|
private String loggableName;
|
||||||
|
|
||||||
|
private ModuleName(String loggableName) {
|
||||||
|
this.loggableName = loggableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLoggableName() {
|
||||||
|
return "Drivetrain/Modules/" + loggableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// DRIVING MOTOR CONFIG (Kraken)
|
||||||
|
public static final double kDrivingMotorReduction = (14.0 * 28.0 * 15.0) / (50 * 16 * 45);
|
||||||
|
|
||||||
|
public static final double kDrivingMotorFeedSpeedRPS = KrakenMotorConstants.kFreeSpeedRPM / 60;
|
||||||
|
public static final double kWheelDiameterMeters = Units.inchesToMeters(4);
|
||||||
|
public static final double kWheelCircumferenceMeters = kWheelDiameterMeters * Math.PI;
|
||||||
|
public static final double kDriveWheelFreeSpeedRPS = (kDrivingMotorFeedSpeedRPS * kWheelCircumferenceMeters) /
|
||||||
|
kDrivingMotorReduction;
|
||||||
|
public static final double kDrivingFactor = kWheelDiameterMeters * Math.PI / kDrivingMotorReduction;
|
||||||
|
public static final double kDrivingVelocityFeedForward = 1 / kDriveWheelFreeSpeedRPS;
|
||||||
|
|
||||||
|
// TODO Hold over from 2025, adjust?
|
||||||
|
public static final double kDriveP = .04;
|
||||||
|
public static final double kDriveI = 0;
|
||||||
|
public static final double kDriveD = 0;
|
||||||
|
public static final double kDriveS = 0;
|
||||||
|
public static final double kDriveV = kDrivingVelocityFeedForward;
|
||||||
|
public static final double kDriveA = 0;
|
||||||
|
|
||||||
|
// TODO Hold over from 2025, adjust?
|
||||||
|
public static final int kDriveMotorStatorCurrentLimit = 100;
|
||||||
|
public static final int kDriveMotorSupplyCurrentLimit = 65;
|
||||||
|
|
||||||
|
// TODO Hold over from 2025, adjust?
|
||||||
|
public static final InvertedValue kDriveInversionState = InvertedValue.Clockwise_Positive;
|
||||||
|
public static final NeutralModeValue kDriveIdleMode = NeutralModeValue.Brake;
|
||||||
|
|
||||||
|
// TURNING MOTOR CONFIG (NEO)
|
||||||
|
public static final double kTurningMotorReduction = 150.0/7.0;
|
||||||
|
public static final double kTurningFactor = 2 * Math.PI / kTurningMotorReduction;
|
||||||
|
// TODO Adjust? Let over from 2025
|
||||||
|
public static final double kTurnP = 12;
|
||||||
|
public static final double kTurnI = 0;
|
||||||
|
public static final double kTurnD = 0;
|
||||||
|
|
||||||
|
public static final double kTurnTolerance = Math.toRadians(0.25);
|
||||||
|
|
||||||
|
public static final boolean kIsEncoderInverted = false;
|
||||||
|
|
||||||
|
// TODO How sensitive is too sensitive?
|
||||||
|
public static final double kAutoResetPositionDeadband = Units.degreesToRadians(.25);
|
||||||
|
|
||||||
|
public static final int kTurnMotorCurrentLimit = 20;
|
||||||
|
|
||||||
|
public static final IdleMode kTurnIdleMode = IdleMode.kBrake;
|
||||||
|
|
||||||
|
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A CONFIGURATION ITEM
|
||||||
|
|
||||||
|
public static final SparkMaxConfig turningConfig = new SparkMaxConfig();
|
||||||
|
|
||||||
|
public static final FeedbackConfigs kDriveFeedConfig = new FeedbackConfigs();
|
||||||
|
public static final CurrentLimitsConfigs kDriveCurrentLimitConfig = new CurrentLimitsConfigs();
|
||||||
|
public static final MotorOutputConfigs kDriveMotorConfig = new MotorOutputConfigs();
|
||||||
|
public static final AudioConfigs kAudioConfig = new AudioConfigs();
|
||||||
|
public static final Slot0Configs kDriveSlot0Config = new Slot0Configs();
|
||||||
|
|
||||||
|
static {
|
||||||
|
kDriveFeedConfig.SensorToMechanismRatio = kDrivingMotorReduction;
|
||||||
|
|
||||||
|
kDriveCurrentLimitConfig.StatorCurrentLimitEnable = true;
|
||||||
|
kDriveCurrentLimitConfig.SupplyCurrentLimitEnable = true;
|
||||||
|
kDriveCurrentLimitConfig.StatorCurrentLimit = kDriveMotorStatorCurrentLimit;
|
||||||
|
kDriveCurrentLimitConfig.SupplyCurrentLimit = kDriveMotorSupplyCurrentLimit;
|
||||||
|
|
||||||
|
kDriveMotorConfig.Inverted = kDriveInversionState;
|
||||||
|
kDriveMotorConfig.NeutralMode = kDriveIdleMode;
|
||||||
|
|
||||||
|
kAudioConfig.AllowMusicDurDisable = true;
|
||||||
|
|
||||||
|
kDriveSlot0Config.kP = kDriveP;
|
||||||
|
kDriveSlot0Config.kI = kDriveI;
|
||||||
|
kDriveSlot0Config.kD = kDriveD;
|
||||||
|
kDriveSlot0Config.kS = kDriveS;
|
||||||
|
kDriveSlot0Config.kV = kDriveV;
|
||||||
|
kDriveSlot0Config.kA = kDriveA;
|
||||||
|
|
||||||
|
turningConfig
|
||||||
|
.idleMode(kTurnIdleMode)
|
||||||
|
.smartCurrentLimit(kTurnMotorCurrentLimit)
|
||||||
|
.inverted(true);
|
||||||
|
turningConfig.encoder
|
||||||
|
//.inverted(true)
|
||||||
|
.positionConversionFactor(kTurningFactor)
|
||||||
|
.velocityConversionFactor(kTurningFactor / 60.0);
|
||||||
|
turningConfig.closedLoop
|
||||||
|
.feedbackSensor(FeedbackSensor.kPrimaryEncoder)
|
||||||
|
.pid(kTurnP, kTurnI, kTurnD)
|
||||||
|
.outputRange(-1, 1)
|
||||||
|
.allowedClosedLoopError(kTurnTolerance, ClosedLoopSlot.kSlot0)
|
||||||
|
.positionWrappingEnabled(true)
|
||||||
|
.positionWrappingInputRange(0, 2 * Math.PI);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
29
src/main/java/frc/robot/constants/OIConstants.java
Normal file
29
src/main/java/frc/robot/constants/OIConstants.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj.util.Color;
|
||||||
|
|
||||||
|
public class OIConstants {
|
||||||
|
public static final int kDriverControllerPort = 0;
|
||||||
|
public static final int kOperatorControllerPort = 1;
|
||||||
|
|
||||||
|
public static final double kDriveDeadband = .01;
|
||||||
|
|
||||||
|
public static final double kJoystickExponential = 3;
|
||||||
|
|
||||||
|
public static final String kTeleopTab = "Teleoperated";
|
||||||
|
|
||||||
|
public static final String kCurrentActiveHub = "Alliance Hub Currently Active";
|
||||||
|
|
||||||
|
public static final String[] kRedBlueDisplay = {
|
||||||
|
Color.kRed.toHexString(),
|
||||||
|
Color.kBlue.toHexString()
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final String[] kRedDisplay = {
|
||||||
|
Color.kRed.toHexString()
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final String[] kBlueDisplay = {
|
||||||
|
Color.kBlue.toHexString()
|
||||||
|
};
|
||||||
|
}
|
||||||
38
src/main/java/frc/robot/constants/PhotonConstants.java
Normal file
38
src/main/java/frc/robot/constants/PhotonConstants.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.geometry.Rotation3d;
|
||||||
|
import edu.wpi.first.math.geometry.Transform3d;
|
||||||
|
import edu.wpi.first.math.util.Units;
|
||||||
|
import frc.robot.utilities.PhotonVisionConfig;
|
||||||
|
|
||||||
|
public class PhotonConstants {
|
||||||
|
public static final String kCamera1Name = "pv1";
|
||||||
|
public static final String kCamera2Name = "pv2";
|
||||||
|
|
||||||
|
// TODO Need actual values for all of this
|
||||||
|
public static final Transform3d kCamera1RobotToCam = new Transform3d();
|
||||||
|
public static final Transform3d kCamera2RobotToCam = new Transform3d(
|
||||||
|
Units.inchesToMeters(1.5),
|
||||||
|
Units.inchesToMeters(-10.5),
|
||||||
|
Units.inchesToMeters(28.5),
|
||||||
|
new Rotation3d(
|
||||||
|
Units.degreesToRadians(0),
|
||||||
|
Units.degreesToRadians(24),
|
||||||
|
Units.degreesToRadians(-10)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
public static final double kCamera1HeightMeters = 0;
|
||||||
|
public static final double kCamera1PitchRadians = 0;
|
||||||
|
public static final double kCamera2HeightMeters = 0;
|
||||||
|
public static final double kCamera2PitchRadians = 0;
|
||||||
|
|
||||||
|
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A CONFIGURATION ITEM
|
||||||
|
|
||||||
|
public static final List<PhotonVisionConfig> configs = List.of(
|
||||||
|
//new PhotonVisionConfig(kCamera1Name, kCamera1RobotToCam, kCamera1HeightMeters, kCamera1PitchRadians),
|
||||||
|
new PhotonVisionConfig(kCamera2Name, kCamera2RobotToCam, kCamera2HeightMeters, kCamera2PitchRadians)
|
||||||
|
);
|
||||||
|
}
|
||||||
101
src/main/java/frc/robot/constants/ShooterConstants.java
Normal file
101
src/main/java/frc/robot/constants/ShooterConstants.java
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
import com.revrobotics.spark.FeedbackSensor;
|
||||||
|
import com.revrobotics.spark.config.SparkMaxConfig;
|
||||||
|
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.util.Units;
|
||||||
|
|
||||||
|
public class ShooterConstants {
|
||||||
|
public enum ShooterSpeeds {
|
||||||
|
kHubSpeed(3000.0),
|
||||||
|
kFeedSpeed(5000.0);
|
||||||
|
|
||||||
|
private double speedMPS;
|
||||||
|
private double speedRPM;
|
||||||
|
|
||||||
|
private ShooterSpeeds(double speedRPM) {
|
||||||
|
this.speedMPS = speedRPM * kWheelDiameter*Math.PI;
|
||||||
|
this.speedRPM = speedRPM;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getSpeedMPS() {
|
||||||
|
return speedMPS * kWheelDiameter*Math.PI;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getSpeedRPM(){
|
||||||
|
return speedRPM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Conversion factor?
|
||||||
|
|
||||||
|
public static final double kWheelDiameter = Units.inchesToMeters(4);
|
||||||
|
|
||||||
|
// TODO Real values
|
||||||
|
public static final int kLeftShooterMotorCANID = 2;
|
||||||
|
public static final int kRightShooterMotorCANID = 5;
|
||||||
|
|
||||||
|
public static final boolean kLeftShooterMotorInverted = true;
|
||||||
|
public static final boolean kRightShooterMotorInverted = false;
|
||||||
|
|
||||||
|
public static final double kLeftP = 0.001;
|
||||||
|
public static final double kLeftI = 0;
|
||||||
|
public static final double kLeftD = 0;
|
||||||
|
public static final double kLeftS = 0;
|
||||||
|
public static final double kLeftV = 0.0013;
|
||||||
|
public static final double kLeftA = 0;
|
||||||
|
|
||||||
|
public static final double kRightP = 0.001;
|
||||||
|
public static final double kRightI = 0;
|
||||||
|
public static final double kRightD = 0.000;
|
||||||
|
public static final double kRightS = 0;
|
||||||
|
public static final double kRightV = 0.00121;
|
||||||
|
public static final double kRightA = 0;
|
||||||
|
|
||||||
|
public static final double kMaxManualSpeedMultiplier = 1;
|
||||||
|
|
||||||
|
public static final double kShooterHeightMeters = 0;
|
||||||
|
|
||||||
|
// TODO Is this value sane?
|
||||||
|
public static final int kCurrentLimit = 60;
|
||||||
|
|
||||||
|
public static final IdleMode kShooterIdleMode = IdleMode.kCoast;
|
||||||
|
|
||||||
|
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A CONFIGURATION ITEM
|
||||||
|
|
||||||
|
public static final SparkMaxConfig kLeftMotorConfig = new SparkMaxConfig();
|
||||||
|
public static final SparkMaxConfig kRightMotorConfig = new SparkMaxConfig();
|
||||||
|
|
||||||
|
|
||||||
|
static {
|
||||||
|
kLeftMotorConfig
|
||||||
|
.idleMode(kShooterIdleMode)
|
||||||
|
.smartCurrentLimit(kCurrentLimit)
|
||||||
|
.inverted(kLeftShooterMotorInverted);
|
||||||
|
kLeftMotorConfig.absoluteEncoder
|
||||||
|
.positionConversionFactor(1)
|
||||||
|
.velocityConversionFactor(60);
|
||||||
|
kLeftMotorConfig.closedLoop
|
||||||
|
.feedbackSensor(FeedbackSensor.kAbsoluteEncoder)
|
||||||
|
.pid(kLeftP, kLeftI, kLeftD)
|
||||||
|
.outputRange(-1, 1)
|
||||||
|
.feedForward
|
||||||
|
.sva(kLeftS, kLeftV, kLeftA);
|
||||||
|
|
||||||
|
kRightMotorConfig
|
||||||
|
.idleMode(kShooterIdleMode)
|
||||||
|
.smartCurrentLimit(kCurrentLimit)
|
||||||
|
.inverted(kRightShooterMotorInverted);
|
||||||
|
kRightMotorConfig.absoluteEncoder
|
||||||
|
.positionConversionFactor(1)
|
||||||
|
.velocityConversionFactor(60)
|
||||||
|
.inverted(true);
|
||||||
|
kRightMotorConfig.closedLoop
|
||||||
|
.feedbackSensor(FeedbackSensor.kAbsoluteEncoder)
|
||||||
|
.pid(kRightP, kRightI, kRightD)
|
||||||
|
.outputRange(-1, 1)
|
||||||
|
.feedForward
|
||||||
|
.sva(kRightS, kRightV, kRightA);
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/main/java/frc/robot/constants/SpindexerConstants.java
Normal file
50
src/main/java/frc/robot/constants/SpindexerConstants.java
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package frc.robot.constants;
|
||||||
|
|
||||||
|
import com.ctre.phoenix6.configs.CurrentLimitsConfigs;
|
||||||
|
import com.ctre.phoenix6.configs.MotorOutputConfigs;
|
||||||
|
import com.ctre.phoenix6.signals.InvertedValue;
|
||||||
|
import com.ctre.phoenix6.signals.NeutralModeValue;
|
||||||
|
import com.revrobotics.spark.config.SparkMaxConfig;
|
||||||
|
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
|
||||||
|
|
||||||
|
public class SpindexerConstants {
|
||||||
|
// TODO Real values
|
||||||
|
public static final int kSpindexerMotorCANID = 0;
|
||||||
|
public static final int kFeederMotorCANID = 4;
|
||||||
|
|
||||||
|
public static final int kSpindexerStatorCurrentLimit = 110;
|
||||||
|
public static final int kSpindexerSupplyCurrentLimit = 60;
|
||||||
|
public static final int kFeederCurrentLimit = 40;
|
||||||
|
|
||||||
|
public static final double kSpindexerSpeed = 1;
|
||||||
|
public static final double kFeederSpeed = 1;
|
||||||
|
|
||||||
|
public static final boolean kFeederMotorInverted = true;
|
||||||
|
|
||||||
|
public static final InvertedValue kSpindexerInversionState = InvertedValue.Clockwise_Positive;
|
||||||
|
public static final NeutralModeValue kSpindexerIdleMode = NeutralModeValue.Coast;
|
||||||
|
|
||||||
|
public static final IdleMode kFeederIdleMode = IdleMode.kBrake;
|
||||||
|
|
||||||
|
// YOU SHOULDN'T NEED TO CHANGE ANYTHING BELOW THIS LINE UNLESS YOU'RE ADDING A CONFIGURATION ITEM
|
||||||
|
|
||||||
|
public static final SparkMaxConfig kFeederConfig = new SparkMaxConfig();
|
||||||
|
|
||||||
|
public static final CurrentLimitsConfigs kSpindexerCurrentLimitConfig = new CurrentLimitsConfigs();
|
||||||
|
public static final MotorOutputConfigs kSpindexerMotorConfig = new MotorOutputConfigs();
|
||||||
|
|
||||||
|
static {
|
||||||
|
kSpindexerCurrentLimitConfig.StatorCurrentLimitEnable = true;
|
||||||
|
kSpindexerCurrentLimitConfig.SupplyCurrentLimitEnable = true;
|
||||||
|
kSpindexerCurrentLimitConfig.StatorCurrentLimit = kSpindexerStatorCurrentLimit;
|
||||||
|
kSpindexerCurrentLimitConfig.SupplyCurrentLimit = kSpindexerSupplyCurrentLimit;
|
||||||
|
|
||||||
|
kSpindexerMotorConfig.Inverted = kSpindexerInversionState;
|
||||||
|
kSpindexerMotorConfig.NeutralMode = kSpindexerIdleMode;
|
||||||
|
|
||||||
|
kFeederConfig
|
||||||
|
.inverted(kFeederMotorInverted)
|
||||||
|
.smartCurrentLimit(kFeederCurrentLimit)
|
||||||
|
.idleMode(kFeederIdleMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
74
src/main/java/frc/robot/subsystems/Climber.java
Normal file
74
src/main/java/frc/robot/subsystems/Climber.java
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
package frc.robot.subsystems;
|
||||||
|
|
||||||
|
import java.util.function.DoubleSupplier;
|
||||||
|
|
||||||
|
import org.littletonrobotics.junction.Logger;
|
||||||
|
|
||||||
|
import com.revrobotics.PersistMode;
|
||||||
|
import com.revrobotics.RelativeEncoder;
|
||||||
|
import com.revrobotics.ResetMode;
|
||||||
|
import com.revrobotics.spark.SparkClosedLoopController;
|
||||||
|
import com.revrobotics.spark.SparkMax;
|
||||||
|
import com.revrobotics.spark.SparkBase.ControlType;
|
||||||
|
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
import frc.robot.constants.ClimberConstants;
|
||||||
|
import frc.robot.constants.ClimberConstants.ClimberPositions;
|
||||||
|
|
||||||
|
public class Climber extends SubsystemBase {
|
||||||
|
private SparkMax motor;
|
||||||
|
|
||||||
|
private RelativeEncoder encoder;
|
||||||
|
|
||||||
|
private SparkClosedLoopController controller;
|
||||||
|
|
||||||
|
private ClimberPositions targetPosition;
|
||||||
|
|
||||||
|
public Climber() {
|
||||||
|
motor = new SparkMax(ClimberConstants.kMotorCANID, MotorType.kBrushless);
|
||||||
|
|
||||||
|
motor.configure(
|
||||||
|
ClimberConstants.kMotorConfig,
|
||||||
|
ResetMode.kResetSafeParameters,
|
||||||
|
PersistMode.kPersistParameters
|
||||||
|
);
|
||||||
|
|
||||||
|
encoder = motor.getEncoder();
|
||||||
|
|
||||||
|
controller = motor.getClosedLoopController();
|
||||||
|
|
||||||
|
targetPosition = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void periodic() {
|
||||||
|
Logger.recordOutput("Climber/TargetPositionMeters", targetPosition == null ? -1 : targetPosition.getPositionMeters());
|
||||||
|
Logger.recordOutput("Climber/CurrentPositionMeters", encoder.getPosition());
|
||||||
|
Logger.recordOutput("Climber/AtSetpoint", controller.isAtSetpoint());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command maintainPosition(ClimberPositions position) {
|
||||||
|
return run(() -> {
|
||||||
|
targetPosition = position;
|
||||||
|
|
||||||
|
controller.setSetpoint(
|
||||||
|
position.getPositionMeters(),
|
||||||
|
ControlType.kPosition
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command manualSpeed(DoubleSupplier speed) {
|
||||||
|
return run(() -> {
|
||||||
|
targetPosition = null;
|
||||||
|
|
||||||
|
motor.set(speed.getAsDouble());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command stop() {
|
||||||
|
return manualSpeed(() -> 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
425
src/main/java/frc/robot/subsystems/Drivetrain.java
Normal file
425
src/main/java/frc/robot/subsystems/Drivetrain.java
Normal file
@@ -0,0 +1,425 @@
|
|||||||
|
package frc.robot.subsystems;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.function.BooleanSupplier;
|
||||||
|
import java.util.function.DoubleSupplier;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import org.littletonrobotics.junction.Logger;
|
||||||
|
|
||||||
|
import com.pathplanner.lib.auto.AutoBuilder;
|
||||||
|
import com.pathplanner.lib.path.PathPlannerPath;
|
||||||
|
import com.studica.frc.AHRS;
|
||||||
|
import com.studica.frc.AHRS.NavXComType;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.MathUtil;
|
||||||
|
import edu.wpi.first.math.controller.PIDController;
|
||||||
|
import edu.wpi.first.math.estimator.SwerveDrivePoseEstimator;
|
||||||
|
import edu.wpi.first.math.geometry.Pose2d;
|
||||||
|
import edu.wpi.first.math.geometry.Rotation2d;
|
||||||
|
import edu.wpi.first.math.kinematics.ChassisSpeeds;
|
||||||
|
import edu.wpi.first.math.kinematics.SwerveDriveKinematics;
|
||||||
|
import edu.wpi.first.math.kinematics.SwerveModulePosition;
|
||||||
|
import edu.wpi.first.math.kinematics.SwerveModuleState;
|
||||||
|
import edu.wpi.first.wpilibj.DriverStation;
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
import edu.wpi.first.wpilibj2.command.PrintCommand;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
import frc.robot.constants.AutoConstants;
|
||||||
|
import frc.robot.constants.DrivetrainConstants;
|
||||||
|
import frc.robot.constants.OIConstants;
|
||||||
|
import frc.robot.constants.ModuleConstants.ModuleName;
|
||||||
|
import frc.robot.utilities.SwerveModule;
|
||||||
|
import frc.robot.utilities.Utilities;
|
||||||
|
import frc.robot.utilities.VisualPose;
|
||||||
|
|
||||||
|
public class Drivetrain extends SubsystemBase {
|
||||||
|
private SwerveModule frontLeft;
|
||||||
|
private SwerveModule frontRight;
|
||||||
|
private SwerveModule rearLeft;
|
||||||
|
private SwerveModule rearRight;
|
||||||
|
|
||||||
|
private AHRS gyro;
|
||||||
|
|
||||||
|
private SwerveDrivePoseEstimator estimator;
|
||||||
|
|
||||||
|
private PIDController yawRotationController;
|
||||||
|
|
||||||
|
public Drivetrain(Pose2d startupPose) {
|
||||||
|
frontLeft = new SwerveModule(
|
||||||
|
ModuleName.kFrontLeft,
|
||||||
|
DrivetrainConstants.kFrontLeftDrivingCANID,
|
||||||
|
DrivetrainConstants.kFrontLeftTurningCANID,
|
||||||
|
DrivetrainConstants.kFrontLeftAnalogInPort,
|
||||||
|
DrivetrainConstants.kFrontLeftMagEncoderOffset
|
||||||
|
);
|
||||||
|
|
||||||
|
frontRight = new SwerveModule(
|
||||||
|
ModuleName.kFrontRight,
|
||||||
|
DrivetrainConstants.kFrontRightDrivingCANID,
|
||||||
|
DrivetrainConstants.kFrontRightTurningCANID,
|
||||||
|
DrivetrainConstants.kFrontRightAnalogInPort,
|
||||||
|
DrivetrainConstants.kFrontRightMagEncoderOffset
|
||||||
|
);
|
||||||
|
|
||||||
|
rearLeft = new SwerveModule(
|
||||||
|
ModuleName.kRearLeft,
|
||||||
|
DrivetrainConstants.kRearLeftDrivingCANID,
|
||||||
|
DrivetrainConstants.kRearLeftTurningCANID,
|
||||||
|
DrivetrainConstants.kRearLeftAnalogInPort,
|
||||||
|
DrivetrainConstants.kRearLeftMagEncoderOffset
|
||||||
|
);
|
||||||
|
|
||||||
|
rearRight = new SwerveModule(
|
||||||
|
ModuleName.kRearRight,
|
||||||
|
DrivetrainConstants.kRearRightDrivingCANID,
|
||||||
|
DrivetrainConstants.kRearRightTurningCANID,
|
||||||
|
DrivetrainConstants.kRearRightAnalogInPort,
|
||||||
|
DrivetrainConstants.kRearRightMagEncoderOffset
|
||||||
|
);
|
||||||
|
|
||||||
|
gyro = new AHRS(NavXComType.kMXP_SPI);
|
||||||
|
|
||||||
|
yawRotationController = new PIDController(
|
||||||
|
AutoConstants.kPThetaController,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
yawRotationController.enableContinuousInput(-Math.PI, Math.PI);
|
||||||
|
yawRotationController.setTolerance(AutoConstants.kYawPIDTolerance);
|
||||||
|
|
||||||
|
// TODO 2025 used non-standard deviations for encoder/gyro inputs and vision, will need to be tuned for 2026 in the future
|
||||||
|
estimator = new SwerveDrivePoseEstimator(
|
||||||
|
DrivetrainConstants.kDriveKinematics,
|
||||||
|
Rotation2d.fromDegrees(getGyroValue()),
|
||||||
|
new SwerveModulePosition[] {
|
||||||
|
frontLeft.getPosition(),
|
||||||
|
frontRight.getPosition(),
|
||||||
|
rearLeft.getPosition(),
|
||||||
|
rearRight.getPosition()
|
||||||
|
},
|
||||||
|
startupPose != null ? startupPose : new Pose2d(),
|
||||||
|
DrivetrainConstants.kSensorFusionOdometryStdDevs,
|
||||||
|
DrivetrainConstants.kVisionOdometryStdDevs
|
||||||
|
);
|
||||||
|
|
||||||
|
if(AutoConstants.kAutoConfigOk) {
|
||||||
|
AutoBuilder.configure(
|
||||||
|
this::getPose,
|
||||||
|
this::resetOdometry,
|
||||||
|
this::getCurrentChassisSpeeds,
|
||||||
|
(speeds, feedforwards) -> driveWithChassisSpeeds(speeds),
|
||||||
|
AutoConstants.kPPDriveController,
|
||||||
|
AutoConstants.kRobotConfig,
|
||||||
|
() -> {
|
||||||
|
Optional<DriverStation.Alliance> alliance = DriverStation.getAlliance();
|
||||||
|
if (alliance.isPresent()) {
|
||||||
|
return alliance.get() == DriverStation.Alliance.Red;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
this
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void periodic() {
|
||||||
|
estimator.update(
|
||||||
|
Rotation2d.fromDegrees(getGyroValue()),
|
||||||
|
new SwerveModulePosition[] {
|
||||||
|
frontLeft.getPosition(),
|
||||||
|
frontRight.getPosition(),
|
||||||
|
rearLeft.getPosition(),
|
||||||
|
rearRight.getPosition()
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
frontLeft.periodic();
|
||||||
|
frontRight.periodic();
|
||||||
|
rearLeft.periodic();
|
||||||
|
rearRight.periodic();
|
||||||
|
|
||||||
|
Logger.recordOutput("Drivetrain/Pose", getPose());
|
||||||
|
Logger.recordOutput("Drivetrain/Gyro Angle", getGyroValue());
|
||||||
|
Logger.recordOutput("Drivetrain/Heading", getHeadingDegrees());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be used to run an individual module on the drive base a static speed while maintaining a static angle.
|
||||||
|
*
|
||||||
|
* Good for diagnosing issues with swerve module configuration. Essentially useless otherwise.
|
||||||
|
*
|
||||||
|
* @param name The ModuleName enumeration that indicates which module you want to control
|
||||||
|
* @param staticSpeed The static speed in Meters Per Second to spin the drive wheel at
|
||||||
|
* @param staticAngleDegrees The static angle in degrees that you want the wheel to face
|
||||||
|
* @return A complete Command structure that performs the specified action
|
||||||
|
*/
|
||||||
|
public Command runIndividualModule(ModuleName name, double staticSpeed, double staticAngleDegrees) {
|
||||||
|
SwerveModule module = List.of(
|
||||||
|
frontLeft,
|
||||||
|
frontRight,
|
||||||
|
rearLeft,
|
||||||
|
rearRight
|
||||||
|
).stream()
|
||||||
|
.filter((m) -> m.getModuleName() == name)
|
||||||
|
.findFirst()
|
||||||
|
.get();
|
||||||
|
|
||||||
|
return run(() -> {
|
||||||
|
module.setDesiredState(new SwerveModuleState(
|
||||||
|
staticSpeed,
|
||||||
|
Rotation2d.fromDegrees(staticAngleDegrees)
|
||||||
|
));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command disableOutputs() {
|
||||||
|
return run(() -> {
|
||||||
|
frontLeft.disableOutput();
|
||||||
|
frontRight.disableOutput();
|
||||||
|
rearLeft.disableOutput();
|
||||||
|
rearRight.disableOutput();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotates the robot to a face a given Pose2d position on the field
|
||||||
|
*
|
||||||
|
* Note that this Command does not provide a means of timeout. If you are
|
||||||
|
* using this in an auto context, this Command should be decorated with
|
||||||
|
* withTimeout(<some_value>). Otherwise, you will be waiting for the PID
|
||||||
|
* Controller doing the work to report that it is at the desired setpoint.
|
||||||
|
*
|
||||||
|
* @param targetPose The Pose2d object to rotate the robot towards
|
||||||
|
* @param rotate180 When false, the front of the robot faces the specified pose, when true
|
||||||
|
* the back of the robot faces the specified pose
|
||||||
|
* @return A complete Command structure that performs the specified action
|
||||||
|
*/
|
||||||
|
public Command rotateToPose(Pose2d targetPose, boolean rotate180) {
|
||||||
|
return lockRotationToSuppliedPose(() -> targetPose, () -> 0, () -> 0, rotate180)
|
||||||
|
.until(yawRotationController::atSetpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locks the robots rotation to face the Alliance Hub on the field.
|
||||||
|
*
|
||||||
|
* This method is innately aware of which hub to face based on the assigned alliance color.
|
||||||
|
*
|
||||||
|
* This method is <i>NOT</i> for autonomous, see rotateToPose
|
||||||
|
*
|
||||||
|
* This method provides a field oriented mechanism of driving the robot, such that the robot
|
||||||
|
* is always facing the point on the field that is the center of the alliance hub. This
|
||||||
|
* method assumes that the robots estimated pose is reasonably accurate.
|
||||||
|
*
|
||||||
|
* @param xSpeed The X (forward/backward) translational speed of the robot
|
||||||
|
* @param ySpeed The Y (left/right) translational speed of the robot
|
||||||
|
* @param rotate180 When false, the front of the robot faces the hub, when true, the back
|
||||||
|
* of the robot faces the hub
|
||||||
|
* @return A complete Command structure that performs the specified action
|
||||||
|
*/
|
||||||
|
public Command lockRotationToHub(DoubleSupplier xSpeed, DoubleSupplier ySpeed, boolean rotate180) {
|
||||||
|
return lockRotationToSuppliedPose(
|
||||||
|
Utilities::getHubPose,
|
||||||
|
xSpeed,
|
||||||
|
ySpeed,
|
||||||
|
rotate180
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locks the robots rotation to face a particular pose on the field
|
||||||
|
*
|
||||||
|
* This method is <i>NOT</i> for autonomous, see rotateToPose
|
||||||
|
*
|
||||||
|
* This method provides a field oriented mechanism of driving the robot, such that the robot
|
||||||
|
* is always facing the point on the field that is the Pose2d object being supplied. This
|
||||||
|
* method assumes that the robots estimated pose is reasonably accurate.
|
||||||
|
*
|
||||||
|
* @param poseSupplier A Supplier object, lambda, or method reference which consistently produces a Pose2d object to point towards
|
||||||
|
* @param xSpeed The X (forward/backward) translational speed of the robot
|
||||||
|
* @param ySpeed The Y (left/right) translational speed of the robot
|
||||||
|
* @param rotate180 When false, the front of the robot faces the supplied pose, when true, the back
|
||||||
|
* of the robot faces the supplied pose
|
||||||
|
* @return A complete Command structure that performs the specified action
|
||||||
|
*/
|
||||||
|
public Command lockRotationToSuppliedPose(Supplier<Pose2d> poseSupplier, DoubleSupplier xSpeed, DoubleSupplier ySpeed, boolean rotate180) {
|
||||||
|
return runOnce(yawRotationController::reset).andThen(
|
||||||
|
drive(
|
||||||
|
xSpeed,
|
||||||
|
ySpeed,
|
||||||
|
() -> {
|
||||||
|
Pose2d faceTowards = poseSupplier.get();
|
||||||
|
|
||||||
|
Rotation2d targetRotation = new Rotation2d(
|
||||||
|
faceTowards.getX() - getPose().getX(),
|
||||||
|
faceTowards.getY() - getPose().getY()
|
||||||
|
);
|
||||||
|
|
||||||
|
if(rotate180) {
|
||||||
|
targetRotation = targetRotation.rotateBy(Rotation2d.k180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return yawRotationController.calculate(
|
||||||
|
getHeading().getRadians(),
|
||||||
|
targetRotation.getRadians()
|
||||||
|
);
|
||||||
|
},
|
||||||
|
() -> true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A method to lock to a particular source of an external "yaw". The intent is for this yaw to be sourced from
|
||||||
|
* {@link frc.robot.subsystems.PhotonVision#getBestYawForTag(int)} which generates a "yaw" for a particular tag as referenced
|
||||||
|
* from the center point of the cameras image frame. The objective being to "0 the source" using a PID Controller, or in
|
||||||
|
* other terms, to center the provided tag in the camera's image frame.
|
||||||
|
*
|
||||||
|
* @param yaw The "yaw" of the tag source relative to the center of the image frame
|
||||||
|
* @param xSpeed The X (forward/backward) translational speed of the robot
|
||||||
|
* @param ySpeed The Y (left/right) translational speed of the robot
|
||||||
|
* @return A complete Command structure that performs the specified action
|
||||||
|
*/
|
||||||
|
public Command lockToYaw(DoubleSupplier yaw, DoubleSupplier xSpeed, DoubleSupplier ySpeed) {
|
||||||
|
return runOnce(yawRotationController::reset).andThen(
|
||||||
|
drive(
|
||||||
|
xSpeed,
|
||||||
|
ySpeed,
|
||||||
|
() -> yawRotationController.calculate(yaw.getAsDouble(), 0),
|
||||||
|
() -> true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command drivePathPlannerPath(PathPlannerPath path) {
|
||||||
|
if(AutoConstants.kAutoConfigOk) {
|
||||||
|
return AutoBuilder.followPath(path);
|
||||||
|
} else {
|
||||||
|
return new PrintCommand("Robot Config loading failed, on the fly PathPlanner disabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command drive(DoubleSupplier xSpeed, DoubleSupplier ySpeed, DoubleSupplier rotation, BooleanSupplier fieldRelative) {
|
||||||
|
// TODO Specific Alliance code?
|
||||||
|
return run(() -> {
|
||||||
|
drive(
|
||||||
|
-MathUtil.applyDeadband(xSpeed.getAsDouble(), OIConstants.kDriveDeadband),
|
||||||
|
-MathUtil.applyDeadband(ySpeed.getAsDouble(), OIConstants.kDriveDeadband),
|
||||||
|
-MathUtil.applyDeadband(rotation.getAsDouble(), OIConstants.kDriveDeadband),
|
||||||
|
fieldRelative.getAsBoolean()
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command setX() {
|
||||||
|
return run(() -> {
|
||||||
|
frontLeft.setDesiredState(new SwerveModuleState(0, Rotation2d.fromDegrees(45)));
|
||||||
|
frontRight.setDesiredState(new SwerveModuleState(0, Rotation2d.fromDegrees(-45)));
|
||||||
|
rearLeft.setDesiredState(new SwerveModuleState(0, Rotation2d.fromDegrees(-45)));
|
||||||
|
rearRight.setDesiredState(new SwerveModuleState(0, Rotation2d.fromDegrees(45)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command zeroHeading() {
|
||||||
|
return run(() -> {
|
||||||
|
gyro.reset();
|
||||||
|
estimator.resetRotation(new Rotation2d(0));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void consumeVisualPose(VisualPose pose) {
|
||||||
|
estimator.addVisionMeasurement(
|
||||||
|
pose.visualPose(),
|
||||||
|
pose.timestamp()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetEncoders() {
|
||||||
|
frontLeft.resetEncoders();
|
||||||
|
frontRight.resetEncoders();
|
||||||
|
rearLeft.resetEncoders();
|
||||||
|
rearRight.resetEncoders();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetOdometry(Pose2d pose) {
|
||||||
|
estimator.resetPosition(
|
||||||
|
Rotation2d.fromDegrees(getGyroValue()),
|
||||||
|
new SwerveModulePosition[] {
|
||||||
|
frontLeft.getPosition(),
|
||||||
|
frontRight.getPosition(),
|
||||||
|
rearLeft.getPosition(),
|
||||||
|
rearRight.getPosition()
|
||||||
|
},
|
||||||
|
pose
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drive(double xSpeed, double ySpeed, double rotation, boolean fieldRelative) {
|
||||||
|
double p = Math.sqrt(Math.pow(xSpeed, 2) + Math.pow(ySpeed, 2));
|
||||||
|
double xSpeedDelivered = 0;
|
||||||
|
double ySpeedDelivered = 0;
|
||||||
|
|
||||||
|
if(p != 0){
|
||||||
|
xSpeedDelivered = xSpeed * (Math.pow(p, OIConstants.kJoystickExponential) / p) * DrivetrainConstants.kMaxSpeedMetersPerSecond;
|
||||||
|
ySpeedDelivered = ySpeed * (Math.pow(p, OIConstants.kJoystickExponential) / p) * DrivetrainConstants.kMaxSpeedMetersPerSecond;
|
||||||
|
}else{
|
||||||
|
xSpeedDelivered = 0;
|
||||||
|
ySpeedDelivered = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double rotationDelivered = rotation * DrivetrainConstants.kMaxAngularSpeed;
|
||||||
|
|
||||||
|
SwerveModuleState[] swerveModuleStates = DrivetrainConstants.kDriveKinematics.toSwerveModuleStates(
|
||||||
|
fieldRelative ?
|
||||||
|
ChassisSpeeds.fromFieldRelativeSpeeds(xSpeedDelivered, ySpeedDelivered, rotationDelivered,
|
||||||
|
estimator.getEstimatedPosition().getRotation()) :
|
||||||
|
new ChassisSpeeds(xSpeedDelivered, ySpeedDelivered, rotationDelivered)
|
||||||
|
);
|
||||||
|
|
||||||
|
setModuleStates(swerveModuleStates);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void driveWithChassisSpeeds(ChassisSpeeds speeds) {
|
||||||
|
ChassisSpeeds discreteSpeeds = ChassisSpeeds.discretize(speeds, 0.2);
|
||||||
|
SwerveModuleState[] newStates = DrivetrainConstants.kDriveKinematics.toSwerveModuleStates(discreteSpeeds);
|
||||||
|
|
||||||
|
setModuleStates(newStates);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModuleStates(SwerveModuleState[] desiredStates) {
|
||||||
|
SwerveDriveKinematics.desaturateWheelSpeeds(
|
||||||
|
desiredStates, DrivetrainConstants.kMaxSpeedMetersPerSecond);
|
||||||
|
frontLeft.setDesiredState(desiredStates[0]);
|
||||||
|
frontRight.setDesiredState(desiredStates[1]);
|
||||||
|
rearLeft.setDesiredState(desiredStates[2]);
|
||||||
|
rearRight.setDesiredState(desiredStates[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChassisSpeeds getCurrentChassisSpeeds() {
|
||||||
|
return DrivetrainConstants.kDriveKinematics.toChassisSpeeds(
|
||||||
|
frontLeft.getState(),
|
||||||
|
frontRight.getState(),
|
||||||
|
rearLeft.getState(),
|
||||||
|
rearRight.getState()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pose2d getPose() {
|
||||||
|
return estimator.getEstimatedPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getGyroValue() {
|
||||||
|
return gyro.getAngle() * (DrivetrainConstants.kGyroReversed ? -1 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rotation2d getHeading() {
|
||||||
|
return estimator.getEstimatedPosition().getRotation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getHeadingDegrees() {
|
||||||
|
return estimator.getEstimatedPosition().getRotation().getDegrees();
|
||||||
|
}
|
||||||
|
}
|
||||||
136
src/main/java/frc/robot/subsystems/Hood.java
Normal file
136
src/main/java/frc/robot/subsystems/Hood.java
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
package frc.robot.subsystems;
|
||||||
|
|
||||||
|
import java.util.function.DoubleSupplier;
|
||||||
|
|
||||||
|
import org.littletonrobotics.junction.Logger;
|
||||||
|
|
||||||
|
import com.revrobotics.PersistMode;
|
||||||
|
import com.revrobotics.RelativeEncoder;
|
||||||
|
import com.revrobotics.ResetMode;
|
||||||
|
import com.revrobotics.spark.SparkClosedLoopController;
|
||||||
|
import com.revrobotics.spark.SparkMax;
|
||||||
|
import com.revrobotics.spark.SparkBase.ControlType;
|
||||||
|
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj.Timer;
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
import edu.wpi.first.wpilibj2.command.button.Trigger;
|
||||||
|
import frc.robot.constants.HoodConstants;
|
||||||
|
|
||||||
|
public class Hood extends SubsystemBase {
|
||||||
|
private SparkMax motor;
|
||||||
|
|
||||||
|
private RelativeEncoder encoder;
|
||||||
|
|
||||||
|
private SparkClosedLoopController controller;
|
||||||
|
|
||||||
|
private Trigger resetTrigger;
|
||||||
|
private Trigger timerTrigger;
|
||||||
|
|
||||||
|
private Timer resetTimer;
|
||||||
|
|
||||||
|
private double currentTargetDegrees;
|
||||||
|
|
||||||
|
public Hood() {
|
||||||
|
motor = new SparkMax(HoodConstants.kMotorCANID, MotorType.kBrushless);
|
||||||
|
|
||||||
|
motor.configure(
|
||||||
|
HoodConstants.kConfig,
|
||||||
|
ResetMode.kResetSafeParameters,
|
||||||
|
PersistMode.kPersistParameters
|
||||||
|
);
|
||||||
|
|
||||||
|
encoder = motor.getEncoder();
|
||||||
|
encoder.setPosition(HoodConstants.kStartupAngle);
|
||||||
|
|
||||||
|
controller = motor.getClosedLoopController();
|
||||||
|
|
||||||
|
resetTimer = new Timer();
|
||||||
|
resetTimer.reset();
|
||||||
|
|
||||||
|
resetTrigger = new Trigger(() -> (motor.getOutputCurrent() > HoodConstants.kAmpsToTriggerPositionReset));
|
||||||
|
resetTrigger.onTrue(new InstantCommand(resetTimer::start));
|
||||||
|
resetTrigger.onFalse(new InstantCommand(() -> {
|
||||||
|
resetTimer.stop();
|
||||||
|
resetTimer.reset();
|
||||||
|
}));
|
||||||
|
|
||||||
|
timerTrigger = new Trigger(() -> resetTimer.hasElapsed(HoodConstants.kTimeAboveThresholdToReset));
|
||||||
|
timerTrigger.onTrue(new InstantCommand(() -> {
|
||||||
|
encoder.setPosition(0);
|
||||||
|
resetTimer.reset();
|
||||||
|
}));
|
||||||
|
|
||||||
|
currentTargetDegrees = HoodConstants.kStartupAngle;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void periodic() {
|
||||||
|
Logger.recordOutput("Hood/OutputCurrent", motor.getOutputCurrent());
|
||||||
|
Logger.recordOutput("Hood/CurrentTarget", Math.toDegrees(currentTargetDegrees));
|
||||||
|
Logger.recordOutput("Hood/CurrentAngle", Math.toDegrees(encoder.getPosition()));
|
||||||
|
Logger.recordOutput("Hood/AtSetpoint", controller.isAtSetpoint());
|
||||||
|
Logger.recordOutput("Hood/VoltageOut", motor.getAppliedOutput()*motor.getBusVoltage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command trackToAngle(DoubleSupplier degreeAngleSupplier) {
|
||||||
|
return run(() -> {
|
||||||
|
currentTargetDegrees = degreeAngleSupplier.getAsDouble();
|
||||||
|
|
||||||
|
controller.setSetpoint(currentTargetDegrees, ControlType.kPosition);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An automated form of resetting the hood position sensing.
|
||||||
|
*
|
||||||
|
* Run down at the full manual speed (note that this is affected by the
|
||||||
|
* kMaxManualSpeedMultiplier constant) until the timer trigger becomes true
|
||||||
|
* (i.e. the output current has been above the threshold (kAmpsToTriggerPositionReset)
|
||||||
|
* for reset for the amount of specified by kTimeAboveThresholdToReset). Once
|
||||||
|
* that returns true, the motor is stopped until the timer trigger switches to false
|
||||||
|
* (i.e. it has reset the position automatically, because that's how it's configured,
|
||||||
|
* and resets the timer to 0, which makes the timer trigger false)
|
||||||
|
*
|
||||||
|
* @return A complete Command structure that performs the specified action
|
||||||
|
*/
|
||||||
|
public Command automatedRezero() {
|
||||||
|
return manualSpeed(() -> -1)
|
||||||
|
.until(timerTrigger)
|
||||||
|
.andThen(
|
||||||
|
stop().until(timerTrigger.negate())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An alternate form of {@link #automatedRezero()} that doesn't rely on the triggers
|
||||||
|
* to reset the hood position to zero. Note that this method doesn't have any time limiting
|
||||||
|
* factor to it, as soon as the current goes above the threshold specified by
|
||||||
|
* kAmpsToTriggerPositionReset the encoder position will be set to zero
|
||||||
|
*
|
||||||
|
* @return A complete Command structure that performs the specified action
|
||||||
|
*/
|
||||||
|
public Command automatedRezeroNoTimer() {
|
||||||
|
return manualSpeed(() -> -1)
|
||||||
|
.until(() -> motor.getOutputCurrent() >= HoodConstants.kAmpsToTriggerPositionReset)
|
||||||
|
.andThen(new InstantCommand(() -> encoder.setPosition(0)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command manualSpeed(DoubleSupplier speed) {
|
||||||
|
currentTargetDegrees = 0;
|
||||||
|
|
||||||
|
return run(() -> {
|
||||||
|
motor.set(speed.getAsDouble() * HoodConstants.kMaxManualSpeedMultiplier);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command stop() {
|
||||||
|
return manualSpeed(() -> 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getTargetDegrees() {
|
||||||
|
return currentTargetDegrees;
|
||||||
|
}
|
||||||
|
}
|
||||||
89
src/main/java/frc/robot/subsystems/IntakePivot.java
Normal file
89
src/main/java/frc/robot/subsystems/IntakePivot.java
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
package frc.robot.subsystems;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.function.DoubleSupplier;
|
||||||
|
|
||||||
|
import org.littletonrobotics.junction.Logger;
|
||||||
|
|
||||||
|
import com.revrobotics.PersistMode;
|
||||||
|
import com.revrobotics.RelativeEncoder;
|
||||||
|
import com.revrobotics.ResetMode;
|
||||||
|
import com.revrobotics.spark.SparkClosedLoopController;
|
||||||
|
import com.revrobotics.spark.SparkMax;
|
||||||
|
import com.revrobotics.spark.SparkBase.ControlType;
|
||||||
|
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
import frc.robot.constants.IntakePivotConstants;
|
||||||
|
import frc.robot.constants.IntakePivotConstants.IntakePivotPosition;
|
||||||
|
|
||||||
|
public class IntakePivot extends SubsystemBase {
|
||||||
|
private SparkMax leftMotor;
|
||||||
|
private SparkMax rightMotor;
|
||||||
|
|
||||||
|
private RelativeEncoder encoder;
|
||||||
|
|
||||||
|
private SparkClosedLoopController controller;
|
||||||
|
|
||||||
|
private IntakePivotPosition currentTargetPosition;
|
||||||
|
|
||||||
|
public IntakePivot() {
|
||||||
|
leftMotor = new SparkMax(IntakePivotConstants.kLeftMotorCANID, MotorType.kBrushless);
|
||||||
|
rightMotor = new SparkMax(IntakePivotConstants.kRightMotorCANID, MotorType.kBrushless);
|
||||||
|
|
||||||
|
leftMotor.configure(
|
||||||
|
IntakePivotConstants.KLeftMotorConfig,
|
||||||
|
ResetMode.kResetSafeParameters,
|
||||||
|
PersistMode.kPersistParameters
|
||||||
|
);
|
||||||
|
|
||||||
|
rightMotor.configure(
|
||||||
|
IntakePivotConstants.kRightMotorConfig,
|
||||||
|
ResetMode.kResetSafeParameters,
|
||||||
|
PersistMode.kPersistParameters
|
||||||
|
);
|
||||||
|
|
||||||
|
controller = leftMotor.getClosedLoopController();
|
||||||
|
|
||||||
|
encoder = leftMotor.getEncoder();
|
||||||
|
encoder.setPosition(IntakePivotConstants.IntakePivotPosition.kUp.getPositionRadians());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void periodic() {
|
||||||
|
Logger.recordOutput(
|
||||||
|
"IntakePivot/TargetPosition",
|
||||||
|
currentTargetPosition == null ? -1 : currentTargetPosition.getPositionRadians());
|
||||||
|
Logger.recordOutput("IntakePivot/CurrentPosition", encoder.getPosition());
|
||||||
|
Logger.recordOutput("IntakePivot/AtSetpoint", controller.isAtSetpoint());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command maintainPosition(IntakePivotPosition position) {
|
||||||
|
return run(() -> {
|
||||||
|
currentTargetPosition = position;
|
||||||
|
|
||||||
|
if(currentTargetPosition == null) {
|
||||||
|
leftMotor.disable();
|
||||||
|
} else {
|
||||||
|
controller.setSetpoint(currentTargetPosition.getPositionRadians(), ControlType.kPosition);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command manualSpeed(DoubleSupplier speed) {
|
||||||
|
return run(() -> {
|
||||||
|
currentTargetPosition = null;
|
||||||
|
|
||||||
|
leftMotor.set(speed.getAsDouble() * IntakePivotConstants.kMaxManualSpeedMultiplier);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command stop() {
|
||||||
|
return manualSpeed(() -> 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<IntakePivotPosition> getCurrentTargetPosition() {
|
||||||
|
return Optional.ofNullable(currentTargetPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
43
src/main/java/frc/robot/subsystems/IntakeRoller.java
Normal file
43
src/main/java/frc/robot/subsystems/IntakeRoller.java
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package frc.robot.subsystems;
|
||||||
|
|
||||||
|
import com.revrobotics.PersistMode;
|
||||||
|
import com.revrobotics.ResetMode;
|
||||||
|
import com.revrobotics.spark.SparkMax;
|
||||||
|
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
import frc.robot.constants.IntakeRollerConstants;
|
||||||
|
|
||||||
|
public class IntakeRoller extends SubsystemBase {
|
||||||
|
private SparkMax motor;
|
||||||
|
|
||||||
|
public IntakeRoller() {
|
||||||
|
motor = new SparkMax(IntakeRollerConstants.kMotorCANID, MotorType.kBrushless);
|
||||||
|
|
||||||
|
motor.configure(
|
||||||
|
IntakeRollerConstants.leftMotorConfig,
|
||||||
|
ResetMode.kResetSafeParameters,
|
||||||
|
PersistMode.kPersistParameters
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command runIn() {
|
||||||
|
return run(() -> {
|
||||||
|
motor.set(IntakeRollerConstants.kSpeed);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command runOut() {
|
||||||
|
return run(() -> {
|
||||||
|
motor.set(-IntakeRollerConstants.kSpeed);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command stop() {
|
||||||
|
return run(() -> {
|
||||||
|
motor.set(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
205
src/main/java/frc/robot/subsystems/PhotonVision.java
Normal file
205
src/main/java/frc/robot/subsystems/PhotonVision.java
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
package frc.robot.subsystems;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.OptionalDouble;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import org.photonvision.EstimatedRobotPose;
|
||||||
|
import org.photonvision.PhotonCamera;
|
||||||
|
import org.photonvision.PhotonPoseEstimator;
|
||||||
|
import org.photonvision.PhotonPoseEstimator.PoseStrategy;
|
||||||
|
import org.photonvision.targeting.PhotonPipelineResult;
|
||||||
|
import org.photonvision.targeting.PhotonTrackedTarget;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.geometry.Pose3d;
|
||||||
|
import edu.wpi.first.math.geometry.Transform3d;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
import frc.robot.constants.CompetitionConstants;
|
||||||
|
import frc.robot.constants.PhotonConstants;
|
||||||
|
import frc.robot.utilities.PhotonVisionConfig;
|
||||||
|
import frc.robot.utilities.VisualPose;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This "Subsystem" is not actually a Subsystem. The intent is for this to be treated as
|
||||||
|
* a "resource", that is, something that is not inherently a physical mechanism to be controlled.
|
||||||
|
*
|
||||||
|
* A "resource" in this instance should be thought of as something that can be safely shared
|
||||||
|
* by other Subsystems generally without collision if more that one Subsystem requires the
|
||||||
|
* "resource" at any given time.
|
||||||
|
*
|
||||||
|
* Resources should <i>NOT</i> produce Commands, they should not have a default Command.
|
||||||
|
* Resources do not have behaviors, and because Commands are in of themselves behaviors,
|
||||||
|
* this class should not have Commands.
|
||||||
|
*
|
||||||
|
* Part of the thinking behind creating the PhotonVision components this way is to rely
|
||||||
|
* on the CommandScheduler to call periodic. If this weren't the case, some other subsystem
|
||||||
|
* would have to manage calling for periodic updates, while still sharing the resource with
|
||||||
|
* other subsystems <i>somehow</i>.
|
||||||
|
*
|
||||||
|
* This class is dynamic, by adding or removing PhotonVisionConfig objects to the "configs"
|
||||||
|
* List in the PhotonConstants file, you change what is set up internally in this class.
|
||||||
|
* 1 config means 1 camera, 1 estimator, 1 stored pipeline result, 2 configs means 2 cameras,
|
||||||
|
* 2 estimators, etc. etc.
|
||||||
|
*/
|
||||||
|
public class PhotonVision extends SubsystemBase {
|
||||||
|
private PhotonCamera[] cameras;
|
||||||
|
private PhotonPoseEstimator[] estimators;
|
||||||
|
private List<PhotonPipelineResult> latestResults;
|
||||||
|
|
||||||
|
private ArrayList<Consumer<VisualPose>> poseEstimateConsumers;
|
||||||
|
|
||||||
|
public PhotonVision() {
|
||||||
|
cameras = new PhotonCamera[PhotonConstants.configs.size()];
|
||||||
|
estimators = new PhotonPoseEstimator[PhotonConstants.configs.size()];
|
||||||
|
latestResults = new ArrayList<PhotonPipelineResult>();
|
||||||
|
|
||||||
|
for(int i = 0; i < PhotonConstants.configs.size(); i++) {
|
||||||
|
cameras[i] = new PhotonCamera(PhotonConstants.configs.get(i).cameraName());
|
||||||
|
estimators[i] = new PhotonPoseEstimator(
|
||||||
|
CompetitionConstants.kTagLayout,
|
||||||
|
PoseStrategy.MULTI_TAG_PNP_ON_COPROCESSOR,
|
||||||
|
PhotonConstants.configs.get(i).robotToCamera()
|
||||||
|
);
|
||||||
|
latestResults.add(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
poseEstimateConsumers = new ArrayList<Consumer<VisualPose>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void periodic() {
|
||||||
|
for(int i = 0; i < cameras.length; i++) {
|
||||||
|
List<PhotonPipelineResult> results = cameras[i].getAllUnreadResults();
|
||||||
|
|
||||||
|
if(!results.isEmpty()) {
|
||||||
|
latestResults.set(i, results.get(results.size() - 1));
|
||||||
|
|
||||||
|
Optional<EstimatedRobotPose> pose = estimators[i].update(latestResults.get(i));
|
||||||
|
|
||||||
|
if(!pose.isEmpty()) {
|
||||||
|
VisualPose visualPose = new VisualPose(
|
||||||
|
cameras[i].getName(),
|
||||||
|
pose.get().estimatedPose.toPose2d(),
|
||||||
|
pose.get().timestampSeconds
|
||||||
|
);
|
||||||
|
|
||||||
|
for(Consumer<VisualPose> consumer: poseEstimateConsumers) {
|
||||||
|
consumer.accept(visualPose);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the best 3D pose for a given AprilTag ID as seen by the cameras on the robot.
|
||||||
|
*
|
||||||
|
* All cameras fields of view are observed, if no camera can see the given tag ID, this
|
||||||
|
* method will return Optional.empty().
|
||||||
|
*
|
||||||
|
* Note that this method has no minimum confidence threshold for a tag. This means that
|
||||||
|
* if one camera thinks it sees the tag, even with very low confidence, it'll still return
|
||||||
|
* some sort of pose.
|
||||||
|
*
|
||||||
|
* @param tagID The ID of the tag to look for in the latest results from all cameras
|
||||||
|
* @return An Optional object containing a Pose3d object, or Optional.empty() if
|
||||||
|
* the tag is not present anywhere in the robots field of view.
|
||||||
|
*/
|
||||||
|
public Optional<Pose3d> getBestPoseForTag(int tagID) {
|
||||||
|
PhotonVisionConfig config = null;
|
||||||
|
Transform3d bestCameraToTarget = null;
|
||||||
|
float bestConfidence = -1;
|
||||||
|
|
||||||
|
for(int cameraIndex = 0; cameraIndex < latestResults.size(); cameraIndex++) {
|
||||||
|
if(latestResults.get(cameraIndex) == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(PhotonTrackedTarget target: latestResults.get(cameraIndex).getTargets()) {
|
||||||
|
if(target.getFiducialId() != tagID || bestConfidence > target.getDetectedObjectConfidence()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
config = PhotonConstants.configs.get(cameraIndex);
|
||||||
|
bestCameraToTarget = target.bestCameraToTarget;
|
||||||
|
bestConfidence = target.getDetectedObjectConfidence();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bestCameraToTarget == null) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is based on what PhotonVision does for multitag Pose estimation
|
||||||
|
// See PhotonPoseEstimator.multiTagOnCoprocStrategy
|
||||||
|
// TODO This doesn't currently account for the offset of the tag relative to say the hub
|
||||||
|
// unclear if that offset amount will be important or not
|
||||||
|
return Optional.of(Pose3d.kZero
|
||||||
|
.plus(bestCameraToTarget.inverse())
|
||||||
|
.relativeTo(CompetitionConstants.kTagLayout.getOrigin())
|
||||||
|
.plus(config.robotToCamera().inverse()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the best yaw for a given AprilTag ID as seen by the cameras on the robot.
|
||||||
|
*
|
||||||
|
* All cameras fields of view are observed, if no camera can see the given tag ID, this
|
||||||
|
* method will return OptionalDouble.empty()
|
||||||
|
*
|
||||||
|
* Note that this method has no minimum confidence threshold for a tag. This means that
|
||||||
|
* if one camera thinks it sees the tag, even with very low confidence, it'll still
|
||||||
|
* return some sort of yaw value.
|
||||||
|
*
|
||||||
|
* Note that the yaw value here is the yaw of the observed tag relative to the center
|
||||||
|
* of the cameras image frame.
|
||||||
|
*
|
||||||
|
* @param tagID The ID of the tag to look for in the latest results from all cameras
|
||||||
|
* @return An OptionalDouble object containing a Double representing the described yaw
|
||||||
|
* of the AprilTag specified, or OptionalDouble.empty() if the tag is not present
|
||||||
|
* anywhere in the robots field of view
|
||||||
|
*/
|
||||||
|
public OptionalDouble getBestYawForTag(int tagID) {
|
||||||
|
double bestTagYaw = -1;
|
||||||
|
float bestConfidence = -1;
|
||||||
|
|
||||||
|
for(PhotonPipelineResult result: latestResults) {
|
||||||
|
if(result == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(PhotonTrackedTarget target: result.getTargets()) {
|
||||||
|
if(target.getFiducialId() != tagID || bestConfidence > target.getDetectedObjectClassID()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bestTagYaw = target.getYaw();
|
||||||
|
bestConfidence = target.getDetectedObjectConfidence();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bestConfidence == -1) {
|
||||||
|
return OptionalDouble.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
return OptionalDouble.of(bestTagYaw);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a Consumer of VisualPose records to the PhotonVision resource.
|
||||||
|
*
|
||||||
|
* Each consumer will receive a VisualPose object when any camera produces a new
|
||||||
|
* VisualPose.
|
||||||
|
*
|
||||||
|
* The number of Poses produced in a given 20ms cycle is the same number as how many
|
||||||
|
* cameras there are on the robot, assuming those cameras see enough tags to generate a pose,
|
||||||
|
* as currently all cameras configuration will generate a Pose2d
|
||||||
|
*
|
||||||
|
* @param consumer The lambda, functional reference, or Consumer implementing object
|
||||||
|
* that will consume Poses produced by the PhotonVision resource.
|
||||||
|
*/
|
||||||
|
public void addPoseEstimateConsumer(Consumer<VisualPose> consumer) {
|
||||||
|
poseEstimateConsumers.add(consumer);
|
||||||
|
}
|
||||||
|
}
|
||||||
123
src/main/java/frc/robot/subsystems/Shooter.java
Normal file
123
src/main/java/frc/robot/subsystems/Shooter.java
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
package frc.robot.subsystems;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.function.DoubleSupplier;
|
||||||
|
|
||||||
|
import org.littletonrobotics.junction.Logger;
|
||||||
|
|
||||||
|
import com.revrobotics.AbsoluteEncoder;
|
||||||
|
import com.revrobotics.PersistMode;
|
||||||
|
import com.revrobotics.RelativeEncoder;
|
||||||
|
import com.revrobotics.ResetMode;
|
||||||
|
import com.revrobotics.spark.SparkClosedLoopController;
|
||||||
|
import com.revrobotics.spark.SparkMax;
|
||||||
|
import com.revrobotics.spark.SparkBase.ControlType;
|
||||||
|
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
import frc.robot.constants.ShooterConstants;
|
||||||
|
import frc.robot.constants.ShooterConstants.ShooterSpeeds;
|
||||||
|
|
||||||
|
public class Shooter extends SubsystemBase {
|
||||||
|
private SparkMax leftMotor;
|
||||||
|
private SparkMax rightMotor;
|
||||||
|
|
||||||
|
private AbsoluteEncoder leftEncoder;
|
||||||
|
private AbsoluteEncoder rightEncoder;
|
||||||
|
|
||||||
|
private RelativeEncoder rightRelative;
|
||||||
|
|
||||||
|
private SparkClosedLoopController leftClosedLoopController;
|
||||||
|
private SparkClosedLoopController rightClosedLoopController;
|
||||||
|
|
||||||
|
private ShooterSpeeds targetSpeeds;
|
||||||
|
|
||||||
|
public Shooter() {
|
||||||
|
leftMotor = new SparkMax(ShooterConstants.kLeftShooterMotorCANID, MotorType.kBrushless);
|
||||||
|
rightMotor = new SparkMax(ShooterConstants.kRightShooterMotorCANID, MotorType.kBrushless);
|
||||||
|
|
||||||
|
leftMotor.configure(
|
||||||
|
ShooterConstants.kLeftMotorConfig,
|
||||||
|
ResetMode.kResetSafeParameters,
|
||||||
|
PersistMode.kPersistParameters
|
||||||
|
);
|
||||||
|
|
||||||
|
rightMotor.configure(
|
||||||
|
ShooterConstants.kRightMotorConfig,
|
||||||
|
ResetMode.kResetSafeParameters,
|
||||||
|
PersistMode.kPersistParameters
|
||||||
|
);
|
||||||
|
|
||||||
|
leftEncoder = leftMotor.getAbsoluteEncoder();
|
||||||
|
rightEncoder = rightMotor.getAbsoluteEncoder();
|
||||||
|
|
||||||
|
leftClosedLoopController = leftMotor.getClosedLoopController();
|
||||||
|
rightClosedLoopController = rightMotor.getClosedLoopController();
|
||||||
|
|
||||||
|
// TODO Set this to the initial startup speed
|
||||||
|
targetSpeeds = null;
|
||||||
|
|
||||||
|
rightRelative = rightMotor.getEncoder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void periodic() {
|
||||||
|
Logger.recordOutput(
|
||||||
|
"Shooter/TargetRPM",
|
||||||
|
targetSpeeds == null ? 0 : targetSpeeds.getSpeedRPM()
|
||||||
|
);
|
||||||
|
|
||||||
|
Logger.recordOutput("Shooter/LeftRollers/CurrentRPM", leftEncoder.getVelocity());
|
||||||
|
Logger.recordOutput("Shooter/RightRollers/CurrentRPM", rightEncoder.getVelocity());
|
||||||
|
|
||||||
|
Logger.recordOutput("Shooter/RightRollers/rightmotor", rightRelative.getVelocity());
|
||||||
|
|
||||||
|
|
||||||
|
// TODO How does the SparkMAX controller determine "at setpoint"? Is there any tolerance?
|
||||||
|
Logger.recordOutput("Shooter/LeftRollers/AtSetpoint", leftClosedLoopController.isAtSetpoint());
|
||||||
|
Logger.recordOutput("Shooter/RightRollers/AtSetpoint", rightClosedLoopController.isAtSetpoint());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command maintainSpeed(ShooterSpeeds speeds) {
|
||||||
|
return run(() -> {
|
||||||
|
targetSpeeds = speeds;
|
||||||
|
|
||||||
|
if(targetSpeeds == null) {
|
||||||
|
leftMotor.disable();
|
||||||
|
rightMotor.disable();
|
||||||
|
} else {
|
||||||
|
leftClosedLoopController.setSetpoint(
|
||||||
|
targetSpeeds.getSpeedRPM(),
|
||||||
|
ControlType.kVelocity
|
||||||
|
);
|
||||||
|
|
||||||
|
rightClosedLoopController.setSetpoint(
|
||||||
|
targetSpeeds.getSpeedRPM(),
|
||||||
|
ControlType.kVelocity
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command manualSpeed(DoubleSupplier speed) {
|
||||||
|
return run(() -> {
|
||||||
|
targetSpeeds = null;
|
||||||
|
|
||||||
|
leftMotor.set(speed.getAsDouble() * ShooterConstants.kMaxManualSpeedMultiplier);
|
||||||
|
rightMotor.set(speed.getAsDouble() * ShooterConstants.kMaxManualSpeedMultiplier);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command stop() {
|
||||||
|
return manualSpeed(() -> 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getAverageActualSpeeds() {
|
||||||
|
return (leftEncoder.getVelocity() + rightEncoder.getVelocity()) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<ShooterSpeeds> getTargetSpeeds() {
|
||||||
|
return Optional.ofNullable(targetSpeeds);
|
||||||
|
}
|
||||||
|
}
|
||||||
63
src/main/java/frc/robot/subsystems/Spindexer.java
Normal file
63
src/main/java/frc/robot/subsystems/Spindexer.java
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
package frc.robot.subsystems;
|
||||||
|
|
||||||
|
import com.ctre.phoenix6.controls.DutyCycleOut;
|
||||||
|
import com.ctre.phoenix6.hardware.TalonFX;
|
||||||
|
import com.revrobotics.PersistMode;
|
||||||
|
import com.revrobotics.ResetMode;
|
||||||
|
import com.revrobotics.spark.SparkMax;
|
||||||
|
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
import frc.robot.constants.SpindexerConstants;
|
||||||
|
|
||||||
|
public class Spindexer extends SubsystemBase {
|
||||||
|
private TalonFX spindexerMotor;
|
||||||
|
|
||||||
|
private SparkMax feederMotor;
|
||||||
|
|
||||||
|
private DutyCycleOut spindexerMotorOutput;
|
||||||
|
|
||||||
|
public Spindexer() {
|
||||||
|
spindexerMotor = new TalonFX(SpindexerConstants.kSpindexerMotorCANID);
|
||||||
|
|
||||||
|
feederMotor = new SparkMax(SpindexerConstants.kFeederMotorCANID, MotorType.kBrushless);
|
||||||
|
|
||||||
|
spindexerMotor.getConfigurator().apply(SpindexerConstants.kSpindexerCurrentLimitConfig);
|
||||||
|
spindexerMotor.getConfigurator().apply(SpindexerConstants.kSpindexerMotorConfig);
|
||||||
|
|
||||||
|
feederMotor.configure(
|
||||||
|
SpindexerConstants.kFeederConfig,
|
||||||
|
ResetMode.kResetSafeParameters,
|
||||||
|
PersistMode.kPersistParameters
|
||||||
|
);
|
||||||
|
|
||||||
|
spindexerMotorOutput = new DutyCycleOut(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command spinToShooter() {
|
||||||
|
return run(() -> {
|
||||||
|
spindexerMotor.setControl(
|
||||||
|
spindexerMotorOutput.withOutput(SpindexerConstants.kSpindexerSpeed)
|
||||||
|
);
|
||||||
|
feederMotor.set(SpindexerConstants.kFeederSpeed);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command spinToIntake() {
|
||||||
|
return run(() -> {
|
||||||
|
spindexerMotor.setControl(
|
||||||
|
spindexerMotorOutput.withOutput(-SpindexerConstants.kSpindexerSpeed)
|
||||||
|
);
|
||||||
|
feederMotor.set(-SpindexerConstants.kFeederSpeed);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Command stop() {
|
||||||
|
return run(() -> {
|
||||||
|
spindexerMotor.setControl(spindexerMotorOutput.withOutput(0));
|
||||||
|
feederMotor.set(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
390
src/main/java/frc/robot/utilities/Elastic.java
Normal file
390
src/main/java/frc/robot/utilities/Elastic.java
Normal file
@@ -0,0 +1,390 @@
|
|||||||
|
// Copyright (c) 2023-2026 Gold87 and other Elastic contributors
|
||||||
|
// This software can be modified and/or shared under the terms
|
||||||
|
// defined by the Elastic license:
|
||||||
|
// https://github.com/Gold872/elastic_dashboard/blob/main/LICENSE
|
||||||
|
|
||||||
|
package frc.robot.utilities;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||||
|
import edu.wpi.first.networktables.PubSubOption;
|
||||||
|
import edu.wpi.first.networktables.StringPublisher;
|
||||||
|
import edu.wpi.first.networktables.StringTopic;
|
||||||
|
|
||||||
|
public final class Elastic {
|
||||||
|
private static final StringTopic notificationTopic =
|
||||||
|
NetworkTableInstance.getDefault().getStringTopic("/Elastic/RobotNotifications");
|
||||||
|
private static final StringPublisher notificationPublisher =
|
||||||
|
notificationTopic.publish(PubSubOption.sendAll(true), PubSubOption.keepDuplicates(true));
|
||||||
|
private static final StringTopic selectedTabTopic =
|
||||||
|
NetworkTableInstance.getDefault().getStringTopic("/Elastic/SelectedTab");
|
||||||
|
private static final StringPublisher selectedTabPublisher =
|
||||||
|
selectedTabTopic.publish(PubSubOption.keepDuplicates(true));
|
||||||
|
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the possible levels of notifications for the Elastic dashboard. These levels are
|
||||||
|
* used to indicate the severity or type of notification.
|
||||||
|
*/
|
||||||
|
public enum NotificationLevel {
|
||||||
|
/** Informational Message */
|
||||||
|
INFO,
|
||||||
|
/** Warning message */
|
||||||
|
WARNING,
|
||||||
|
/** Error message */
|
||||||
|
ERROR
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends an notification to the Elastic dashboard. The notification is serialized as a JSON string
|
||||||
|
* before being published.
|
||||||
|
*
|
||||||
|
* @param notification the {@link Notification} object containing notification details
|
||||||
|
*/
|
||||||
|
public static void sendNotification(Notification notification) {
|
||||||
|
try {
|
||||||
|
notificationPublisher.set(objectMapper.writeValueAsString(notification));
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the tab of the dashboard with the given name. If no tab matches the name, this will
|
||||||
|
* have no effect on the widgets or tabs in view.
|
||||||
|
*
|
||||||
|
* <p>If the given name is a number, Elastic will select the tab whose index equals the number
|
||||||
|
* provided.
|
||||||
|
*
|
||||||
|
* @param tabName the name of the tab to select
|
||||||
|
*/
|
||||||
|
public static void selectTab(String tabName) {
|
||||||
|
selectedTabPublisher.set(tabName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the tab of the dashboard at the given index. If this index is greater than or equal to
|
||||||
|
* the number of tabs, this will have no effect.
|
||||||
|
*
|
||||||
|
* @param tabIndex the index of the tab to select.
|
||||||
|
*/
|
||||||
|
public static void selectTab(int tabIndex) {
|
||||||
|
selectTab(Integer.toString(tabIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents an notification object to be sent to the Elastic dashboard. This object holds
|
||||||
|
* properties such as level, title, description, display time, and dimensions to control how the
|
||||||
|
* notification is displayed on the dashboard.
|
||||||
|
*/
|
||||||
|
public static class Notification {
|
||||||
|
@JsonProperty("level")
|
||||||
|
private NotificationLevel level;
|
||||||
|
|
||||||
|
@JsonProperty("title")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@JsonProperty("description")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@JsonProperty("displayTime")
|
||||||
|
private int displayTimeMillis;
|
||||||
|
|
||||||
|
@JsonProperty("width")
|
||||||
|
private double width;
|
||||||
|
|
||||||
|
@JsonProperty("height")
|
||||||
|
private double height;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Notification with all default parameters. This constructor is intended to be
|
||||||
|
* used with the chainable decorator methods
|
||||||
|
*
|
||||||
|
* <p>Title and description fields are empty.
|
||||||
|
*/
|
||||||
|
public Notification() {
|
||||||
|
this(NotificationLevel.INFO, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Notification with all properties specified.
|
||||||
|
*
|
||||||
|
* @param level the level of the notification (e.g., INFO, WARNING, ERROR)
|
||||||
|
* @param title the title text of the notification
|
||||||
|
* @param description the descriptive text of the notification
|
||||||
|
* @param displayTimeMillis the time in milliseconds for which the notification is displayed
|
||||||
|
* @param width the width of the notification display area
|
||||||
|
* @param height the height of the notification display area, inferred if below zero
|
||||||
|
*/
|
||||||
|
public Notification(
|
||||||
|
NotificationLevel level,
|
||||||
|
String title,
|
||||||
|
String description,
|
||||||
|
int displayTimeMillis,
|
||||||
|
double width,
|
||||||
|
double height) {
|
||||||
|
this.level = level;
|
||||||
|
this.title = title;
|
||||||
|
this.displayTimeMillis = displayTimeMillis;
|
||||||
|
this.description = description;
|
||||||
|
this.height = height;
|
||||||
|
this.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Notification with default display time and dimensions.
|
||||||
|
*
|
||||||
|
* @param level the level of the notification
|
||||||
|
* @param title the title text of the notification
|
||||||
|
* @param description the descriptive text of the notification
|
||||||
|
*/
|
||||||
|
public Notification(NotificationLevel level, String title, String description) {
|
||||||
|
this(level, title, description, 3000, 350, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Notification with a specified display time and default dimensions.
|
||||||
|
*
|
||||||
|
* @param level the level of the notification
|
||||||
|
* @param title the title text of the notification
|
||||||
|
* @param description the descriptive text of the notification
|
||||||
|
* @param displayTimeMillis the display time in milliseconds
|
||||||
|
*/
|
||||||
|
public Notification(
|
||||||
|
NotificationLevel level, String title, String description, int displayTimeMillis) {
|
||||||
|
this(level, title, description, displayTimeMillis, 350, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Notification with specified dimensions and default display time. If the height
|
||||||
|
* is below zero, it is automatically inferred based on screen size.
|
||||||
|
*
|
||||||
|
* @param level the level of the notification
|
||||||
|
* @param title the title text of the notification
|
||||||
|
* @param description the descriptive text of the notification
|
||||||
|
* @param width the width of the notification display area
|
||||||
|
* @param height the height of the notification display area, inferred if below zero
|
||||||
|
*/
|
||||||
|
public Notification(
|
||||||
|
NotificationLevel level, String title, String description, double width, double height) {
|
||||||
|
this(level, title, description, 3000, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the level of this notification
|
||||||
|
*
|
||||||
|
* @param level the level to set the notification to
|
||||||
|
*/
|
||||||
|
public void setLevel(NotificationLevel level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the level of this notification
|
||||||
|
*/
|
||||||
|
public NotificationLevel getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the title of this notification
|
||||||
|
*
|
||||||
|
* @param title the title to set the notification to
|
||||||
|
*/
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the title of this notification
|
||||||
|
*
|
||||||
|
* @return the title of this notification
|
||||||
|
*/
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the description of this notification
|
||||||
|
*
|
||||||
|
* @param description the description to set the notification to
|
||||||
|
*/
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the display time of the notification
|
||||||
|
*
|
||||||
|
* @param seconds the number of seconds to display the notification for
|
||||||
|
*/
|
||||||
|
public void setDisplayTimeSeconds(double seconds) {
|
||||||
|
setDisplayTimeMillis((int) Math.round(seconds * 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the display time of the notification in milliseconds
|
||||||
|
*
|
||||||
|
* @param displayTimeMillis the number of milliseconds to display the notification for
|
||||||
|
*/
|
||||||
|
public void setDisplayTimeMillis(int displayTimeMillis) {
|
||||||
|
this.displayTimeMillis = displayTimeMillis;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the display time of the notification in milliseconds
|
||||||
|
*
|
||||||
|
* @return the number of milliseconds the notification is displayed for
|
||||||
|
*/
|
||||||
|
public int getDisplayTimeMillis() {
|
||||||
|
return displayTimeMillis;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the width of the notification
|
||||||
|
*
|
||||||
|
* @param width the width to set the notification to
|
||||||
|
*/
|
||||||
|
public void setWidth(double width) {
|
||||||
|
this.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the width of the notification
|
||||||
|
*
|
||||||
|
* @return the width of the notification
|
||||||
|
*/
|
||||||
|
public double getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the height of the notification
|
||||||
|
*
|
||||||
|
* <p>If the height is set to -1, the height will be determined automatically by the dashboard
|
||||||
|
*
|
||||||
|
* @param height the height to set the notification to
|
||||||
|
*/
|
||||||
|
public void setHeight(double height) {
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the height of the notification
|
||||||
|
*
|
||||||
|
* @return the height of the notification
|
||||||
|
*/
|
||||||
|
public double getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifies the notification's level and returns itself to allow for method chaining
|
||||||
|
*
|
||||||
|
* @param level the level to set the notification to
|
||||||
|
* @return the current notification
|
||||||
|
*/
|
||||||
|
public Notification withLevel(NotificationLevel level) {
|
||||||
|
this.level = level;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifies the notification's title and returns itself to allow for method chaining
|
||||||
|
*
|
||||||
|
* @param title the title to set the notification to
|
||||||
|
* @return the current notification
|
||||||
|
*/
|
||||||
|
public Notification withTitle(String title) {
|
||||||
|
setTitle(title);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifies the notification's description and returns itself to allow for method chaining
|
||||||
|
*
|
||||||
|
* @param description the description to set the notification to
|
||||||
|
* @return the current notification
|
||||||
|
*/
|
||||||
|
public Notification withDescription(String description) {
|
||||||
|
setDescription(description);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifies the notification's display time and returns itself to allow for method chaining
|
||||||
|
*
|
||||||
|
* @param seconds the number of seconds to display the notification for
|
||||||
|
* @return the current notification
|
||||||
|
*/
|
||||||
|
public Notification withDisplaySeconds(double seconds) {
|
||||||
|
return withDisplayMilliseconds((int) Math.round(seconds * 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifies the notification's display time and returns itself to allow for method chaining
|
||||||
|
*
|
||||||
|
* @param displayTimeMillis the number of milliseconds to display the notification for
|
||||||
|
* @return the current notification
|
||||||
|
*/
|
||||||
|
public Notification withDisplayMilliseconds(int displayTimeMillis) {
|
||||||
|
setDisplayTimeMillis(displayTimeMillis);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifies the notification's width and returns itself to allow for method chaining
|
||||||
|
*
|
||||||
|
* @param width the width to set the notification to
|
||||||
|
* @return the current notification
|
||||||
|
*/
|
||||||
|
public Notification withWidth(double width) {
|
||||||
|
setWidth(width);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifies the notification's height and returns itself to allow for method chaining
|
||||||
|
*
|
||||||
|
* @param height the height to set the notification to
|
||||||
|
* @return the current notification
|
||||||
|
*/
|
||||||
|
public Notification withHeight(double height) {
|
||||||
|
setHeight(height);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifies the notification's height and returns itself to allow for method chaining
|
||||||
|
*
|
||||||
|
* <p>This will set the height to -1 to have it automatically determined by the dashboard
|
||||||
|
*
|
||||||
|
* @return the current notification
|
||||||
|
*/
|
||||||
|
public Notification withAutomaticHeight() {
|
||||||
|
setHeight(-1);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifies the notification to disable the auto dismiss behavior
|
||||||
|
*
|
||||||
|
* <p>This sets the display time to 0 milliseconds
|
||||||
|
*
|
||||||
|
* <p>The auto dismiss behavior can be re-enabled by setting the display time to a number
|
||||||
|
* greater than 0
|
||||||
|
*
|
||||||
|
* @return the current notification
|
||||||
|
*/
|
||||||
|
public Notification withNoAutoDismiss() {
|
||||||
|
setDisplayTimeMillis(0);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
src/main/java/frc/robot/utilities/PhotonVisionConfig.java
Normal file
10
src/main/java/frc/robot/utilities/PhotonVisionConfig.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package frc.robot.utilities;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.geometry.Transform3d;
|
||||||
|
|
||||||
|
public record PhotonVisionConfig (
|
||||||
|
String cameraName,
|
||||||
|
Transform3d robotToCamera,
|
||||||
|
double cameraHeightMeters,
|
||||||
|
double cameraPitchRadians
|
||||||
|
) {}
|
||||||
37
src/main/java/frc/robot/utilities/SparkMAXTester.java
Normal file
37
src/main/java/frc/robot/utilities/SparkMAXTester.java
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package frc.robot.utilities;
|
||||||
|
|
||||||
|
import java.util.function.DoubleSupplier;
|
||||||
|
|
||||||
|
import com.revrobotics.spark.SparkMax;
|
||||||
|
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple subsystem that can be used to test a single SparkMax and associated NEO motor
|
||||||
|
*/
|
||||||
|
public class SparkMAXTester extends SubsystemBase {
|
||||||
|
private SparkMax spark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param deviceID The CAN ID of the SparkMAX that needs testing
|
||||||
|
*/
|
||||||
|
public SparkMAXTester(int deviceID) {
|
||||||
|
spark = new SparkMax(deviceID, MotorType.kBrushless);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the speed of the motor
|
||||||
|
*
|
||||||
|
* @param speed A method or lambda which returns a double between -1 and 1
|
||||||
|
* @return A Command object that runs indefinitely to control motor speed
|
||||||
|
*/
|
||||||
|
public Command setSpeed(DoubleSupplier speed) {
|
||||||
|
return run(() -> {
|
||||||
|
spark.set(speed.getAsDouble());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
220
src/main/java/frc/robot/utilities/SwerveModule.java
Normal file
220
src/main/java/frc/robot/utilities/SwerveModule.java
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
package frc.robot.utilities;
|
||||||
|
|
||||||
|
import org.littletonrobotics.junction.Logger;
|
||||||
|
|
||||||
|
import com.ctre.phoenix6.controls.VelocityVoltage;
|
||||||
|
import com.ctre.phoenix6.hardware.TalonFX;
|
||||||
|
import com.revrobotics.PersistMode;
|
||||||
|
import com.revrobotics.RelativeEncoder;
|
||||||
|
import com.revrobotics.ResetMode;
|
||||||
|
import com.revrobotics.spark.SparkClosedLoopController;
|
||||||
|
import com.revrobotics.spark.SparkMax;
|
||||||
|
import com.revrobotics.spark.SparkBase.ControlType;
|
||||||
|
import com.revrobotics.spark.SparkLowLevel.MotorType;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.geometry.Rotation2d;
|
||||||
|
import edu.wpi.first.math.kinematics.SwerveModulePosition;
|
||||||
|
import edu.wpi.first.math.kinematics.SwerveModuleState;
|
||||||
|
import edu.wpi.first.wpilibj.AnalogEncoder;
|
||||||
|
import frc.robot.constants.ModuleConstants;
|
||||||
|
import frc.robot.constants.ModuleConstants.ModuleName;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This thread
|
||||||
|
*
|
||||||
|
* https://www.chiefdelphi.com/t/best-easiest-way-to-connect-wire-and-program-thrifty-absolute-magnetic-encoder-to-rev-spark-max-motor-controller/439040/30
|
||||||
|
*
|
||||||
|
* implies that the best use of the thrifty absolute encoder is to use it as a reference for the Spark relative encoder and then
|
||||||
|
* used the closed loop control on the controller for turning
|
||||||
|
*
|
||||||
|
* IDK if that's really necessary, the read rate of the analog ports is 100HZ, I suppose the only benefit is the higher rate of
|
||||||
|
* the controller closed loop controller.
|
||||||
|
*/
|
||||||
|
public class SwerveModule {
|
||||||
|
private ModuleName moduleName;
|
||||||
|
|
||||||
|
private TalonFX drive;
|
||||||
|
private SparkMax turning;
|
||||||
|
|
||||||
|
private RelativeEncoder turningRelativeEncoder;
|
||||||
|
|
||||||
|
private AnalogEncoder turningAbsoluteEncoder;
|
||||||
|
|
||||||
|
private SparkClosedLoopController turningClosedLoopController;
|
||||||
|
|
||||||
|
private VelocityVoltage driveVelocityRequest;
|
||||||
|
|
||||||
|
private SwerveModuleState lastTargetState;
|
||||||
|
private SwerveModuleState lastTargetStateOptimized;
|
||||||
|
|
||||||
|
private boolean isAbsoluteEncoderDisabled;
|
||||||
|
private boolean turningEncoderAutoRezeroEnabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the swerve module but with the Absolute Encoder disabled.
|
||||||
|
*
|
||||||
|
* This constructor assumes you zeroed the swerve modules (faced all the bevel gears to the left)
|
||||||
|
* before booting up the robot.
|
||||||
|
*
|
||||||
|
* @param moduleName The module name, Front Left, Front Right, etc.
|
||||||
|
* @param drivingCANID The CAN ID of the Kraken used to drive the module wheel
|
||||||
|
* @param turningCANID The CAN ID of the Spark MAX used to turn the module wheel
|
||||||
|
*/
|
||||||
|
public SwerveModule(ModuleName moduleName, int drivingCANID, int turningCANID) {
|
||||||
|
this(moduleName, drivingCANID, turningCANID, -1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the swerve module with the normal features, disables automatic rezeroing of the turning encoder
|
||||||
|
* from the absolute encoder.
|
||||||
|
*
|
||||||
|
* @param moduleName The module name, Front Left, Front Right, etc.
|
||||||
|
* @param drivingCANID The CAN ID of the Kraken used to drive the module wheel
|
||||||
|
* @param turningCANID The CAN ID of the Spark MAX used to turn the module wheel
|
||||||
|
* @param analogEncoderID The Analog In port ID for the Thrify Absolute Encoder
|
||||||
|
* @param analogEncoderOffset The angular offset for the absolute encoder to achieve 0 position on the module
|
||||||
|
*/
|
||||||
|
public SwerveModule(ModuleName moduleName, int drivingCANID, int turningCANID, int analogEncoderID, double analogEncoderOffset) {
|
||||||
|
this(moduleName, drivingCANID, turningCANID, analogEncoderID, analogEncoderOffset, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the swerve module with the normal features, and gives the option to enable automatic turning encoder rezeroing
|
||||||
|
* when the turning motor is not moving
|
||||||
|
*
|
||||||
|
* @param moduleName The module name, Front Left, Front Right, etc.
|
||||||
|
* @param drivingCANID The CAN ID of the Kraken used to drive the module wheel
|
||||||
|
* @param turningCANID The CAN ID of the Spark MAX used to turn the module wheel
|
||||||
|
* @param analogEncoderID The Analog In port ID for the Thrify Absolute Encoder
|
||||||
|
* @param analogEncoderOffset The angular offset for the absolute encoder to achieve 0 position on the module
|
||||||
|
* @param turningEncoderAutoRezeroEnabled Should the turning encoder in the NEO automatically rezero from the absolute encoder
|
||||||
|
*/
|
||||||
|
public SwerveModule(ModuleName moduleName, int drivingCANID, int turningCANID,
|
||||||
|
int analogEncoderID, double analogEncoderOffset, boolean turningEncoderAutoRezeroEnabled) {
|
||||||
|
isAbsoluteEncoderDisabled = (analogEncoderID == -1) || (analogEncoderOffset < 0);
|
||||||
|
|
||||||
|
drive = new TalonFX(drivingCANID);
|
||||||
|
turning = new SparkMax(turningCANID, MotorType.kBrushless);
|
||||||
|
|
||||||
|
turningRelativeEncoder = turning.getEncoder();
|
||||||
|
|
||||||
|
if(!isAbsoluteEncoderDisabled) {
|
||||||
|
turningAbsoluteEncoder = new AnalogEncoder(analogEncoderID, 2 * Math.PI, analogEncoderOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
turningClosedLoopController = turning.getClosedLoopController();
|
||||||
|
|
||||||
|
drive.getConfigurator().apply(ModuleConstants.kDriveCurrentLimitConfig);
|
||||||
|
drive.getConfigurator().apply(ModuleConstants.kDriveFeedConfig);
|
||||||
|
drive.getConfigurator().apply(ModuleConstants.kDriveMotorConfig);
|
||||||
|
drive.getConfigurator().apply(ModuleConstants.kAudioConfig);
|
||||||
|
drive.getConfigurator().apply(ModuleConstants.kDriveSlot0Config);
|
||||||
|
|
||||||
|
turning.configure(
|
||||||
|
ModuleConstants.turningConfig,
|
||||||
|
ResetMode.kResetSafeParameters,
|
||||||
|
PersistMode.kPersistParameters
|
||||||
|
);
|
||||||
|
|
||||||
|
driveVelocityRequest = new VelocityVoltage(0);
|
||||||
|
|
||||||
|
if(isAbsoluteEncoderDisabled){
|
||||||
|
turningRelativeEncoder.setPosition(0);
|
||||||
|
} else {
|
||||||
|
turningRelativeEncoder.setPosition(turningAbsoluteEncoder.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
drive.setPosition(0);
|
||||||
|
|
||||||
|
this.lastTargetState = getState();
|
||||||
|
this.lastTargetStateOptimized = getState();
|
||||||
|
|
||||||
|
this.turningEncoderAutoRezeroEnabled = turningEncoderAutoRezeroEnabled;
|
||||||
|
|
||||||
|
this.moduleName = moduleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void periodic() {
|
||||||
|
|
||||||
|
if(!isAbsoluteEncoderDisabled) {
|
||||||
|
Logger.recordOutput(moduleName.getLoggableName() + "/AbsoluteEncoder/Position", turningAbsoluteEncoder.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.recordOutput(moduleName.getLoggableName() + "/ModuleTargetState", lastTargetState);
|
||||||
|
Logger.recordOutput(moduleName.getLoggableName() + "/ModuleTargetStateOptimized", lastTargetStateOptimized);
|
||||||
|
Logger.recordOutput(moduleName.getLoggableName() + "/SwerveModuleState", getState());
|
||||||
|
Logger.recordOutput(moduleName.getLoggableName() + "/SwerveModulePosition", getPosition());
|
||||||
|
Logger.recordOutput(moduleName.getLoggableName() + "/RelativeEncoderPosition", getTurningEncoderPosition());
|
||||||
|
|
||||||
|
// TODO Re-enable this? Was turned off when there was drivetrain issues
|
||||||
|
// Now that there aren't, do we try this again?
|
||||||
|
/*
|
||||||
|
if(!isAbsoluteEncoderDisabled && turningEncoderAutoRezeroEnabled) {
|
||||||
|
if(Math.abs(getState().angle.getRadians() - lastTargetState.angle.getRadians()) <= ModuleConstants.kAutoResetPositionDeadband) {
|
||||||
|
resetEncoders();
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModuleName getModuleName() {
|
||||||
|
return moduleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SwerveModuleState getState() {
|
||||||
|
return new SwerveModuleState(
|
||||||
|
drive.getVelocity().getValueAsDouble() * ModuleConstants.kWheelCircumferenceMeters,
|
||||||
|
new Rotation2d(getTurningEncoderPosition())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SwerveModulePosition getPosition() {
|
||||||
|
return new SwerveModulePosition(
|
||||||
|
drive.getPosition().getValueAsDouble() * ModuleConstants.kWheelCircumferenceMeters,
|
||||||
|
new Rotation2d(getTurningEncoderPosition())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disableOutput() {
|
||||||
|
drive.disable();
|
||||||
|
turning.disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesiredState(SwerveModuleState desiredState) {
|
||||||
|
lastTargetState = new SwerveModuleState(desiredState.speedMetersPerSecond, desiredState.angle);
|
||||||
|
|
||||||
|
desiredState.optimize(new Rotation2d(getTurningEncoderPosition()));
|
||||||
|
|
||||||
|
lastTargetStateOptimized = desiredState;
|
||||||
|
|
||||||
|
drive.setControl(
|
||||||
|
driveVelocityRequest.withVelocity(
|
||||||
|
desiredState.speedMetersPerSecond / ModuleConstants.kWheelCircumferenceMeters
|
||||||
|
).withFeedForward(
|
||||||
|
desiredState.speedMetersPerSecond / ModuleConstants.kWheelCircumferenceMeters
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
turningClosedLoopController.setSetpoint(
|
||||||
|
desiredState.angle.getRadians(),
|
||||||
|
ControlType.kPosition
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getTurningEncoderPosition() {
|
||||||
|
return turningRelativeEncoder.getPosition() * (ModuleConstants.kIsEncoderInverted ? -1 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetEncoders() {
|
||||||
|
drive.setPosition(0);
|
||||||
|
|
||||||
|
zeroTurningEncoder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void zeroTurningEncoder() {
|
||||||
|
if(isAbsoluteEncoderDisabled) {
|
||||||
|
turningRelativeEncoder.setPosition(0);
|
||||||
|
} else {
|
||||||
|
turningRelativeEncoder.setPosition(turningAbsoluteEncoder.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
115
src/main/java/frc/robot/utilities/Utilities.java
Normal file
115
src/main/java/frc/robot/utilities/Utilities.java
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
package frc.robot.utilities;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.geometry.Pose2d;
|
||||||
|
import edu.wpi.first.wpilibj.DriverStation;
|
||||||
|
import edu.wpi.first.wpilibj.DriverStation.Alliance;
|
||||||
|
import frc.robot.constants.CompetitionConstants;
|
||||||
|
|
||||||
|
public class Utilities {
|
||||||
|
public static final double kG = -9.81;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Alliance enumeration that indicates who will have the first
|
||||||
|
* shift. Returns null if the data is not available.
|
||||||
|
*
|
||||||
|
* @return The Alliance that will have the first shift, or null if game specific data
|
||||||
|
* is not present
|
||||||
|
*/
|
||||||
|
public static Alliance whoHasFirstShift() {
|
||||||
|
String gameData = DriverStation.getGameSpecificMessage();
|
||||||
|
|
||||||
|
if(gameData.length() > 0) {
|
||||||
|
switch (gameData.charAt(0)) {
|
||||||
|
case 'B':
|
||||||
|
return Alliance.Red;
|
||||||
|
case 'R':
|
||||||
|
return Alliance.Blue;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the pose of the hub for the given alliance assigned to our robot.
|
||||||
|
* If no alliance is assigned (which is unlikely) this method returns
|
||||||
|
* the Blue hub pose, which is the closet to the field origin
|
||||||
|
*
|
||||||
|
* @return The Pose2d object which represents the appropriate pose of the Hub
|
||||||
|
*/
|
||||||
|
public static Pose2d getHubPose() {
|
||||||
|
Optional<Alliance> alliance = DriverStation.getAlliance();
|
||||||
|
|
||||||
|
if(alliance.isEmpty() || alliance.get() == Alliance.Blue) {
|
||||||
|
return CompetitionConstants.kBlueHubLocation;
|
||||||
|
} else {
|
||||||
|
return CompetitionConstants.kRedHubLocation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the AprilTag ID of the tag that is in the center of the hub
|
||||||
|
* for the robot's assigned alliance. If no alliance is assigned (which is unlikely)
|
||||||
|
* the Blue hub's center tag is returned.
|
||||||
|
*
|
||||||
|
* @return The tag ID that is in the center of the assigned alliance's hub
|
||||||
|
*/
|
||||||
|
public static int getHubCenterAprilTagID() {
|
||||||
|
Optional<Alliance> alliance = DriverStation.getAlliance();
|
||||||
|
|
||||||
|
if(alliance.isEmpty() || alliance.get() == Alliance.Blue) {
|
||||||
|
return 26;
|
||||||
|
} else {
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A ChatGPT possible hallucination related to calcuating whether a shot is possible
|
||||||
|
* for a given speed and change in X and Y position
|
||||||
|
*
|
||||||
|
* Note that X in this scenario is the physical distance from the shooter exit to
|
||||||
|
* target. Y is the change in height from the shooter exit to the target height
|
||||||
|
*
|
||||||
|
* @param targetVMPS The target velocity of the shooter in Meters per Second
|
||||||
|
* @param deltaXM The "as the crow flies" distance between the shooter exit and the target
|
||||||
|
* @param deltaYM The height difference between the shooter exit and the target
|
||||||
|
* @return A true or false value indicating whether the shot is possible
|
||||||
|
*/
|
||||||
|
public static boolean shotPossible(double targetVMPS, double deltaXM, double deltaYM) {
|
||||||
|
return Math.pow(targetVMPS, 4) >=
|
||||||
|
-9.81 * (-9.81 * Math.pow(deltaXM, 2) + 2 * deltaYM * Math.pow(targetVMPS, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A ChatGPT possible hallucination that calculates the angle required to make a shot for
|
||||||
|
* a given speed and change in X and Y position
|
||||||
|
*
|
||||||
|
* Note that X in this scenario is the physical disatance from the shooter exit to
|
||||||
|
* target. Y is the change in height from the shooter exit to the target height
|
||||||
|
*
|
||||||
|
* Setting softerShot to true changes the angle of attack to a soft, long range shot. False
|
||||||
|
* makes the shot more of a lob
|
||||||
|
*
|
||||||
|
* @param targetVMPS The target velocity of the shooter in Meters per Second
|
||||||
|
* @param deltaXM The "as the crow flies" distance between the shooter exit and the target
|
||||||
|
* @param deltaYM The height difference between the shooter exit and the target
|
||||||
|
* @param softerShot True for a long range shot, false for a short range lob
|
||||||
|
* @return The angle required of the shooter to make the shot described by the input parameters
|
||||||
|
*/
|
||||||
|
public static double shotAngle(double targetVMPS, double deltaXM, double deltaYM, boolean softerShot) {
|
||||||
|
double vPow2 = Math.pow(targetVMPS, 2);
|
||||||
|
double vPow4 = Math.pow(targetVMPS, 4);
|
||||||
|
double sqrtPiece = Math.sqrt(vPow4 - kG * (kG * Math.pow(deltaXM, 2) + 2 * deltaYM * vPow2));
|
||||||
|
|
||||||
|
if(softerShot) {
|
||||||
|
return Math.atan((vPow2 - sqrtPiece) / (kG * deltaXM));
|
||||||
|
} else {
|
||||||
|
return Math.atan((vPow2 + sqrtPiece) / (kG * deltaXM));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
src/main/java/frc/robot/utilities/VisualPose.java
Normal file
9
src/main/java/frc/robot/utilities/VisualPose.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package frc.robot.utilities;
|
||||||
|
|
||||||
|
import edu.wpi.first.math.geometry.Pose2d;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A record class which represents the source of a visual pose, the pose itself
|
||||||
|
* and the timestamp the pose was generated.
|
||||||
|
*/
|
||||||
|
public record VisualPose(String cameraName, Pose2d visualPose, double timestamp) {}
|
||||||
35
vendordeps/AdvantageKit.json
Normal file
35
vendordeps/AdvantageKit.json
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"fileName": "AdvantageKit.json",
|
||||||
|
"name": "AdvantageKit",
|
||||||
|
"version": "26.0.0",
|
||||||
|
"uuid": "d820cc26-74e3-11ec-90d6-0242ac120003",
|
||||||
|
"frcYear": "2026",
|
||||||
|
"mavenUrls": [
|
||||||
|
"https://frcmaven.wpi.edu/artifactory/littletonrobotics-mvn-release/"
|
||||||
|
],
|
||||||
|
"jsonUrl": "https://github.com/Mechanical-Advantage/AdvantageKit/releases/latest/download/AdvantageKit.json",
|
||||||
|
"javaDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "org.littletonrobotics.akit",
|
||||||
|
"artifactId": "akit-java",
|
||||||
|
"version": "26.0.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"jniDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "org.littletonrobotics.akit",
|
||||||
|
"artifactId": "akit-wpilibio",
|
||||||
|
"version": "26.0.0",
|
||||||
|
"skipInvalidPlatforms": false,
|
||||||
|
"isJar": false,
|
||||||
|
"validPlatforms": [
|
||||||
|
"linuxathena",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal",
|
||||||
|
"windowsx86-64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cppDependencies": []
|
||||||
|
}
|
||||||
38
vendordeps/PathplannerLib-2026.1.2.json
Normal file
38
vendordeps/PathplannerLib-2026.1.2.json
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"fileName": "PathplannerLib-2026.1.2.json",
|
||||||
|
"name": "PathplannerLib",
|
||||||
|
"version": "2026.1.2",
|
||||||
|
"uuid": "1b42324f-17c6-4875-8e77-1c312bc8c786",
|
||||||
|
"frcYear": "2026",
|
||||||
|
"mavenUrls": [
|
||||||
|
"https://3015rangerrobotics.github.io/pathplannerlib/repo"
|
||||||
|
],
|
||||||
|
"jsonUrl": "https://3015rangerrobotics.github.io/pathplannerlib/PathplannerLib.json",
|
||||||
|
"javaDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.pathplanner.lib",
|
||||||
|
"artifactId": "PathplannerLib-java",
|
||||||
|
"version": "2026.1.2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"jniDependencies": [],
|
||||||
|
"cppDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.pathplanner.lib",
|
||||||
|
"artifactId": "PathplannerLib-cpp",
|
||||||
|
"version": "2026.1.2",
|
||||||
|
"libName": "PathplannerLib",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"osxuniversal",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"linuxarm64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
171
vendordeps/Phoenix5-5.36.0.json
Normal file
171
vendordeps/Phoenix5-5.36.0.json
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
{
|
||||||
|
"fileName": "Phoenix5-5.36.0.json",
|
||||||
|
"name": "CTRE-Phoenix (v5)",
|
||||||
|
"version": "5.36.0",
|
||||||
|
"frcYear": "2026",
|
||||||
|
"uuid": "ab676553-b602-441f-a38d-f1296eff6537",
|
||||||
|
"mavenUrls": [
|
||||||
|
"https://maven.ctr-electronics.com/release/"
|
||||||
|
],
|
||||||
|
"jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2026-latest.json",
|
||||||
|
"requires": [
|
||||||
|
{
|
||||||
|
"uuid": "e995de00-2c64-4df5-8831-c1441420ff19",
|
||||||
|
"errorMessage": "Phoenix 5 requires low-level libraries from Phoenix 6. Please add the Phoenix 6 vendordep before adding Phoenix 5.",
|
||||||
|
"offlineFileName": "Phoenix6-frc2026-latest.json",
|
||||||
|
"onlineUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2026-latest.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conflictsWith": [
|
||||||
|
{
|
||||||
|
"uuid": "e7900d8d-826f-4dca-a1ff-182f658e98af",
|
||||||
|
"errorMessage": "Users must use the Phoenix 5 replay vendordep when using the Phoenix 6 replay vendordep.",
|
||||||
|
"offlineFileName": "Phoenix6-replay-frc2026-latest.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uuid": "fbc886a4-2cec-40c0-9835-71086a8cc3df",
|
||||||
|
"errorMessage": "Users cannot have both the replay and regular Phoenix 5 vendordeps in their robot program.",
|
||||||
|
"offlineFileName": "Phoenix5-replay-frc2026-latest.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"javaDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix",
|
||||||
|
"artifactId": "api-java",
|
||||||
|
"version": "5.36.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix",
|
||||||
|
"artifactId": "wpiapi-java",
|
||||||
|
"version": "5.36.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"jniDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix",
|
||||||
|
"artifactId": "cci",
|
||||||
|
"version": "5.36.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxathena"
|
||||||
|
],
|
||||||
|
"simMode": "hwsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix.sim",
|
||||||
|
"artifactId": "cci-sim",
|
||||||
|
"version": "5.36.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cppDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix",
|
||||||
|
"artifactId": "wpiapi-cpp",
|
||||||
|
"version": "5.36.0",
|
||||||
|
"libName": "CTRE_Phoenix_WPI",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxathena"
|
||||||
|
],
|
||||||
|
"simMode": "hwsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix",
|
||||||
|
"artifactId": "api-cpp",
|
||||||
|
"version": "5.36.0",
|
||||||
|
"libName": "CTRE_Phoenix",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxathena"
|
||||||
|
],
|
||||||
|
"simMode": "hwsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix",
|
||||||
|
"artifactId": "cci",
|
||||||
|
"version": "5.36.0",
|
||||||
|
"libName": "CTRE_PhoenixCCI",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxathena"
|
||||||
|
],
|
||||||
|
"simMode": "hwsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix.sim",
|
||||||
|
"artifactId": "wpiapi-cpp-sim",
|
||||||
|
"version": "5.36.0",
|
||||||
|
"libName": "CTRE_Phoenix_WPISim",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix.sim",
|
||||||
|
"artifactId": "api-cpp-sim",
|
||||||
|
"version": "5.36.0",
|
||||||
|
"libName": "CTRE_PhoenixSim",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix.sim",
|
||||||
|
"artifactId": "cci-sim",
|
||||||
|
"version": "5.36.0",
|
||||||
|
"libName": "CTRE_PhoenixCCISim",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
449
vendordeps/Phoenix6-26.1.0.json
Normal file
449
vendordeps/Phoenix6-26.1.0.json
Normal file
@@ -0,0 +1,449 @@
|
|||||||
|
{
|
||||||
|
"fileName": "Phoenix6-26.1.0.json",
|
||||||
|
"name": "CTRE-Phoenix (v6)",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"frcYear": "2026",
|
||||||
|
"uuid": "e995de00-2c64-4df5-8831-c1441420ff19",
|
||||||
|
"mavenUrls": [
|
||||||
|
"https://maven.ctr-electronics.com/release/"
|
||||||
|
],
|
||||||
|
"jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2026-latest.json",
|
||||||
|
"conflictsWith": [
|
||||||
|
{
|
||||||
|
"uuid": "e7900d8d-826f-4dca-a1ff-182f658e98af",
|
||||||
|
"errorMessage": "Users can not have both the replay and regular Phoenix 6 vendordeps in their robot program.",
|
||||||
|
"offlineFileName": "Phoenix6-replay-frc2026-latest.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"javaDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6",
|
||||||
|
"artifactId": "wpiapi-java",
|
||||||
|
"version": "26.1.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"jniDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6",
|
||||||
|
"artifactId": "api-cpp",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxathena"
|
||||||
|
],
|
||||||
|
"simMode": "hwsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6",
|
||||||
|
"artifactId": "tools",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxathena"
|
||||||
|
],
|
||||||
|
"simMode": "hwsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "api-cpp-sim",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "tools-sim",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simTalonSRX",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simVictorSPX",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simPigeonIMU",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProTalonFX",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProTalonFXS",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProCANcoder",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProPigeon2",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProCANrange",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProCANdi",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProCANdle",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"isJar": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cppDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6",
|
||||||
|
"artifactId": "wpiapi-cpp",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_Phoenix6_WPI",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxathena"
|
||||||
|
],
|
||||||
|
"simMode": "hwsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6",
|
||||||
|
"artifactId": "tools",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_PhoenixTools",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxathena"
|
||||||
|
],
|
||||||
|
"simMode": "hwsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "wpiapi-cpp-sim",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_Phoenix6_WPISim",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "tools-sim",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_PhoenixTools_Sim",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simTalonSRX",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_SimTalonSRX",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simVictorSPX",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_SimVictorSPX",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simPigeonIMU",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_SimPigeonIMU",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProTalonFX",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_SimProTalonFX",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProTalonFXS",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_SimProTalonFXS",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProCANcoder",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_SimProCANcoder",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProPigeon2",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_SimProPigeon2",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProCANrange",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_SimProCANrange",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProCANdi",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_SimProCANdi",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.ctre.phoenix6.sim",
|
||||||
|
"artifactId": "simProCANdle",
|
||||||
|
"version": "26.1.0",
|
||||||
|
"libName": "CTRE_SimProCANdle",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"osxuniversal"
|
||||||
|
],
|
||||||
|
"simMode": "swsim"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
133
vendordeps/REVLib.json
Normal file
133
vendordeps/REVLib.json
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
{
|
||||||
|
"fileName": "REVLib.json",
|
||||||
|
"name": "REVLib",
|
||||||
|
"version": "2026.0.0",
|
||||||
|
"frcYear": "2026",
|
||||||
|
"uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb",
|
||||||
|
"mavenUrls": [
|
||||||
|
"https://maven.revrobotics.com/"
|
||||||
|
],
|
||||||
|
"jsonUrl": "https://software-metadata.revrobotics.com/REVLib-2026.json",
|
||||||
|
"javaDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.revrobotics.frc",
|
||||||
|
"artifactId": "REVLib-java",
|
||||||
|
"version": "2026.0.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"jniDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.revrobotics.frc",
|
||||||
|
"artifactId": "REVLib-driver",
|
||||||
|
"version": "2026.0.0",
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"isJar": false,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.revrobotics.frc",
|
||||||
|
"artifactId": "RevLibBackendDriver",
|
||||||
|
"version": "2026.0.0",
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"isJar": false,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.revrobotics.frc",
|
||||||
|
"artifactId": "RevLibWpiBackendDriver",
|
||||||
|
"version": "2026.0.0",
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"isJar": false,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cppDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.revrobotics.frc",
|
||||||
|
"artifactId": "REVLib-cpp",
|
||||||
|
"version": "2026.0.0",
|
||||||
|
"libName": "REVLib",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.revrobotics.frc",
|
||||||
|
"artifactId": "REVLib-driver",
|
||||||
|
"version": "2026.0.0",
|
||||||
|
"libName": "REVLibDriver",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.revrobotics.frc",
|
||||||
|
"artifactId": "RevLibBackendDriver",
|
||||||
|
"version": "2026.0.0",
|
||||||
|
"libName": "BackendDriver",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.revrobotics.frc",
|
||||||
|
"artifactId": "RevLibWpiBackendDriver",
|
||||||
|
"version": "2026.0.0",
|
||||||
|
"libName": "REVLibWpi",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
71
vendordeps/Studica.json
Normal file
71
vendordeps/Studica.json
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
"fileName": "Studica.json",
|
||||||
|
"name": "Studica",
|
||||||
|
"version": "2026.0.0",
|
||||||
|
"frcYear": "2026",
|
||||||
|
"uuid": "cb311d09-36e9-4143-a032-55bb2b94443b",
|
||||||
|
"mavenUrls": [
|
||||||
|
"https://dev.studica.com/maven/release/2026/"
|
||||||
|
],
|
||||||
|
"jsonUrl": "https://dev.studica.com/maven/release/2026/json/Studica-2026.0.0.json",
|
||||||
|
"javaDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.studica.frc",
|
||||||
|
"artifactId": "Studica-java",
|
||||||
|
"version": "2026.0.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"jniDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.studica.frc",
|
||||||
|
"artifactId": "Studica-driver",
|
||||||
|
"version": "2026.0.0",
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"isJar": false,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cppDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "com.studica.frc",
|
||||||
|
"artifactId": "Studica-cpp",
|
||||||
|
"version": "2026.0.0",
|
||||||
|
"libName": "Studica",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "com.studica.frc",
|
||||||
|
"artifactId": "Studica-driver",
|
||||||
|
"version": "2026.0.0",
|
||||||
|
"libName": "StudicaDriver",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": false,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxarm64",
|
||||||
|
"linuxx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxarm32",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
71
vendordeps/photonlib.json
Normal file
71
vendordeps/photonlib.json
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
"fileName": "photonlib.json",
|
||||||
|
"name": "photonlib",
|
||||||
|
"version": "v2026.0.1-beta",
|
||||||
|
"uuid": "515fe07e-bfc6-11fa-b3de-0242ac130004",
|
||||||
|
"frcYear": "2026",
|
||||||
|
"mavenUrls": [
|
||||||
|
"https://maven.photonvision.org/repository/internal",
|
||||||
|
"https://maven.photonvision.org/repository/snapshots"
|
||||||
|
],
|
||||||
|
"jsonUrl": "https://maven.photonvision.org/repository/internal/org/photonvision/photonlib-json/1.0/photonlib-json-1.0.json",
|
||||||
|
"jniDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "org.photonvision",
|
||||||
|
"artifactId": "photontargeting-cpp",
|
||||||
|
"version": "v2026.0.1-beta",
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"isJar": false,
|
||||||
|
"validPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxx86-64",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cppDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "org.photonvision",
|
||||||
|
"artifactId": "photonlib-cpp",
|
||||||
|
"version": "v2026.0.1-beta",
|
||||||
|
"libName": "photonlib",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxx86-64",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "org.photonvision",
|
||||||
|
"artifactId": "photontargeting-cpp",
|
||||||
|
"version": "v2026.0.1-beta",
|
||||||
|
"libName": "photontargeting",
|
||||||
|
"headerClassifier": "headers",
|
||||||
|
"sharedLibrary": true,
|
||||||
|
"skipInvalidPlatforms": true,
|
||||||
|
"binaryPlatforms": [
|
||||||
|
"windowsx86-64",
|
||||||
|
"linuxathena",
|
||||||
|
"linuxx86-64",
|
||||||
|
"osxuniversal"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"javaDependencies": [
|
||||||
|
{
|
||||||
|
"groupId": "org.photonvision",
|
||||||
|
"artifactId": "photonlib-java",
|
||||||
|
"version": "v2026.0.1-beta"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"groupId": "org.photonvision",
|
||||||
|
"artifactId": "photontargeting-java",
|
||||||
|
"version": "v2026.0.1-beta"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user