2024-07-29 15:14:25 -05:00
|
|
|
package swervelib.parser.json.modules;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Conversion Factors parsed JSON class
|
|
|
|
|
*/
|
|
|
|
|
public class ConversionFactorsJson
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Drive motor conversion factors composition.
|
|
|
|
|
*/
|
|
|
|
|
public DriveConversionFactorsJson drive = new DriveConversionFactorsJson();
|
|
|
|
|
/**
|
|
|
|
|
* Angle motor conversion factors composition.
|
|
|
|
|
*/
|
|
|
|
|
public AngleConversionFactorsJson angle = new AngleConversionFactorsJson();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if the conversion factors are set for the drive motor.
|
|
|
|
|
*
|
|
|
|
|
* @return Empty
|
|
|
|
|
*/
|
|
|
|
|
public boolean isDriveEmpty()
|
|
|
|
|
{
|
2024-12-09 23:26:04 +00:00
|
|
|
drive.calculate();
|
|
|
|
|
return drive.factor == 0;
|
2024-07-29 15:14:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if the conversion factors are set for the angle motor.
|
|
|
|
|
*
|
|
|
|
|
* @return Empty
|
|
|
|
|
*/
|
|
|
|
|
public boolean isAngleEmpty()
|
|
|
|
|
{
|
2024-12-09 23:26:04 +00:00
|
|
|
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);
|
2024-07-29 15:14:25 -05:00
|
|
|
}
|
|
|
|
|
}
|