mirror of
https://github.com/BroncBotz3481/YAGSL
synced 2026-06-27 07:01:39 +00:00
Upgrading to 2025.1.0
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package swervelib.parser.json.modules;
|
||||
|
||||
import swervelib.math.SwerveMath;
|
||||
import swervelib.telemetry.Alert;
|
||||
import swervelib.telemetry.Alert.AlertType;
|
||||
|
||||
/**
|
||||
* Angle motor conversion factors composite JSON parse class.
|
||||
@@ -13,11 +11,11 @@ public class AngleConversionFactorsJson
|
||||
/**
|
||||
* Gear ratio for the angle/steering/azimuth motor on the Swerve Module. Motor rotations to 1 wheel rotation.
|
||||
*/
|
||||
public double gearRatio = 0;
|
||||
public double gearRatio;
|
||||
/**
|
||||
* Calculated or given conversion factor.
|
||||
*/
|
||||
public double factor = 0;
|
||||
public double factor = 0;
|
||||
|
||||
/**
|
||||
* Calculate the drive conversion factor.
|
||||
@@ -26,12 +24,6 @@ public class AngleConversionFactorsJson
|
||||
*/
|
||||
public double calculate()
|
||||
{
|
||||
if (factor != 0 && gearRatio != 0)
|
||||
{
|
||||
new Alert("Configuration",
|
||||
"The given angle conversion factor takes precedence over the composite conversion factor, please remove 'factor' if you want to use the composite factor instead.",
|
||||
AlertType.WARNING).set(true);
|
||||
}
|
||||
if (factor == 0)
|
||||
{
|
||||
factor = SwerveMath.calculateDegreesPerSteeringRotation(gearRatio);
|
||||
|
||||
@@ -22,7 +22,8 @@ public class ConversionFactorsJson
|
||||
*/
|
||||
public boolean isDriveEmpty()
|
||||
{
|
||||
return drive.factor == 0 && drive.diameter == 0 && drive.gearRatio == 0;
|
||||
drive.calculate();
|
||||
return drive.factor == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,6 +33,18 @@ public class ConversionFactorsJson
|
||||
*/
|
||||
public boolean isAngleEmpty()
|
||||
{
|
||||
return angle.factor == 0 && angle.gearRatio == 0;
|
||||
angle.calculate();
|
||||
return angle.factor == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the conversion factor can be found.
|
||||
*
|
||||
* @return If the conversion factors can be found.
|
||||
*/
|
||||
public boolean works()
|
||||
{
|
||||
return (angle.factor != 0 && drive.factor != 0) ||
|
||||
((drive.gearRatio != 0 && drive.diameter != 0)) && (angle.gearRatio != 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package swervelib.parser.json.modules;
|
||||
|
||||
import edu.wpi.first.math.util.Units;
|
||||
import swervelib.math.SwerveMath;
|
||||
import swervelib.telemetry.Alert;
|
||||
import swervelib.telemetry.Alert.AlertType;
|
||||
|
||||
/**
|
||||
* Drive motor composite JSON parse class.
|
||||
@@ -14,15 +12,15 @@ public class DriveConversionFactorsJson
|
||||
/**
|
||||
* Gear ratio for the drive motor rotations to turn the wheel 1 complete rotation.
|
||||
*/
|
||||
public double gearRatio = 0;
|
||||
public double gearRatio;
|
||||
/**
|
||||
* Diameter of the wheel in inches.
|
||||
*/
|
||||
public double diameter = 0;
|
||||
public double diameter;
|
||||
/**
|
||||
* Calculated conversion factor.
|
||||
*/
|
||||
public double factor = 0;
|
||||
public double factor = 0;
|
||||
|
||||
/**
|
||||
* Calculate the drive conversion factor.
|
||||
@@ -31,12 +29,6 @@ public class DriveConversionFactorsJson
|
||||
*/
|
||||
public double calculate()
|
||||
{
|
||||
if (factor != 0 && (diameter != 0 || gearRatio != 0))
|
||||
{
|
||||
new Alert("Configuration",
|
||||
"The given drive conversion factor takes precedence over the composite conversion factor, please remove 'factor' if you want to use the composite factor instead.",
|
||||
AlertType.WARNING).set(true);
|
||||
}
|
||||
if (factor == 0)
|
||||
{
|
||||
factor = SwerveMath.calculateMetersPerRotation(Units.inchesToMeters(this.diameter), this.gearRatio);
|
||||
|
||||
Reference in New Issue
Block a user