Files
YAGSL/swervelib/parser/json/PhysicalPropertiesJson.java

53 lines
1.8 KiB
Java
Raw Normal View History

2023-02-13 17:21:24 -06:00
package swervelib.parser.json;
2023-02-13 14:37:05 -06:00
2023-02-13 17:21:24 -06:00
import swervelib.parser.SwerveModulePhysicalCharacteristics;
2023-02-13 14:37:05 -06:00
/**
2023-02-13 17:21:24 -06:00
* {@link swervelib.parser.SwerveModulePhysicalCharacteristics} parsed data. Used to configure the SwerveModule.
2023-02-13 14:37:05 -06:00
*/
public class PhysicalPropertiesJson
{
2023-11-09 17:32:48 -06:00
2023-02-13 14:37:05 -06:00
/**
2023-11-09 17:32:48 -06:00
* Conversion factor applied to the motor controllers PID loops. Can be calculated with
* {@link swervelib.math.SwerveMath#calculateDegreesPerSteeringRotation(double, double)} for angle motors or
* {@link swervelib.math.SwerveMath#calculateMetersPerRotation(double, double, double)} for drive motors.
2023-02-13 14:37:05 -06:00
*/
public MotorConfigDouble conversionFactor = new MotorConfigDouble(0, 0);
2023-02-13 14:37:05 -06:00
/**
* The current limit in AMPs to apply to the motors.
*/
public MotorConfigInt currentLimit = new MotorConfigInt(40, 20);
/**
* The minimum number of seconds to take for the motor to go from 0 to full throttle.
*/
public MotorConfigDouble rampRate = new MotorConfigDouble(0.25, 0.25);
/**
* The grip tape coefficient of friction on carpet. Used to calculate the practical maximum acceleration.
*/
public double wheelGripCoefficientOfFriction = 1.19;
/**
2023-11-09 17:32:48 -06:00
* The voltage to use for the smart motor voltage compensation, default is 12.
*/
2023-11-09 17:32:48 -06:00
public double optimalVoltage = 12;
2023-02-13 14:37:05 -06:00
/**
* Create the physical characteristics based off the parsed data.
*
* @return {@link SwerveModulePhysicalCharacteristics} based on parsed data.
*/
2023-11-09 17:32:48 -06:00
public SwerveModulePhysicalCharacteristics createPhysicalProperties()
2023-02-13 14:37:05 -06:00
{
return new SwerveModulePhysicalCharacteristics(
2023-11-09 17:32:48 -06:00
conversionFactor,
wheelGripCoefficientOfFriction,
optimalVoltage,
currentLimit.drive,
currentLimit.angle,
rampRate.drive,
2023-11-09 17:32:48 -06:00
rampRate.angle);
2023-02-13 14:37:05 -06:00
}
}