annotationProcessor wpi.java.deps.wpilibAnnotations()
implementation wpi.java.deps.wpilib()
implementation wpi.java.vendor.java()
+ implementation "com.fasterxml.jackson.core:jackson-databind:2.17.2"
systemcoreDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.systemcore)
systemcoreDebug wpi.java.vendor.jniDebug(wpi.platforms.systemcore)
import org.littletonrobotics.junction.networktables.NT4Publisher;
import org.littletonrobotics.junction.wpilog.WPILOGReader;
import org.littletonrobotics.junction.wpilog.WPILOGWriter;
-
-import au.grapplerobotics.CanBridge;
+// TODO: 2027-ALPHA-FIX - Re-enable grapplerobotics dep when updated
+// import au.grapplerobotics.CanBridge;
import org.wpilib.net.PortForwarder;
import org.wpilib.driverstation.DriverStation;
-import org.wpilib.driverstation.DriverStation.Alliance;
+import org.wpilib.driverstation.Alliance;
import org.wpilib.system.RobotController;
import org.wpilib.command2.Command;
import org.wpilib.command2.CommandScheduler;
private RobotContainer robotContainer;
public Robot() {
- CanBridge.runTCP();
+ // CanBridge.runTCP();
PortForwarder.add(5800, Constants.VISION_CAMERA_HOST, 5800);
PortForwarder.add(1182, Constants.VISION_CAMERA_HOST, 1182);
public static Alliance getAlliance() {
Optional<Alliance> dsAlliance = DriverStation.getAlliance();
if (dsAlliance.isPresent()) return dsAlliance.get();
- else return Alliance.Red; // default to Red alliance
+ else return Alliance.RED; // default to RED alliance
}
}
import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.auto.AutoBuilderException;
import com.pathplanner.lib.commands.PathPlannerAuto;
-
-import choreo.auto.AutoChooser;
-import choreo.auto.AutoFactory;
-import choreo.auto.AutoRoutine;
+// TODO: 2027-ALPHA-FIX - Re-enable Choreo when updated
+// import choreo.auto.AutoChooser;
+// import choreo.auto.AutoFactory;
+// import choreo.auto.AutoRoutine;
import org.wpilib.math.geometry.Pose3d;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.system.RobotController;
import org.wpilib.command2.CommandScheduler;
import frc.robot.commands.DoNothing;
import frc.robot.commands.LogCommand;
-import frc.robot.commands.auto_comm.ChoreoPathCommandBuilder;
+// import frc.robot.commands.auto_comm.ChoreoPathCommandBuilder;
import frc.robot.commands.auto_comm.DynamicAutoBuilder;
import frc.robot.commands.drive_comm.SysIDDriveCommand;
import frc.robot.constants.AutoConstants;
String rightDynamicConservativeDoubleSwipe = "RightDynamicDoubleConservativeSwipe";
// String leftDynamicShallowDoubleSwipe = "LeftDynamicShallowDoubleSwipe";
// String rightDynamicShallowDoubleSwipe = "RightDynamicShallowDoubleSwipe";
-
- ChoreoPathCommandBuilder choreo = new ChoreoPathCommandBuilder();
+ // TODO: 2027-ALPHA-FIX - Re-enable Choreo vendordep when JSON is updated
+ // ChoreoPathCommandBuilder choreo = new ChoreoPathCommandBuilder();
// addAuto("testChoreo", ChoreoPathCommandBuilder.basicTrajectoryAuto("test.traj", true,
// autoFactory));
// put the Chooser on the SmartDashboard
SmartDashboard.putData("Auto chooser", autoChooser);
- SmartDashboard.putData("Choreo auto chooser", choreoAutoChooser);
+ // SmartDashboard.putData("Choreo auto chooser", choreoAutoChooser);
}
public static BooleanSupplier getAllianceColorBooleanSupplier() {
var alliance = DriverStation.getAlliance();
if (alliance.isPresent()) {
- return alliance.get() == DriverStation.Alliance.Red;
+ return alliance.get() == DriverStation.Alliance.RED;
}
return false;
};
-// TODO: 2027-ALPHA-FIX - Re-enable Choreo vendordep when JSON is updated
+// TODO: 2027-ALPHA-FIX - Re-enable Choreo dep when updated
// package frc.robot.commands.auto_comm;
// import choreo.auto.AutoFactory;
package frc.robot.commands.auto_comm;
-import org.wpilib.command2.*;
public class DynamicAutoBuilder {
import org.wpilib.math.controller.PIDController;
import org.wpilib.math.kinematics.ChassisVelocities;
-import org.wpilib.driverstation.DriverStation.Alliance;
+import org.wpilib.driverstation.Alliance;
import org.wpilib.smartdashboard.SmartDashboard;
import org.wpilib.command2.Command;
import frc.robot.Robot;
sideTranslation *= slowFactor;
rotation *= driver.getIsSlowMode() ? DriveConstants.SLOW_ROT_FACTOR : 1;
- int allianceReversal = Robot.getAlliance() == Alliance.Red ? 1 : -1;
+ int allianceReversal = Robot.getAlliance() == Alliance.RED ? 1 : -1;
forwardTranslation *= allianceReversal;
sideTranslation *= allianceReversal;
import com.pathplanner.lib.path.PathConstraints;
import org.wpilib.math.geometry.Pose2d;
-import org.wpilib.driverstation.DriverStation;
+import org.wpilib.driverstation.DriverStationErrors;
import org.wpilib.command2.Command;
import org.wpilib.command2.InstantCommand;
import org.wpilib.command2.SequentialCommandGroup;
// makes weird paths.
if (dist > 3) {
command = new DoNothing();
- DriverStation.reportWarning("Alignment Path too long, doing nothing, GoToPose.java", false);
+ DriverStationErrors.reportWarning("Alignment Path too long, doing nothing, GoToPose.java", false);
} else if (dist < 0.02) {
command = new DoNothing();
- DriverStation.reportWarning("Alignment Path too short, doing nothing, GoToPose.java", false);
+ DriverStationErrors.reportWarning("Alignment Path too short, doing nothing, GoToPose.java", false);
}
return command;
import org.wpilib.math.geometry.Rotation2d;
import org.wpilib.math.kinematics.SwerveModuleVelocity;
-import org.wpilib.math.kinematics.SwerveModuleVelocity;
import org.wpilib.math.util.Units;
import org.wpilib.command2.InstantCommand;
import org.wpilib.command2.RunCommand;
Pose2d initialPose = trajectory.getInitialPose();
State sample = trajectory.sample(time);
- Pose2d nextPose = sample.poseMeters;
+ Pose2d nextPose = sample.pose;
double xVelocity = sample.velocity * nextPose.getRotation().getCos();
double yVelocity = sample.velocity * nextPose.getRotation().getSin();
ChassisVelocities.fromFieldRelativeSpeeds(chassisSpeeds, initialPose.getRotation());
SwerveModuleVelocity[] SwerveModuleVelocitys =
- DriveConstants.KINEMATICS.toSwerveModuleVelocitys(chassisSpeeds);
+ DriveConstants.KINEMATICS.toSwerveModuleVelocities(chassisSpeeds);
for (SwerveModuleVelocity SwerveModuleVelocity : SwerveModuleVelocitys) {
SwerveModuleVelocity.speedMetersPerSecond = 0;
}
import com.pathplanner.lib.config.RobotConfig;
import com.pathplanner.lib.controllers.PPHolonomicDriveController;
-import org.wpilib.math.system.plant.DCMotor;
+import org.wpilib.math.system.DCMotor;
import frc.robot.constants.swerve.DriveConstants;
/** Container class for auto constants. */
import java.util.function.BooleanSupplier;
import org.wpilib.math.geometry.Rotation2d;
-import org.wpilib.driverstation.DriverStation.Alliance;
+import org.wpilib.driverstation.Alliance;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.command2.InstantCommand;
import frc.robot.Robot;
() ->
super.getDrivetrain()
.setYaw(
- new Rotation2d(Robot.getAlliance() == Alliance.Blue ? 0 : Math.PI))));
+ new Rotation2d(Robot.getAlliance() == Alliance.BLUE ? 0 : Math.PI))));
// Cancel commands
driver
import java.util.function.BooleanSupplier;
import org.wpilib.math.geometry.Rotation2d;
-import org.wpilib.driverstation.DriverStation.Alliance;
+import org.wpilib.driverstation.Alliance;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.command2.InstantCommand;
import frc.robot.Robot;
() ->
getDrivetrain()
.setYaw(
- new Rotation2d(Robot.getAlliance() == Alliance.Blue ? 0 : Math.PI))));
+ new Rotation2d(Robot.getAlliance() == Alliance.BLUE ? 0 : Math.PI))));
// Cancel commands
controller
import java.util.function.BooleanSupplier;
import org.wpilib.math.geometry.Rotation2d;
-import org.wpilib.driverstation.DriverStation.Alliance;
+import org.wpilib.driverstation.Alliance;
import org.wpilib.command2.Command;
import org.wpilib.command2.CommandScheduler;
import org.wpilib.command2.FunctionalCommand;
() ->
getDrivetrain()
.setYaw(
- new Rotation2d(Robot.getAlliance() == Alliance.Blue ? 0 : Math.PI))));
+ new Rotation2d(Robot.getAlliance() == Alliance.BLUE ? 0 : Math.PI))));
// Cancel commands
controller
import com.ctre.phoenix6.signals.VBatOutputModeValue;
import org.wpilib.driverstation.DriverStation;
-import org.wpilib.driverstation.DriverStation.Alliance;
+import org.wpilib.driverstation.Alliance;
import org.wpilib.util.Color;
import org.wpilib.command2.SubsystemBase;
import frc.robot.constants.Constants;
var alliance = DriverStation.getAlliance();
if (alliance.isEmpty()) {
color = Color.kOrangeRed;
- } else if (alliance.get() == Alliance.Red) {
+ } else if (alliance.get() == Alliance.RED) {
color = Color.kRed;
- } else if (alliance.get() == Alliance.Blue) {
+ } else if (alliance.get() == Alliance.BLUE) {
color = Color.kBlue;
} else {
color = Color.kOrangeRed;
import frc.robot.constants.VisionConstants;
import frc.robot.constants.swerve.DriveConstants;
import frc.robot.constants.swerve.ModuleConstants;
+import frc.robot.subsystems.drivetrain.GyroIO.GyroIOInputs;
import frc.robot.util.EqualsUtil;
import frc.robot.util.PhoenixOdometryThread;
import frc.robot.util.SwerveModulePose;
*/
public void setModuleStates(SwerveModuleVelocity[] SwerveModuleVelocitys, boolean isOpenLoop) {
// makes sure speeds of modules don't exceed maximum allowed
- SwerveDriveKinematics.desaturateWheelSpeeds(SwerveModuleVelocitys, DriveConstants.MAX_SPEED);
+ SwerveDriveKinematics.desaturateWheelVelocities(SwerveModuleVelocitys, DriveConstants.MAX_SPEED);
for (int i = 0; i < 4; i++) {
modules[i].setDesiredState(SwerveModuleVelocitys[i], isOpenLoop);
import org.wpilib.units.measure.AngularVelocity;
import org.wpilib.units.measure.Current;
import org.wpilib.units.measure.Voltage;
-import org.wpilib.util.Alert;
-import org.wpilib.util.Alert.AlertType;
+import org.wpilib.driverstation.Alert;
+import org.wpilib.driverstation.Alert.AlertType;
import frc.robot.constants.swerve.DriveConstants;
import frc.robot.constants.swerve.ModuleConstants;
import frc.robot.constants.swerve.ModuleType;
private final Alert turnDisconnectedAlert;
private final Alert turnEncoderDisconnectedAlert;
- protected final ModuleIOInputsAutoLogged inputs = new ModuleIOInputsAutoLogged();
private ModuleConstants moduleConstants;
private final MotionMagicVelocityVoltage velocityRequest =
import org.wpilib.math.numbers.N1;
import org.wpilib.math.numbers.N2;
import org.wpilib.math.system.NumericalIntegration;
-import org.wpilib.math.system.plant.DCMotor;
+import org.wpilib.math.system..DCMotor;
import org.wpilib.simulation.ElevatorSim;
/** Exactly the same as ElevatorSim, except it can be angled and have a constant force spring */
import org.wpilib.math.numbers.N2;
import org.wpilib.math.system.LinearSystem;
import org.wpilib.math.system.NumericalIntegration;
-import org.wpilib.math.system.plant.DCMotor;
-import org.wpilib.math.system.plant.LinearSystemId;
+import org.wpilib.math.system.DCMotor;
+import org.wpilib.math.system.Models;
import org.wpilib.simulation.SingleJointedArmSim;
/**
* Creates a simulated arm mechanism.
*
* @param plant The linear system that represents the arm. This system can be created with {@link
- * org.wpilib.math.system.plant.LinearSystemId#createSingleJointedArmSystem(DCMotor,
- * double, double)}.
+ * org.wpilib.math.system.Models#singleJointedArmFromPhysicalConstants(DCMotor, double, double)}.
* @param gearbox The type of and number of motors in the arm gearbox.
* @param gearing The gearing of the arm (numbers greater than 1 represent reductions).
* @param armLengthMeters The length of the arm.
double robotMassKilograms,
double... measurementStdDevs) {
this(
- LinearSystemId.createSingleJointedArmSystem(gearbox, jKgMetersSquared, gearing),
+ Models.singleJointedArmFromPhysicalConstants(gearbox, jKgMetersSquared, gearing),
gearbox,
gearing,
armLengthMeters,
import org.wpilib.math.geometry.Pose2d;
import org.wpilib.math.geometry.Rotation2d;
-import org.wpilib.driverstation.DriverStation.Alliance;
+import org.wpilib.driverstation.Alliance;
import frc.robot.constants.FieldConstants;
public class ConversionUtils {
* @return converted pose
*/
public static Pose2d absolutePoseToPathPlannerPose(Pose2d pose, Alliance alliance) {
- if (alliance == Alliance.Red) {
+ if (alliance == Alliance.RED) {
return pose.relativeTo(
new Pose2d(
FieldConstants.field.getFieldLength(),
import org.wpilib.networktables.StringTopic;
public final class Elastic {
+ PubSubOption optionTrue = PubSubOption.SEND_ALL;
+ PubSubOption optionFalse = PubSubOption.SEND_CHANGES;
+ PubSubOption keepDuplicates = PubSubOption.KEEP_DUPLICATES;
+
private static final StringTopic notificationTopic =
NetworkTableInstance.getDefault().getStringTopic("/Elastic/RobotNotifications");
private static final StringPublisher notificationPublisher =
- notificationTopic.publish(PubSubOption.sendAll(true), PubSubOption.keepDuplicates(true));
+ notificationTopic.publish(PubSubOption.SEND_ALL, PubSubOption.KEEP_DUPLICATES);
private static final StringTopic selectedTabTopic =
NetworkTableInstance.getDefault().getStringTopic("/Elastic/SelectedTab");
private static final StringPublisher selectedTabPublisher =
- selectedTabTopic.publish(PubSubOption.keepDuplicates(true));
+ selectedTabTopic.publish(PubSubOption.KEEP_DUPLICATES);
private static final ObjectMapper objectMapper = new ObjectMapper();
/**
package frc.robot.util;
-import org.wpilib.driverstation.DriverStation;
+import org.wpilib.driverstation.DriverStationErrors;
import org.wpilib.system.Filesystem;
import frc.robot.constants.AutoConstants;
System.out.println(
"Processed file: " + file.getName() + ", took " + time + " milliseconds.");
} catch (Exception e) {
- DriverStation.reportError(e.getMessage(), true);
+ DriverStationErrors.reportError(e.getMessage(), true);
}
}
}
} else {
System.out.println("Error processing file");
- DriverStation.reportWarning("Issue with finding path files. Paths will not be loaded.", true);
+ DriverStationErrors.reportWarning("Issue with finding path files. Paths will not be loaded.", true);
}
System.out.println("File processing took a total of " + totalTime + " milliseconds");
}
double dt) {
final Translation2d[] modules = moduleLocations;
- SwerveModuleVelocity[] desiredModuleState = kinematics.toSwerveModuleVelocitys(desiredState);
+ SwerveModuleVelocity[] desiredModuleState = kinematics.toSwerveModuleVelocities(desiredState);
// Make sure desiredState respects velocity limits.
if (limits.maxDriveVelocity() > 0.0) {
- SwerveDriveKinematics.desaturateWheelSpeeds(desiredModuleState, limits.maxDriveVelocity());
+ SwerveDriveKinematics.desaturateWheelVelocities(desiredModuleState, dt)(desiredModuleState, limits.maxDriveVelocity());
desiredState = kinematics.toChassisVelocities(desiredModuleState);
}
prevSetpoint.chassisSpeeds().vx + min_s * dx,
prevSetpoint.chassisSpeeds().vy + min_s * dy,
prevSetpoint.chassisSpeeds().omega + min_s * dtheta);
- var retStates = kinematics.toSwerveModuleVelocitys(retSpeeds);
+ var retStates = kinematics.toSwerveModuleVelocities(retSpeeds);
for (int i = 0; i < modules.length; ++i) {
final var maybeOverride = overrideSteering.get(i);
if (maybeOverride.isPresent()) {
import org.wpilib.math.geometry.Translation3d;
import org.wpilib.math.kinematics.ChassisVelocities;
import org.wpilib.math.util.Units;
-import org.wpilib.driverstation.DriverStation.Alliance;
+import org.wpilib.driverstation.Alliance;
import frc.robot.Robot;
import frc.robot.subsystems.drivetrain.Drivetrain;
*/
public boolean isSameAllianceRobot() {
return type
- == (Robot.getAlliance() == Alliance.Red ? ObjectType.RED_ROBOT : ObjectType.BLUE_ROBOT);
+ == (Robot.getAlliance() == Alliance.RED ? ObjectType.RED_ROBOT : ObjectType.BLUE_ROBOT);
}
/**
*/
public boolean isOtherAllianceRobot() {
return type
- == (Robot.getAlliance() == Alliance.Red ? ObjectType.BLUE_ROBOT : ObjectType.RED_ROBOT);
+ == (Robot.getAlliance() == Alliance.RED ? ObjectType.BLUE_ROBOT : ObjectType.RED_ROBOT);
}
/**
import org.wpilib.networktables.NetworkTableEntry;
import org.wpilib.networktables.NetworkTableInstance;
import org.wpilib.driverstation.DriverStation;
+import org.wpilib.driverstation.DriverStationErrors;
import org.wpilib.framework.RobotBase;
import org.wpilib.system.Timer;
import frc.robot.constants.Constants;
try {
cameras.get(index).enable(enabled);
} catch (IndexOutOfBoundsException e) {
- DriverStation.reportWarning("Camera index " + index + " is out of bounds", false);
+ DriverStationErrors.reportWarning("Camera index " + index + " is out of bounds", false);
}
}