mirror of
https://github.com/Team4388/Robot-Essentials.git
synced 2026-06-09 00:38:01 -06:00
Update to 2025, Add names for StatusCodes, and fix error error
This commit is contained in:
@@ -199,7 +199,7 @@ public class Robot extends TimedRobot {
|
||||
// Errors header
|
||||
System.out.println(new String(Base64.getDecoder().decode("4paX4paE4paE4paE4paW4paX4paE4paE4paWIOKWl+KWhOKWhOKWliAg4paX4paE4paWIOKWl+KWhOKWhOKWliAg4paX4paE4paE4paWCuKWkOKWjCAgIOKWkOKWjCDilpDilozilpDilowg4paQ4paM4paQ4paMIOKWkOKWjOKWkOKWjCDilpDilozilpDilowgICAK4paQ4pab4paA4paA4paY4paQ4pab4paA4paa4paW4paQ4pab4paA4paa4paW4paQ4paMIOKWkOKWjOKWkOKWm+KWgOKWmuKWliDilp3iloDilprilpYK4paQ4paZ4paE4paE4paW4paQ4paMIOKWkOKWjOKWkOKWjCDilpDilozilp3ilpriloTilp7ilpjilpDilowg4paQ4paM4paX4paE4paE4pae4paY")));
|
||||
for(int i=0;i<errors.size(); i++){
|
||||
System.out.println(errors.get(0));
|
||||
System.out.println(errors.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ public class SwerveModule extends Subsystem {
|
||||
public Rotation2d getAngle() {
|
||||
// * Note: This assumes that the CANCoders are setup with the default feedback coefficient and the sensor value reports degrees.
|
||||
// return Rotation2d.fromDegrees(encoder.getAbsolutePosition());
|
||||
return Rotation2d.fromRotations(encoder.getPosition().getValue());
|
||||
return Rotation2d.fromRotations(encoder.getPosition().getValue().baseUnitMagnitude());
|
||||
}
|
||||
|
||||
public double getAngularVel() {
|
||||
@@ -193,8 +193,8 @@ public class SwerveModule extends Subsystem {
|
||||
*/
|
||||
public SwerveModuleState getState() {
|
||||
return new SwerveModuleState(
|
||||
Units.inchesToMeters(driveMotor.getVelocity().getValue() *
|
||||
SwerveDriveConstants.Conversions.INCHES_PER_WHEEL_REV *
|
||||
Units.inchesToMeters(driveMotor.getVelocity().getValue().baseUnitMagnitude() *
|
||||
SwerveDriveConstants.Conversions.INCHES_PER_WHEEL_REV *
|
||||
SwerveDriveConstants.Conversions.WHEEL_REV_PER_MOTOR_REV),
|
||||
getAngle()
|
||||
);
|
||||
|
||||
@@ -39,6 +39,10 @@ public class Status {
|
||||
this.reports.add(r);
|
||||
}
|
||||
|
||||
private String printStatusCode(StatusCode status){
|
||||
return status.getName() + " (" + status.value + ")";
|
||||
}
|
||||
|
||||
public void diagnoseHardwareCTRE(String deviceName, TalonFX motor) {
|
||||
if (motor.isAlive()) addReport(ReportLevel.INFO, deviceName + " Motor (TalonFX) Alive?: Alive.");
|
||||
else addReport(ReportLevel.ERROR, deviceName + " Motor (TalonFX) Alive?: Dead!");
|
||||
@@ -49,8 +53,10 @@ public class Status {
|
||||
// If its not zero, that means that most likely that it had some communication error, I.e. It actually is powered off or not connected at all.
|
||||
// TODO: validate that a CANCoder can actually do `EmptyControl`s
|
||||
StatusCode status = coder.setControl(new EmptyControl());
|
||||
if (status.value == 0) addReport(ReportLevel.INFO, deviceName + " Cancoder Alive?: Alive.");
|
||||
else addReport(ReportLevel.ERROR, deviceName + " Cancoder Alive?: Dead!");
|
||||
if (status.value == 0) addReport(ReportLevel.INFO, deviceName + " Cancoder Alive?: Alive. " + printStatusCode(status));
|
||||
else addReport(ReportLevel.ERROR, deviceName + " Cancoder Alive?: Dead! " + printStatusCode(status));
|
||||
|
||||
|
||||
|
||||
// StatusSignal<MagnetHealthValue> -> MagnetHealthValue -> int
|
||||
int coderMagHealth = coder.getMagnetHealth().getValue().value;
|
||||
@@ -65,8 +71,8 @@ public class Status {
|
||||
// If its not zero, that means that most likely that it had some communication error, I.e. It actually is powered off or not connected at all.
|
||||
// TODO: validate that a Pigeon2 can actually do `EmptyControl`s
|
||||
StatusCode status = pigeon.setControl(new EmptyControl());
|
||||
if (status.value == 0) addReport(ReportLevel.INFO, deviceName + " Pigeon2 Alive?: Alive.");
|
||||
else addReport(ReportLevel.ERROR, deviceName + " Pigeon2 Alive?: Dead!");
|
||||
if (status.value == 0) addReport(ReportLevel.INFO, deviceName + " Pigeon2 Alive?: Alive. " + printStatusCode(status));
|
||||
else addReport(ReportLevel.ERROR, deviceName + " Pigeon2 Alive?: Dead! " + printStatusCode(status));
|
||||
}
|
||||
|
||||
public boolean hasReport() {
|
||||
|
||||
Reference in New Issue
Block a user