mirror of
https://github.com/BroncBotz3481/YAGSL
synced 2026-06-19 06:21:40 +00:00
Added simple conversion factor calculation
This commit is contained in:
@@ -35,6 +35,20 @@ public class SwerveMath
|
||||
return (Math.PI * wheelDiameter) / (driveGearRatio * pulsePerRotation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the meters per rotation for the integrated encoder. Calculation: (PI * WHEEL DIAMETER IN METERS) / (GEAR
|
||||
* RATIO)
|
||||
*
|
||||
* @param wheelDiameter Wheel diameter in meters.
|
||||
* @param driveGearRatio The gear ratio of the drive motor.
|
||||
* @return Meters per rotation for the drive motor.
|
||||
*/
|
||||
public static double calculateMetersPerRotation(
|
||||
double wheelDiameter, double driveGearRatio)
|
||||
{
|
||||
return calculateMetersPerRotation(wheelDiameter, driveGearRatio, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize an angle to be within 0 to 360.
|
||||
*
|
||||
@@ -98,6 +112,19 @@ public class SwerveMath
|
||||
return 360 / (angleGearRatio * pulsePerRotation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the degrees per steering rotation for the integrated encoder. Encoder conversion values. Drive converts
|
||||
* motor rotations to linear wheel distance and steering converts motor rotations to module azimuth.
|
||||
*
|
||||
* @param angleGearRatio The gear ratio of the steering motor.
|
||||
* @return Degrees per steering rotation for the angle motor.
|
||||
*/
|
||||
public static double calculateDegreesPerSteeringRotation(
|
||||
double angleGearRatio)
|
||||
{
|
||||
return calculateDegreesPerSteeringRotation(angleGearRatio, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the maximum angular velocity.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user