+
edu.wpi.first.math.geometry.Translation2d
+
+
Swerve module location relative to the robot.
-
-
-
+
+
+
Physical characteristics of the swerve module.
-
-
-
+
+
+
PIDF configuration options for the drive motor closed-loop PID controller.
@@ -180,7 +185,7 @@ loadScripts(document, 'script');
Construct a configuration object for swerve modules.
-
SwerveModuleConfiguration(SwerveMotor driveMotor,
+SwerveModuleConfiguration(SwerveMotor driveMotor,
SwerveMotor angleMotor,
SwerveAbsoluteEncoder absoluteEncoder,
double angleOffset,
@@ -192,7 +197,9 @@ loadScripts(document, 'script');
SwerveModulePhysicalCharacteristics physicalCharacteristics,
boolean absoluteEncoderInverted,
boolean driveMotorInverted,
- boolean angleMotorInverted)
+ boolean angleMotorInverted,
+ double angleMotorEncoderPulsePerRevolution,
+ double angleMotorFreeSpeedRPM)
Construct a configuration object for swerve modules.
@@ -294,6 +301,13 @@ loadScripts(document, 'script');
+
+angleMotorEncoderPulsePerRevolution
+public double angleMotorEncoderPulsePerRevolution
+The integrated encoder pulse per revolution.
+
+
+
moduleLocation
public edu.wpi.first.math.geometry.Translation2d moduleLocation
@@ -337,7 +351,7 @@ loadScripts(document, 'script');
Constructor Details
-
-
+
SwerveModuleConfiguration
public SwerveModuleConfiguration(SwerveMotor driveMotor,
SwerveMotor angleMotor,
@@ -351,7 +365,9 @@ loadScripts(document, 'script');
SwerveModulePhysicalCharacteristics physicalCharacteristics,
boolean absoluteEncoderInverted,
boolean driveMotorInverted,
- boolean angleMotorInverted)
+ boolean angleMotorInverted,
+ double angleMotorEncoderPulsePerRevolution,
+ double angleMotorFreeSpeedRPM)
Construct a configuration object for swerve modules.
- Parameters:
@@ -368,6 +384,8 @@ loadScripts(document, 'script');
velocityPIDF - Velocity PIDF configuration.
maxSpeed - Maximum speed in meters per second.
physicalCharacteristics - Physical characteristics of the swerve module.
+angleMotorEncoderPulsePerRevolution - The encoder pulse per revolution for the angle motor encoder.
+angleMotorFreeSpeedRPM - The free speed RPM of the angle motor.
diff --git a/docs/swervelib/parser/SwerveModulePhysicalCharacteristics.html b/docs/swervelib/parser/SwerveModulePhysicalCharacteristics.html
index 0733eca..c8cee41 100644
--- a/docs/swervelib/parser/SwerveModulePhysicalCharacteristics.html
+++ b/docs/swervelib/parser/SwerveModulePhysicalCharacteristics.html
@@ -1,7 +1,7 @@
-
+
SwerveModulePhysicalCharacteristics
@@ -237,7 +237,7 @@ loadScripts(document, 'script');
angleEncoderPulsePerRotation
public final int angleEncoderPulsePerRotation
-Angle motor encoder pulse per rotation. 1 if integrated encoder.
+Angle motor encoder pulse per rotation. 1 for Neo encoder. 2048 for Falcons.
diff --git a/docs/swervelib/parser/SwerveParser.html b/docs/swervelib/parser/SwerveParser.html
index 51895be..feb8406 100644
--- a/docs/swervelib/parser/SwerveParser.html
+++ b/docs/swervelib/parser/SwerveParser.html
@@ -1,7 +1,7 @@
-
+
SwerveParser
diff --git a/docs/swervelib/parser/deserializer/PIDFRange.html b/docs/swervelib/parser/deserializer/PIDFRange.html
index 5508e9c..bf5db8f 100644
--- a/docs/swervelib/parser/deserializer/PIDFRange.html
+++ b/docs/swervelib/parser/deserializer/PIDFRange.html
@@ -1,7 +1,7 @@
-
+
PIDFRange
diff --git a/docs/swervelib/parser/deserializer/package-summary.html b/docs/swervelib/parser/deserializer/package-summary.html
index d685baf..a007121 100644
--- a/docs/swervelib/parser/deserializer/package-summary.html
+++ b/docs/swervelib/parser/deserializer/package-summary.html
@@ -1,7 +1,7 @@
-
+
swervelib.parser.deserializer
diff --git a/docs/swervelib/parser/deserializer/package-tree.html b/docs/swervelib/parser/deserializer/package-tree.html
index 32723c5..5940760 100644
--- a/docs/swervelib/parser/deserializer/package-tree.html
+++ b/docs/swervelib/parser/deserializer/package-tree.html
@@ -1,7 +1,7 @@
-
+
swervelib.parser.deserializer Class Hierarchy
diff --git a/docs/swervelib/parser/json/ControllerPropertiesJson.html b/docs/swervelib/parser/json/ControllerPropertiesJson.html
index fc09527..30d5aa9 100644
--- a/docs/swervelib/parser/json/ControllerPropertiesJson.html
+++ b/docs/swervelib/parser/json/ControllerPropertiesJson.html
@@ -1,7 +1,7 @@
-
+
ControllerPropertiesJson
diff --git a/docs/swervelib/parser/json/DeviceJson.html b/docs/swervelib/parser/json/DeviceJson.html
index 6adbd8b..209bd76 100644
--- a/docs/swervelib/parser/json/DeviceJson.html
+++ b/docs/swervelib/parser/json/DeviceJson.html
@@ -1,7 +1,7 @@
-
+
DeviceJson
diff --git a/docs/swervelib/parser/json/ModuleJson.html b/docs/swervelib/parser/json/ModuleJson.html
index f343113..2fe67ff 100644
--- a/docs/swervelib/parser/json/ModuleJson.html
+++ b/docs/swervelib/parser/json/ModuleJson.html
@@ -1,7 +1,7 @@
-
+
ModuleJson
@@ -106,6 +106,16 @@ loadScripts(document, 'script');
Angle motor device configuration.
+double
+
+
+
The angle encoder pulse per revolution override.
+
+double
+
+
+
Angle motor free speed RPM.
+
@@ -221,6 +231,20 @@ loadScripts(document, 'script');
+
+angleEncoderPulsePerRevolution
+public double angleEncoderPulsePerRevolution
+The angle encoder pulse per revolution override. 1 for Neo encoder. 2048 for Falcons.
+
+
+
+
+angleMotorFreeSpeedRPM
+public double angleMotorFreeSpeedRPM
+Angle motor free speed RPM.
+
+
+
location
diff --git a/docs/swervelib/parser/json/MotorConfigDouble.html b/docs/swervelib/parser/json/MotorConfigDouble.html
index 9eaf271..b82c774 100644
--- a/docs/swervelib/parser/json/MotorConfigDouble.html
+++ b/docs/swervelib/parser/json/MotorConfigDouble.html
@@ -1,7 +1,7 @@
-
+
MotorConfigDouble
diff --git a/docs/swervelib/parser/json/MotorConfigInt.html b/docs/swervelib/parser/json/MotorConfigInt.html
index 201d07d..f2ddafb 100644
--- a/docs/swervelib/parser/json/MotorConfigInt.html
+++ b/docs/swervelib/parser/json/MotorConfigInt.html
@@ -1,7 +1,7 @@
-
+
MotorConfigInt
diff --git a/docs/swervelib/parser/json/PIDFPropertiesJson.html b/docs/swervelib/parser/json/PIDFPropertiesJson.html
index 59e632d..a1e2657 100644
--- a/docs/swervelib/parser/json/PIDFPropertiesJson.html
+++ b/docs/swervelib/parser/json/PIDFPropertiesJson.html
@@ -1,7 +1,7 @@
-
+
PIDFPropertiesJson
diff --git a/docs/swervelib/parser/json/PhysicalPropertiesJson.html b/docs/swervelib/parser/json/PhysicalPropertiesJson.html
index c163d56..9c2177c 100644
--- a/docs/swervelib/parser/json/PhysicalPropertiesJson.html
+++ b/docs/swervelib/parser/json/PhysicalPropertiesJson.html
@@ -1,7 +1,7 @@
-
+
PhysicalPropertiesJson
diff --git a/docs/swervelib/parser/json/SwerveDriveJson.html b/docs/swervelib/parser/json/SwerveDriveJson.html
index 5bf18ea..6059cd2 100644
--- a/docs/swervelib/parser/json/SwerveDriveJson.html
+++ b/docs/swervelib/parser/json/SwerveDriveJson.html
@@ -1,7 +1,7 @@
-
+
SwerveDriveJson
diff --git a/docs/swervelib/parser/json/modules/BoolMotorJson.html b/docs/swervelib/parser/json/modules/BoolMotorJson.html
index c18380b..8f05303 100644
--- a/docs/swervelib/parser/json/modules/BoolMotorJson.html
+++ b/docs/swervelib/parser/json/modules/BoolMotorJson.html
@@ -1,7 +1,7 @@
-
+
BoolMotorJson
diff --git a/docs/swervelib/parser/json/modules/LocationJson.html b/docs/swervelib/parser/json/modules/LocationJson.html
index 8f472a7..62b4323 100644
--- a/docs/swervelib/parser/json/modules/LocationJson.html
+++ b/docs/swervelib/parser/json/modules/LocationJson.html
@@ -1,7 +1,7 @@
-
+
LocationJson
diff --git a/docs/swervelib/parser/json/modules/package-summary.html b/docs/swervelib/parser/json/modules/package-summary.html
index 13e4834..ee46503 100644
--- a/docs/swervelib/parser/json/modules/package-summary.html
+++ b/docs/swervelib/parser/json/modules/package-summary.html
@@ -1,7 +1,7 @@
-
+
swervelib.parser.json.modules
diff --git a/docs/swervelib/parser/json/modules/package-tree.html b/docs/swervelib/parser/json/modules/package-tree.html
index 391a60b..84a6746 100644
--- a/docs/swervelib/parser/json/modules/package-tree.html
+++ b/docs/swervelib/parser/json/modules/package-tree.html
@@ -1,7 +1,7 @@
-
+
swervelib.parser.json.modules Class Hierarchy
diff --git a/docs/swervelib/parser/json/package-summary.html b/docs/swervelib/parser/json/package-summary.html
index ef2c2f3..baa7b8b 100644
--- a/docs/swervelib/parser/json/package-summary.html
+++ b/docs/swervelib/parser/json/package-summary.html
@@ -1,7 +1,7 @@
-
+
swervelib.parser.json
diff --git a/docs/swervelib/parser/json/package-tree.html b/docs/swervelib/parser/json/package-tree.html
index 8f5a9eb..ca4b3c7 100644
--- a/docs/swervelib/parser/json/package-tree.html
+++ b/docs/swervelib/parser/json/package-tree.html
@@ -1,7 +1,7 @@
-
+
swervelib.parser.json Class Hierarchy
diff --git a/docs/swervelib/parser/package-summary.html b/docs/swervelib/parser/package-summary.html
index 4129e42..23a8c5b 100644
--- a/docs/swervelib/parser/package-summary.html
+++ b/docs/swervelib/parser/package-summary.html
@@ -1,7 +1,7 @@
-
+
swervelib.parser
diff --git a/docs/swervelib/parser/package-tree.html b/docs/swervelib/parser/package-tree.html
index 6b09172..f736641 100644
--- a/docs/swervelib/parser/package-tree.html
+++ b/docs/swervelib/parser/package-tree.html
@@ -1,7 +1,7 @@
-
+
swervelib.parser Class Hierarchy
diff --git a/docs/swervelib/simulation/SwerveIMUSimulation.html b/docs/swervelib/simulation/SwerveIMUSimulation.html
index 740e5c7..c704c9f 100644
--- a/docs/swervelib/simulation/SwerveIMUSimulation.html
+++ b/docs/swervelib/simulation/SwerveIMUSimulation.html
@@ -1,7 +1,7 @@
-
+
SwerveIMUSimulation
diff --git a/docs/swervelib/simulation/SwerveModuleSimulation.html b/docs/swervelib/simulation/SwerveModuleSimulation.html
index aa1081f..791347e 100644
--- a/docs/swervelib/simulation/SwerveModuleSimulation.html
+++ b/docs/swervelib/simulation/SwerveModuleSimulation.html
@@ -1,7 +1,7 @@
-
+
SwerveModuleSimulation
diff --git a/docs/swervelib/simulation/ctre/PhysicsSim.SimProfile.html b/docs/swervelib/simulation/ctre/PhysicsSim.SimProfile.html
index 8a02018..66def89 100644
--- a/docs/swervelib/simulation/ctre/PhysicsSim.SimProfile.html
+++ b/docs/swervelib/simulation/ctre/PhysicsSim.SimProfile.html
@@ -1,7 +1,7 @@
-
+
PhysicsSim.SimProfile
diff --git a/docs/swervelib/simulation/ctre/PhysicsSim.html b/docs/swervelib/simulation/ctre/PhysicsSim.html
index 518b294..0673b86 100644
--- a/docs/swervelib/simulation/ctre/PhysicsSim.html
+++ b/docs/swervelib/simulation/ctre/PhysicsSim.html
@@ -1,7 +1,7 @@
-
+
PhysicsSim
diff --git a/docs/swervelib/simulation/ctre/TalonFXSimProfile.html b/docs/swervelib/simulation/ctre/TalonFXSimProfile.html
index cc55148..1b8935e 100644
--- a/docs/swervelib/simulation/ctre/TalonFXSimProfile.html
+++ b/docs/swervelib/simulation/ctre/TalonFXSimProfile.html
@@ -1,7 +1,7 @@
-
+
TalonFXSimProfile
diff --git a/docs/swervelib/simulation/ctre/TalonSRXSimProfile.html b/docs/swervelib/simulation/ctre/TalonSRXSimProfile.html
index 39ad86c..d87d2c4 100644
--- a/docs/swervelib/simulation/ctre/TalonSRXSimProfile.html
+++ b/docs/swervelib/simulation/ctre/TalonSRXSimProfile.html
@@ -1,7 +1,7 @@
-
+
TalonSRXSimProfile
diff --git a/docs/swervelib/simulation/ctre/VictorSPXSimProfile.html b/docs/swervelib/simulation/ctre/VictorSPXSimProfile.html
index 447b02b..dd190ad 100644
--- a/docs/swervelib/simulation/ctre/VictorSPXSimProfile.html
+++ b/docs/swervelib/simulation/ctre/VictorSPXSimProfile.html
@@ -1,7 +1,7 @@
-
+
VictorSPXSimProfile
diff --git a/docs/swervelib/simulation/ctre/package-summary.html b/docs/swervelib/simulation/ctre/package-summary.html
index 6012e2e..eb38b2b 100644
--- a/docs/swervelib/simulation/ctre/package-summary.html
+++ b/docs/swervelib/simulation/ctre/package-summary.html
@@ -1,7 +1,7 @@
-
+
swervelib.simulation.ctre
diff --git a/docs/swervelib/simulation/ctre/package-tree.html b/docs/swervelib/simulation/ctre/package-tree.html
index 7f39a00..59b38e0 100644
--- a/docs/swervelib/simulation/ctre/package-tree.html
+++ b/docs/swervelib/simulation/ctre/package-tree.html
@@ -1,7 +1,7 @@
-
+
swervelib.simulation.ctre Class Hierarchy
diff --git a/docs/swervelib/simulation/package-summary.html b/docs/swervelib/simulation/package-summary.html
index 5fdc895..0684488 100644
--- a/docs/swervelib/simulation/package-summary.html
+++ b/docs/swervelib/simulation/package-summary.html
@@ -1,7 +1,7 @@
-
+
swervelib.simulation
diff --git a/docs/swervelib/simulation/package-tree.html b/docs/swervelib/simulation/package-tree.html
index 5a76dfa..cceb7fd 100644
--- a/docs/swervelib/simulation/package-tree.html
+++ b/docs/swervelib/simulation/package-tree.html
@@ -1,7 +1,7 @@
-
+
swervelib.simulation Class Hierarchy
diff --git a/docs/swervelib/telemetry/SwerveDriveTelemetry.html b/docs/swervelib/telemetry/SwerveDriveTelemetry.html
index d3df1a0..18077f0 100644
--- a/docs/swervelib/telemetry/SwerveDriveTelemetry.html
+++ b/docs/swervelib/telemetry/SwerveDriveTelemetry.html
@@ -1,7 +1,7 @@
-
+
SwerveDriveTelemetry
diff --git a/docs/swervelib/telemetry/package-summary.html b/docs/swervelib/telemetry/package-summary.html
index 8327ced..f5aa001 100644
--- a/docs/swervelib/telemetry/package-summary.html
+++ b/docs/swervelib/telemetry/package-summary.html
@@ -1,7 +1,7 @@
-
+
swervelib.telemetry
diff --git a/docs/swervelib/telemetry/package-tree.html b/docs/swervelib/telemetry/package-tree.html
index f0ddb30..8e59d49 100644
--- a/docs/swervelib/telemetry/package-tree.html
+++ b/docs/swervelib/telemetry/package-tree.html
@@ -1,7 +1,7 @@
-
+
swervelib.telemetry Class Hierarchy
diff --git a/swervelib/parser/SwerveModuleConfiguration.java b/swervelib/parser/SwerveModuleConfiguration.java
index 274704b..39e6f8c 100644
--- a/swervelib/parser/SwerveModuleConfiguration.java
+++ b/swervelib/parser/SwerveModuleConfiguration.java
@@ -48,6 +48,10 @@ public class SwerveModuleConfiguration
* Angle volt-meter-per-second.
*/
public double angleKV;
+ /**
+ * The integrated encoder pulse per revolution.
+ */
+ public double angleMotorEncoderPulsePerRevolution = 0;
/**
* Swerve module location relative to the robot.
*/
@@ -68,19 +72,21 @@ public class SwerveModuleConfiguration
/**
* Construct a configuration object for swerve modules.
*
- * @param driveMotor Drive {@link SwerveMotor}.
- * @param angleMotor Angle {@link SwerveMotor}
- * @param absoluteEncoder Absolute encoder {@link SwerveAbsoluteEncoder}.
- * @param angleOffset Absolute angle offset to 0.
- * @param absoluteEncoderInverted Absolute encoder inverted.
- * @param angleMotorInverted State of inversion of the angle motor.
- * @param driveMotorInverted Drive motor inverted.
- * @param xMeters Module location in meters from the center horizontally.
- * @param yMeters Module location in meters from center vertically.
- * @param anglePIDF Angle PIDF configuration.
- * @param velocityPIDF Velocity PIDF configuration.
- * @param maxSpeed Maximum speed in meters per second.
- * @param physicalCharacteristics Physical characteristics of the swerve module.
+ * @param driveMotor Drive {@link SwerveMotor}.
+ * @param angleMotor Angle {@link SwerveMotor}
+ * @param absoluteEncoder Absolute encoder {@link SwerveAbsoluteEncoder}.
+ * @param angleOffset Absolute angle offset to 0.
+ * @param absoluteEncoderInverted Absolute encoder inverted.
+ * @param angleMotorInverted State of inversion of the angle motor.
+ * @param driveMotorInverted Drive motor inverted.
+ * @param xMeters Module location in meters from the center horizontally.
+ * @param yMeters Module location in meters from center vertically.
+ * @param anglePIDF Angle PIDF configuration.
+ * @param velocityPIDF Velocity PIDF configuration.
+ * @param maxSpeed Maximum speed in meters per second.
+ * @param physicalCharacteristics Physical characteristics of the swerve module.
+ * @param angleMotorEncoderPulsePerRevolution The encoder pulse per revolution for the angle motor encoder.
+ * @param angleMotorFreeSpeedRPM The free speed RPM of the angle motor.
*/
public SwerveModuleConfiguration(
SwerveMotor driveMotor,
@@ -95,7 +101,9 @@ public class SwerveModuleConfiguration
SwerveModulePhysicalCharacteristics physicalCharacteristics,
boolean absoluteEncoderInverted,
boolean driveMotorInverted,
- boolean angleMotorInverted)
+ boolean angleMotorInverted,
+ double angleMotorEncoderPulsePerRevolution,
+ double angleMotorFreeSpeedRPM)
{
this.driveMotor = driveMotor;
this.angleMotor = angleMotor;
@@ -111,9 +119,10 @@ public class SwerveModuleConfiguration
this.angleKV =
calculateAngleKV(
physicalCharacteristics.optimalVoltage,
- physicalCharacteristics.angleMotorFreeSpeedRPM,
+ angleMotorFreeSpeedRPM,
physicalCharacteristics.angleGearRatio);
this.physicalCharacteristics = physicalCharacteristics;
+ this.angleMotorEncoderPulsePerRevolution = angleMotorEncoderPulsePerRevolution;
}
/**
@@ -156,7 +165,9 @@ public class SwerveModuleConfiguration
physicalCharacteristics,
false,
false,
- false);
+ false,
+ physicalCharacteristics.angleEncoderPulsePerRotation,
+ physicalCharacteristics.angleMotorFreeSpeedRPM);
}
/**
@@ -187,9 +198,9 @@ public class SwerveModuleConfiguration
? calculateMetersPerRotation(
physicalCharacteristics.wheelDiameter,
physicalCharacteristics.driveGearRatio,
- physicalCharacteristics.driveEncoderPulsePerRotation)
+ angleMotorEncoderPulsePerRevolution)
: calculateDegreesPerSteeringRotation(
physicalCharacteristics.angleGearRatio,
- physicalCharacteristics.angleEncoderPulsePerRotation);
+ angleMotorEncoderPulsePerRevolution);
}
}
diff --git a/swervelib/parser/SwerveModulePhysicalCharacteristics.java b/swervelib/parser/SwerveModulePhysicalCharacteristics.java
index 97d4953..8d07dc9 100644
--- a/swervelib/parser/SwerveModulePhysicalCharacteristics.java
+++ b/swervelib/parser/SwerveModulePhysicalCharacteristics.java
@@ -23,7 +23,7 @@ public class SwerveModulePhysicalCharacteristics
*/
public final int driveEncoderPulsePerRotation;
/**
- * Angle motor encoder pulse per rotation. 1 if integrated encoder.
+ * Angle motor encoder pulse per rotation. 1 for Neo encoder. 2048 for Falcons.
*/
public final int angleEncoderPulsePerRotation;
/**
diff --git a/swervelib/parser/json/ModuleJson.java b/swervelib/parser/json/ModuleJson.java
index 7a0bafc..b570ebe 100644
--- a/swervelib/parser/json/ModuleJson.java
+++ b/swervelib/parser/json/ModuleJson.java
@@ -38,7 +38,15 @@ public class ModuleJson
/**
* Absolute encoder inversion state.
*/
- public boolean absoluteEncoderInverted = false;
+ public boolean absoluteEncoderInverted = false;
+ /**
+ * The angle encoder pulse per revolution override. 1 for Neo encoder. 2048 for Falcons.
+ */
+ public double angleEncoderPulsePerRevolution = 0;
+ /**
+ * Angle motor free speed RPM.
+ */
+ public double angleMotorFreeSpeedRPM = 0;
/**
* The location of the swerve module from the center of the robot in inches.
*/
@@ -82,6 +90,9 @@ public class ModuleJson
physicalCharacteristics,
absoluteEncoderInverted,
inverted.drive,
- inverted.angle);
+ inverted.angle,
+ angleEncoderPulsePerRevolution == 0 ? physicalCharacteristics.angleEncoderPulsePerRotation
+ : angleEncoderPulsePerRevolution,
+ angleMotorFreeSpeedRPM == 0 ? physicalCharacteristics.angleMotorFreeSpeedRPM : angleMotorFreeSpeedRPM);
}
}