diff --git a/docs/allclasses-index.html b/docs/allclasses-index.html index 9482216..6e5d167 100644 --- a/docs/allclasses-index.html +++ b/docs/allclasses-index.html @@ -1,11 +1,11 @@
- +SwerveDrivePoseEstimator and update the SwerveIMU gyro reading with
the given timestamp of the vision measurement.SwerveDrivePoseEstimator and update the SwerveIMU gyro reading with
the given timestamp of the vision measurement.PhysicalPropertiesJson.moduleFeedForwardClosedLoop instead.SwerveModule JSON parsed class.SwerveModuleState optimizations so the angle is reversed and speed is reversed to ensure the module
never turns more than 90deg.Rotation3d object.SwerveControllerConfiguration.maxSpeed and
- SwerveDriveConfiguration.maxSpeed which is used for the
+SwerveDrive.maxSpeedMPS which is used for the
SwerveDrive.setRawModuleStates(SwerveModuleState[], boolean) function and
SwerveController.getTargetSpeeds(double, double, double, double, double) functions.SwerveControllerConfiguration.maxSpeed and
- SwerveDriveConfiguration.maxSpeed which is used for the
+SwerveDrive.maxSpeedMPS which is used for the
SwerveDrive.setRawModuleStates(SwerveModuleState[], boolean) function and
SwerveController.getTargetSpeeds(double, double, double, double, double) functions.AbsoluteEncoder object as a duty cycle.SparkMaxEncoderSwerve object as a duty cycle from the CANSparkMax motor.SwerveController.SwerveModule.SwerveDrive.addVisionMeasurement(Pose2d, double, Matrix)
+ with the calculated optimal standard deviation.SwerveMath.calculateMetersPerRotation(double, double, double) and
+ SwerveMath.calculateDegreesPerSteeringRotation(double, double).SwerveControllerConfiguration based on parsed and given data.SwerveAbsoluteEncoder from the data port on the motor controller.SwerveMotor from the given configuration.SwerveDrive from JSON configuration directory.SwerveDrive from JSON configuration directory.SwerveDrive from JSON configuration directory.SwerveDrive from JSON configuration directory.Rotation3d from the IMU without any zeroing.ChassisSpeeds based of raw speeds desired in meters/second and heading in radians.edu.wpi.first.math.kinematics.ChassisSpeedsgetTargetSpeeds(double xInput,
+getTargetSpeeds(double xInput,
double yInput,
double angle,
- double currentHeadingAngleRadians)
+ double currentHeadingAngleRadians,
+ double maxSpeed) edu.wpi.first.math.kinematics.ChassisSpeedsgetTargetSpeeds(double xInput,
+getTargetSpeeds(double xInput,
double yInput,
double headingX,
double headingY,
- double currentHeadingAngleRadians)
+ double currentHeadingAngleRadians,
+ double maxSpeed) xInput - X joystick input for the robot to move in the X direction.yInput - Y joystick input for the robot to move in the Y direction.xInput - X joystick input for the robot to move in the X direction. X = xInput * maxSpeedyInput - Y joystick input for the robot to move in the Y direction. Y = yInput *
+ maxSpeed;angle - The desired angle of the robot in radians.currentHeadingAngleRadians - The current robot heading in radians.maxSpeed - Maximum speed in meters per second.ChassisSpeeds which can be sent to th Swerve Drive.headingX - X joystick which controls the angle of the robot.headingY - Y joystick which controls the angle of the robot.currentHeadingAngleRadians - The current robot heading in radians.maxSpeed - Maximum speed of the drive motors in meters per second, multiplier of the xInput
+ and yInput.ChassisSpeeds which can be sent to th Swerve Drive.private doubleprivate doublebooleanprivate SwerveIMUbooleanprivate SwerveIMUbooleanbooleanfinal edu.wpi.first.math.kinematics.SwerveDriveKinematicsfinal edu.wpi.first.math.kinematics.SwerveDriveKinematicsprivate doubleprivate doubleprivate intedu.wpi.first.math.Matrix<edu.wpi.first.math.numbers.N3,edu.wpi.first.math.numbers.N1> edu.wpi.first.math.Matrix<edu.wpi.first.math.numbers.N3,edu.wpi.first.math.numbers.N1> addVisionMeasurement(Pose2d, double, Matrix)
+ with the calculated optimal standard deviation.SwerveDrive(SwerveDriveConfiguration config,
- SwerveControllerConfiguration controllerConfig) SwerveDrive(SwerveDriveConfiguration config,
+ SwerveControllerConfiguration controllerConfig,
+ double maxSpeedMPS) voidaddVisionMeasurement(edu.wpi.first.math.geometry.Pose2d robotPose,
- double timestamp,
- boolean soft,
- double trustWorthiness) addVisionMeasurement(edu.wpi.first.math.geometry.Pose2d robotPose,
+ double timestamp) SwerveDrivePoseEstimator and update the SwerveIMU gyro reading with
the given timestamp of the vision measurement.voidaddVisionMeasurement(edu.wpi.first.math.geometry.Pose2d robotPose,
+addVisionMeasurement(edu.wpi.first.math.geometry.Pose2d robotPose,
double timestamp,
- boolean soft,
edu.wpi.first.math.Matrix<edu.wpi.first.math.numbers.N3,edu.wpi.first.math.numbers.N1> visionMeasurementStdDevs)
Add a vision measurement to the SwerveDrivePoseEstimator and update the SwerveIMU gyro reading with
the given timestamp of the vision measurement.
void
-
-
-Disable second order kinematics.
-
-void
-drive(edu.wpi.first.math.geometry.Translation2d translation,
+drive(edu.wpi.first.math.geometry.Translation2d translation,
double rotation,
boolean fieldRelative,
boolean isOpenLoop)
-
-The primary method for controlling the drivebase.
-
-void
-drive(edu.wpi.first.math.geometry.Translation2d translation,
- double rotation,
- boolean fieldRelative,
- boolean isOpenLoop,
- boolean headingCorrection)
The primary method for controlling the drivebase.
void
-
+drive(edu.wpi.first.math.kinematics.ChassisSpeeds velocity)
-Enable second order kinematics for tracking purposes but completely untuned.
+Secondary method for controlling the drivebase.
void
-enableSecondOrderKinematics(double moduleFeedforward)
+drive(edu.wpi.first.math.kinematics.ChassisSpeeds velocity,
+ boolean isOpenLoop)
-Enable second order kinematics for simulation and modifying the feedforward.
+The primary method for controlling the drivebase.
-double
-enableSecondOrderKinematics(int motorFreeSpeedRPM)
+void
+driveFieldOriented(edu.wpi.first.math.kinematics.ChassisSpeeds velocity)
-Enable second order kinematics with calculated values for the feedforward and return the value used.
+Secondary method of controlling the drive base given velocity and adjusting it for field oriented use.
Optional<edu.wpi.first.math.geometry.Translation3d>
getAccel()
@@ -353,9 +358,19 @@ loadScripts(document, 'script');
Resets odometry to the given pose.
void
-setChassisSpeeds(edu.wpi.first.math.kinematics.ChassisSpeeds chassisSpeeds)
+setAngleMotorConversionFactor(double conversionFactor)
-Set chassis speeds with closed-loop velocity control and second order kinematics.
+Set the conversion factor for the angle/azimuth motor controller.
+
+void
+setChassisSpeeds(edu.wpi.first.math.kinematics.ChassisSpeeds chassisSpeeds)
+
+Set chassis speeds with closed-loop velocity control.
+
+void
+setDriveMotorConversionFactor(double conversionFactor)
+
+Set the conversion factor for the drive motor controller.
void
setGyro(edu.wpi.first.math.geometry.Rotation3d gyro)
@@ -368,74 +383,78 @@ loadScripts(document, 'script');
Set the gyro scope offset to a desired known rotation.
voidsetMaximumSpeed(double maximumSpeed) setHeadingCorrection(boolean state) SwerveControllerConfiguration.maxSpeed and
- SwerveDriveConfiguration.maxSpeed which is used for the
- setRawModuleStates(SwerveModuleState[], boolean) function and
- SwerveController.getTargetSpeeds(double, double, double, double, double) functions.voidsetMaximumSpeed(double maximumSpeed,
- boolean updateModuleFeedforward) setMaximumSpeed(double maximumSpeed) SwerveControllerConfiguration.maxSpeed and
- SwerveDriveConfiguration.maxSpeed which is used for the
+maxSpeedMPS which is used for the
setRawModuleStates(SwerveModuleState[], boolean) function and
SwerveController.getTargetSpeeds(double, double, double, double, double) functions.voidsetMaximumSpeeds(double attainableMaxModuleSpeedMetersPerSecond,
+setMaximumSpeed(double maximumSpeed,
+ boolean updateModuleFeedforward,
+ double optimalVoltage)
+
+Set the maximum speed of the drive motors, modified maxSpeedMPS which is used for the
+ setRawModuleStates(SwerveModuleState[], boolean) function and
+ SwerveController.getTargetSpeeds(double, double, double, double, double) functions.
+
+void
+setMaximumSpeeds(double attainableMaxModuleSpeedMetersPerSecond,
double attainableMaxTranslationalSpeedMetersPerSecond,
double attainableMaxRotationalVelocityRadiansPerSecond)
-
+
Set the maximum speeds for desaturation.
-void
-setModuleStateOptimization(boolean optimizationEnabled)
-
+void
+setModuleStateOptimization(boolean optimizationEnabled)
+
Configure whether the SwerveModuleState will be optimized to prevent spinning more than 90deg.
-void
-setModuleStates(edu.wpi.first.math.kinematics.SwerveModuleState[] desiredStates,
+void
+setModuleStates(edu.wpi.first.math.kinematics.SwerveModuleState[] desiredStates,
boolean isOpenLoop)
-
+
Set the module states (azimuth and velocity) directly.
-void
-setMotorIdleMode(boolean brake)
-
+void
+setMotorIdleMode(boolean brake)
+
Sets the drive motors to brake/coast mode.
-void
-setOdometryPeriod(double period)
-
+void
+setOdometryPeriod(double period)
+
Set the odometry update period in seconds.
-private void
-setRawModuleStates(edu.wpi.first.math.kinematics.SwerveModuleState[] desiredStates,
+private void
+setRawModuleStates(edu.wpi.first.math.kinematics.SwerveModuleState[] desiredStates,
boolean isOpenLoop)
-
+
Set the module states (azimuth and velocity) directly.
-void
-
-
+void
+
+
Stop the odometry thread in favor of manually updating odometry.
-void
-
-
+void
+
+
Synchronize angle motor integrated encoders with data from absolute encoders.
-void
-
-
+void
+
+
Update odometry should be run every loop.
-void
-zeroGyro()
-
+void
+zeroGyro()
+
Resets the gyro angle to zero and resets odometry to the same position, but facing toward 0.
@@ -459,7 +478,7 @@ loadScripts(document, 'script');
kinematics
public final edu.wpi.first.math.kinematics.SwerveDriveKinematics kinematics
-Swerve Kinematics object utilizing second order kinematics.
+Swerve Kinematics object.
-
@@ -515,16 +534,18 @@ loadScripts(document, 'script');
stateStdDevs
public edu.wpi.first.math.Matrix<edu.wpi.first.math.numbers.N3,edu.wpi.first.math.numbers.N1> stateStdDevs
-Trustworthiness of the internal model of how motors should be moving Measured in expected standard deviation
- (meters of position and degrees of rotation)
+Standard deviation of encoders and gyroscopes, usually should not change. (meters of position and degrees of
+ rotation)
-
visionMeasurementStdDevs
public edu.wpi.first.math.Matrix<edu.wpi.first.math.numbers.N3,edu.wpi.first.math.numbers.N1> visionMeasurementStdDevs
-Trustworthiness of the vision system Measured in expected standard deviation (meters of position and degrees of
- rotation)
+The standard deviation of the vision measurement, for best accuracy calculate the standard deviation at 2 or more
+ points and fit a line to it and modify this using addVisionMeasurement(Pose2d, double, Matrix)
+ with the calculated optimal standard deviation. (Units should be meters per pixel). By optimizing this you can get
+ vision accurate to inches instead of feet.
-
@@ -543,6 +564,13 @@ loadScripts(document, 'script');
-
+
+headingCorrection
+public boolean headingCorrection
+Whether to correct heading when driving translationally. Set to true to enable.
+
+
+-
imu
@@ -570,6 +598,27 @@ loadScripts(document, 'script');
The last heading set in radians.
+-
+
+attainableMaxTranslationalSpeedMetersPerSecond
+private double attainableMaxTranslationalSpeedMetersPerSecond
+The absolute max speed that your robot can reach while translating in meters per second.
+
+
+-
+
+attainableMaxRotationalVelocityRadiansPerSecond
+private double attainableMaxRotationalVelocityRadiansPerSecond
+The absolute max speed the robot can reach while rotating radians per second.
+
+
+-
+
+maxSpeedMPS
+private double maxSpeedMPS
+Maximum speed of the robot in meters per second.
+
+
@@ -579,12 +628,13 @@ loadScripts(document, 'script');
Constructor Details
-
-
+
SwerveDrive
public SwerveDrive(SwerveDriveConfiguration config,
- SwerveControllerConfiguration controllerConfig)
-Creates a new swerve drivebase subsystem. Robot is controlled via the drive(edu.wpi.first.math.geometry.Translation2d, double, boolean, boolean) method, or via the
- setRawModuleStates(edu.wpi.first.math.kinematics.SwerveModuleState[], boolean) method. The drive(edu.wpi.first.math.geometry.Translation2d, double, boolean, boolean) method incorporates kinematics-- it
+ SwerveControllerConfiguration controllerConfig,
+ double maxSpeedMPS)
+Creates a new swerve drivebase subsystem. Robot is controlled via the drive(edu.wpi.first.math.kinematics.ChassisSpeeds) method, or via the
+ setRawModuleStates(edu.wpi.first.math.kinematics.SwerveModuleState[], boolean) method. The drive(edu.wpi.first.math.kinematics.ChassisSpeeds) method incorporates kinematics-- it
takes a translation and rotation, as well as parameters for field-centric and closed-loop velocity control.
setRawModuleStates(edu.wpi.first.math.kinematics.SwerveModuleState[], boolean) takes a list of SwerveModuleStates and directly passes them to the modules.
This subsystem also handles odometry.
@@ -593,6 +643,8 @@ loadScripts(document, 'script');
config - The SwerveDriveConfiguration configuration to base the swerve drive off of.
controllerConfig - The SwerveControllerConfiguration to use when creating the
SwerveController.
+maxSpeedMPS - Maximum speed in meters per second, remember to use Units.feetToMeters(double) if
+ you have feet per second!
@@ -623,6 +675,79 @@ loadScripts(document, 'script');
-
+
+setAngleMotorConversionFactor
+public void setAngleMotorConversionFactor(double conversionFactor)
+Set the conversion factor for the angle/azimuth motor controller.
+
+- Parameters:
+conversionFactor - Angle motor conversion factor for PID, should be generated from
+ SwerveMath.calculateDegreesPerSteeringRotation(double, double) or calculated.
+
+
+
+-
+
+setDriveMotorConversionFactor
+public void setDriveMotorConversionFactor(double conversionFactor)
+Set the conversion factor for the drive motor controller.
+
+- Parameters:
+conversionFactor - Drive motor conversion factor for PID, should be generated from
+ SwerveMath.calculateMetersPerRotation(double, double, double) or calculated.
+
+
+
+-
+
+setHeadingCorrection
+public void setHeadingCorrection(boolean state)
+Set the heading correction capabilities of YAGSL.
+
+- Parameters:
+state - headingCorrection state.
+
+
+
+-
+
+driveFieldOriented
+public void driveFieldOriented(edu.wpi.first.math.kinematics.ChassisSpeeds velocity)
+Secondary method of controlling the drive base given velocity and adjusting it for field oriented use.
+
+- Parameters:
+velocity - Velocity of the robot desired.
+
+
+
+-
+
+drive
+public void drive(edu.wpi.first.math.kinematics.ChassisSpeeds velocity)
+Secondary method for controlling the drivebase. Given a simple ChassisSpeeds set the swerve module states,
+ to achieve the goal.
+
+- Parameters:
+velocity - The desired robot-oriented ChassisSpeeds for the robot to achieve.
+
+
+
+-
+
+drive
+public void drive(edu.wpi.first.math.kinematics.ChassisSpeeds velocity,
+ boolean isOpenLoop)
+The primary method for controlling the drivebase. Takes a ChassisSpeeds, and calculates and commands module
+ states accordingly. Can use either open-loop or closed-loop velocity control for the wheel velocities. Also has
+ field- and robot-relative modes, which affect how the translation vector is used.
+
+- Parameters:
+velocity - The chassis speeds to set the robot to achieve.
+isOpenLoop - Whether to use closed-loop velocity control. Set to true to disable closed-loop.
+
+
+
+-
drive
public void drive(edu.wpi.first.math.geometry.Translation2d translation,
@@ -631,8 +756,7 @@ loadScripts(document, 'script');
boolean isOpenLoop)
The primary method for controlling the drivebase. Takes a Translation2d and a rotation rate, and calculates
and commands module states accordingly. Can use either open-loop or closed-loop velocity control for the wheel
- velocities. Also has field- and robot-relative modes, which affect how the translation vector is used. This method
- defaults to no heading correction.
+ velocities. Also has field- and robot-relative modes, which affect how the translation vector is used.
- Parameters:
translation - Translation2d that is the commanded linear velocity of the robot, in meters per
@@ -648,32 +772,6 @@ loadScripts(document, 'script');
-
-
-drive
-public void drive(edu.wpi.first.math.geometry.Translation2d translation,
- double rotation,
- boolean fieldRelative,
- boolean isOpenLoop,
- boolean headingCorrection)
-The primary method for controlling the drivebase. Takes a Translation2d and a rotation rate, and calculates and
- commands module states accordingly. Can use either open-loop or closed-loop velocity control for the wheel
- velocities. Also has field- and robot-relative modes, which affect how the translation vector is used.
-
-- Parameters:
-translation - Translation2d that is the commanded linear velocity of the robot, in meters per
- second. In robot-relative mode, positive x is torwards the bow (front) and positive y is
- torwards port (left). In field-relative mode, positive x is away from the alliance wall
- (field North) and positive y is torwards the left wall when looking through the driver
- station glass (field West).
-rotation - Robot angular rate, in radians per second. CCW positive. Unaffected by field/robot
- relativity.
-fieldRelative - Drive mode. True for field-relative, false for robot-relative.
-isOpenLoop - Whether to use closed-loop velocity control. Set to true to disable closed-loop.
-headingCorrection - Whether to correct heading when driving translationally. Set to true to enable.
-
-
-
--
setMaximumSpeeds
public void setMaximumSpeeds(double attainableMaxModuleSpeedMetersPerSecond,
@@ -721,7 +819,7 @@ loadScripts(document, 'script');
setChassisSpeeds
public void setChassisSpeeds(edu.wpi.first.math.kinematics.ChassisSpeeds chassisSpeeds)
-Set chassis speeds with closed-loop velocity control and second order kinematics.
+Set chassis speeds with closed-loop velocity control.
- Parameters:
chassisSpeeds - Chassis speeds to set.
@@ -882,12 +980,12 @@ loadScripts(document, 'script');
-
-
+
setMaximumSpeed
public void setMaximumSpeed(double maximumSpeed,
- boolean updateModuleFeedforward)
-Set the maximum speed of the drive motors, modified SwerveControllerConfiguration.maxSpeed and
- SwerveDriveConfiguration.maxSpeed which is used for the
+ boolean updateModuleFeedforward,
+ double optimalVoltage)
+Set the maximum speed of the drive motors, modified maxSpeedMPS which is used for the
setRawModuleStates(SwerveModuleState[], boolean) function and
SwerveController.getTargetSpeeds(double, double, double, double, double) functions. This function overrides
what was placed in the JSON and could damage your motor/robot if set too high or unachievable rates.
@@ -897,6 +995,7 @@ loadScripts(document, 'script');
updateModuleFeedforward - Update the swerve module feedforward to account for the new maximum speed. This
should be true unless you have replaced the drive motor feedforward with
replaceSwerveModuleFeedforward(SimpleMotorFeedforward)
+optimalVoltage - Optimal voltage to use for the feedforward.
@@ -904,8 +1003,7 @@ loadScripts(document, 'script');
setMaximumSpeed
public void setMaximumSpeed(double maximumSpeed)
-Set the maximum speed of the drive motors, modified SwerveControllerConfiguration.maxSpeed and
- SwerveDriveConfiguration.maxSpeed which is used for the
+Set the maximum speed of the drive motors, modified maxSpeedMPS which is used for the
setRawModuleStates(SwerveModuleState[], boolean) function and
SwerveController.getTargetSpeeds(double, double, double, double, double) functions. This function overrides
what was placed in the JSON and could damage your motor/robot if set too high or unachievable rates. Overwrites the
@@ -977,12 +1075,10 @@ loadScripts(document, 'script');
-
-
+
addVisionMeasurement
public void addVisionMeasurement(edu.wpi.first.math.geometry.Pose2d robotPose,
- double timestamp,
- boolean soft,
- double trustWorthiness)
+ double timestamp)
Add a vision measurement to the SwerveDrivePoseEstimator and update the SwerveIMU gyro reading with
the given timestamp of the vision measurement.
IT IS HIGHLY RECOMMENDED TO UPDATE YOUR GYROSCOPE OFFSET
AFTER USING THIS FUNCTION!
To update your gyroscope readings directly use
@@ -991,22 +1087,15 @@ loadScripts(document, 'script');
- Parameters:
robotPose - Robot Pose2d as measured by vision.
timestamp - Timestamp the measurement was taken as time since startup, should be taken from
- Timer.getFPGATimestamp() or similar sources.
-soft - Add vision estimate using the
- SwerveDrivePoseEstimator.addVisionMeasurement(Pose2d, double) function, or hard
- reset odometry with the given position with
- SwerveDriveOdometry.resetPosition(Rotation2d, SwerveModulePosition[], Pose2d).
-trustWorthiness - Trust level of vision reading when using a soft measurement, used to multiply the standard
- deviation. Set to 1 for full trust. Higher = Less Weight.
+ Timer.getFPGATimestamp() or similar sources.
-
-
+
addVisionMeasurement
public void addVisionMeasurement(edu.wpi.first.math.geometry.Pose2d robotPose,
double timestamp,
- boolean soft,
edu.wpi.first.math.Matrix<edu.wpi.first.math.numbers.N3,edu.wpi.first.math.numbers.N1> visionMeasurementStdDevs)
Add a vision measurement to the SwerveDrivePoseEstimator and update the SwerveIMU gyro reading with
the given timestamp of the vision measurement.
@@ -1015,12 +1104,12 @@ loadScripts(document, 'script');
robotPose - Robot Pose2d as measured by vision.
timestamp - Timestamp the measurement was taken as time since startup, should be taken from
Timer.getFPGATimestamp() or similar sources.
-soft - Add vision estimate using the
- SwerveDrivePoseEstimator.addVisionMeasurement(Pose2d, double) function, or
- hard reset odometry with the given position with
- SwerveDriveOdometry.resetPosition(Rotation2d, SwerveModulePosition[], Pose2d).
visionMeasurementStdDevs - Vision measurement standard deviation that will be sent to the
- SwerveDrivePoseEstimator.
+ SwerveDrivePoseEstimator.The standard deviation of the vision measurement,
+ for best accuracy calculate the standard deviation at 2 or more points and fit a
+ line to it with the calculated optimal standard deviation. (Units should be meters
+ per pixel). By optimizing this you can get * vision accurate to inches instead of
+ feet.
@@ -1043,7 +1132,7 @@ loadScripts(document, 'script');
Helper function to get the swerveController for the SwerveDrive which can be used to
generate ChassisSpeeds for the robot to orient it correctly given axis or angles, and apply
SlewRateLimiter to given inputs. Important functions to look at are
- SwerveController.getTargetSpeeds(double, double, double, double),
+ SwerveController.getTargetSpeeds(double, double, double, double, double),
SwerveController.addSlewRateLimiters(SlewRateLimiter, SlewRateLimiter, SlewRateLimiter),
SwerveController.getRawTargetSpeeds(double, double, double).
@@ -1082,45 +1171,6 @@ loadScripts(document, 'script');
--
-
-enableSecondOrderKinematics
-public void enableSecondOrderKinematics(double moduleFeedforward)
-Enable second order kinematics for simulation and modifying the feedforward. Second order kinematics could increase
- accuracy in odometry.
-
-- Parameters:
-moduleFeedforward - Module feedforward to apply should be between [-1, 1] excluding 0.
-
-
-
--
-
-enableSecondOrderKinematics
-public double enableSecondOrderKinematics(int motorFreeSpeedRPM)
-Enable second order kinematics with calculated values for the feedforward and return the value used.
-
-- Parameters:
-motorFreeSpeedRPM - Steering motor free speed RPM.
-- Returns:
-- The feedforward value used for the last swerve module.
-
-
-
--
-
-enableSecondOrderKinematics
-public void enableSecondOrderKinematics()
-Enable second order kinematics for tracking purposes but completely untuned.
-
-
--
-
-disableSecondOrderKinematics
-public void disableSecondOrderKinematics()
-Disable second order kinematics.
-
-
diff --git a/docs/swervelib/SwerveModule.html b/docs/swervelib/SwerveModule.html
index a2c0074..858e5c5 100644
--- a/docs/swervelib/SwerveModule.html
+++ b/docs/swervelib/SwerveModule.html
@@ -1,11 +1,11 @@
-
+
SwerveModule
-
+
@@ -126,25 +126,30 @@ loadScripts(document, 'script');
Last swerve module state applied.
-int
-
+double
+
+Maximum speed of the drive motors in meters per second.
+
+int
+
+
Module number for kinematics, usually 0 to 3.
-boolean
-
-
+boolean
+
+
Enable SwerveModuleState optimizations so the angle is reversed and speed is reversed to ensure the module
never turns more than 90deg.
-private SwerveModuleSimulation
-
-
+private SwerveModuleSimulation
+
+
Simulated swerve module.
-private boolean
-
-
@@ -158,8 +163,9 @@ loadScripts(document, 'script');
Constructor
Description
-SwerveModule(int moduleNumber,
- SwerveModuleConfiguration moduleConfiguration)
+SwerveModule(int moduleNumber,
+ SwerveModuleConfiguration moduleConfiguration,
+ edu.wpi.first.math.controller.SimpleMotorFeedforward driveFeedforward)
Construct the swerve module and initialize the swerve module motors and absolute encoder.
@@ -223,6 +229,16 @@ loadScripts(document, 'script');
Set the angle for the module.
void
+setAngleMotorConversionFactor(double conversionFactor)
+
+Set the conversion factor for the angle/azimuth motor controller.
+
+void
+setAngleMotorVoltageCompensation(double optimalVoltage)
+
+Set the voltage compensation for the swerve module motor.
+
+void
setDesiredState(edu.wpi.first.math.kinematics.SwerveModuleState desiredState,
boolean isOpenLoop,
boolean force)
@@ -230,6 +246,16 @@ loadScripts(document, 'script');
Set the desired state of the swerve module.
void
+setDriveMotorConversionFactor(double conversionFactor)
+
+Set the conversion factor for the drive motor controller.
+
+void
+setDriveMotorVoltageCompensation(double optimalVoltage)
+
+Set the voltage compensation for the swerve module motor.
+
+void
setMotorBrake(boolean brake)
Set the brake mode.
@@ -301,6 +327,13 @@ loadScripts(document, 'script');
-
+
+maxSpeed
+public double maxSpeed
+Maximum speed of the drive motors in meters per second.
+
+
+-
lastState
public edu.wpi.first.math.kinematics.SwerveModuleState lastState
@@ -338,15 +371,18 @@ loadScripts(document, 'script');
Constructor Details
-
-
+
SwerveModule
+ SwerveModuleConfiguration moduleConfiguration,
+ edu.wpi.first.math.controller.SimpleMotorFeedforward driveFeedforward)
Construct the swerve module and initialize the swerve module motors and absolute encoder.
- Parameters:
moduleNumber - Module number for kinematics.
moduleConfiguration - Module constants containing CAN ID's and offsets.
+driveFeedforward - Drive motor feedforward created by
+ SwerveMath.createDriveFeedforward(double, double, double).
@@ -359,6 +395,28 @@ loadScripts(document, 'script');
Method Details
-
+
+setAngleMotorVoltageCompensation
+public void setAngleMotorVoltageCompensation(double optimalVoltage)
+Set the voltage compensation for the swerve module motor.
+
+- Parameters:
+optimalVoltage - Nominal voltage for operation to output to.
+
+
+
+-
+
+setDriveMotorVoltageCompensation
+public void setDriveMotorVoltageCompensation(double optimalVoltage)
+Set the voltage compensation for the swerve module motor.
+
+- Parameters:
+optimalVoltage - Nominal voltage for operation to output to.
+
+
+
+-
queueSynchronizeEncoders
public void queueSynchronizeEncoders()
@@ -449,6 +507,30 @@ loadScripts(document, 'script');
-
+
+setAngleMotorConversionFactor
+public void setAngleMotorConversionFactor(double conversionFactor)
+Set the conversion factor for the angle/azimuth motor controller.
+
+- Parameters:
+conversionFactor - Angle motor conversion factor for PID, should be generated from
+ SwerveMath.calculateDegreesPerSteeringRotation(double, double) or calculated.
+
+
+
+-
+
+setDriveMotorConversionFactor
+public void setDriveMotorConversionFactor(double conversionFactor)
+Set the conversion factor for the drive motor controller.
+
+- Parameters:
+conversionFactor - Drive motor conversion factor for PID, should be generated from
+ SwerveMath.calculateMetersPerRotation(double, double, double) or calculated.
+
+
+
+-
getAngleMotor
diff --git a/docs/swervelib/encoders/AnalogAbsoluteEncoderSwerve.html b/docs/swervelib/encoders/AnalogAbsoluteEncoderSwerve.html
index 3a4a543..e7f5468 100644
--- a/docs/swervelib/encoders/AnalogAbsoluteEncoderSwerve.html
+++ b/docs/swervelib/encoders/AnalogAbsoluteEncoderSwerve.html
@@ -1,11 +1,11 @@
-
+
AnalogAbsoluteEncoderSwerve
-
+
diff --git a/docs/swervelib/encoders/CANCoderSwerve.html b/docs/swervelib/encoders/CANCoderSwerve.html
index 6d83e6b..8d50d36 100644
--- a/docs/swervelib/encoders/CANCoderSwerve.html
+++ b/docs/swervelib/encoders/CANCoderSwerve.html
@@ -1,11 +1,11 @@
-
+
CANCoderSwerve
-
+
diff --git a/docs/swervelib/encoders/CanAndCoderSwerve.html b/docs/swervelib/encoders/CanAndCoderSwerve.html
index 249831e..11a35d7 100644
--- a/docs/swervelib/encoders/CanAndCoderSwerve.html
+++ b/docs/swervelib/encoders/CanAndCoderSwerve.html
@@ -1,11 +1,11 @@
-
+
CanAndCoderSwerve
-
+
diff --git a/docs/swervelib/encoders/PWMDutyCycleEncoderSwerve.html b/docs/swervelib/encoders/PWMDutyCycleEncoderSwerve.html
index 731e469..35e1882 100644
--- a/docs/swervelib/encoders/PWMDutyCycleEncoderSwerve.html
+++ b/docs/swervelib/encoders/PWMDutyCycleEncoderSwerve.html
@@ -1,11 +1,11 @@
-
+
PWMDutyCycleEncoderSwerve
-
+
diff --git a/docs/swervelib/encoders/SparkMaxEncoderSwerve.html b/docs/swervelib/encoders/SparkMaxEncoderSwerve.html
index 775d41a..148e4be 100644
--- a/docs/swervelib/encoders/SparkMaxEncoderSwerve.html
+++ b/docs/swervelib/encoders/SparkMaxEncoderSwerve.html
@@ -1,11 +1,11 @@
-
+
SparkMaxEncoderSwerve
-
+
@@ -115,7 +115,7 @@ loadScripts(document, 'script');
SparkMaxEncoderSwerve(SwerveMotor motor,
int conversionFactor)
-Create the AbsoluteEncoder object as a duty cycle.
+Create the SparkMaxEncoderSwerve object as a duty cycle from the CANSparkMax motor.
@@ -198,7 +198,7 @@ loadScripts(document, 'script');
SparkMaxEncoderSwerve
-Create the AbsoluteEncoder object as a duty cycle. from the CANSparkMax motor.
+Create the SparkMaxEncoderSwerve object as a duty cycle from the CANSparkMax motor.
- Parameters:
motor - Motor to create the encoder from.
diff --git a/docs/swervelib/encoders/SwerveAbsoluteEncoder.html b/docs/swervelib/encoders/SwerveAbsoluteEncoder.html
index 7bc3f8c..de18777 100644
--- a/docs/swervelib/encoders/SwerveAbsoluteEncoder.html
+++ b/docs/swervelib/encoders/SwerveAbsoluteEncoder.html
@@ -1,11 +1,11 @@
-
+
SwerveAbsoluteEncoder
-
+
diff --git a/docs/swervelib/encoders/package-summary.html b/docs/swervelib/encoders/package-summary.html
index f7fdff1..c6540d5 100644
--- a/docs/swervelib/encoders/package-summary.html
+++ b/docs/swervelib/encoders/package-summary.html
@@ -1,11 +1,11 @@
-
+
swervelib.encoders
-
+
diff --git a/docs/swervelib/encoders/package-tree.html b/docs/swervelib/encoders/package-tree.html
index fd2bb3b..a63d669 100644
--- a/docs/swervelib/encoders/package-tree.html
+++ b/docs/swervelib/encoders/package-tree.html
@@ -1,11 +1,11 @@
-
+
swervelib.encoders Class Hierarchy
-
+
diff --git a/docs/swervelib/imu/ADIS16448Swerve.html b/docs/swervelib/imu/ADIS16448Swerve.html
index 18fa0d8..f1a7ec3 100644
--- a/docs/swervelib/imu/ADIS16448Swerve.html
+++ b/docs/swervelib/imu/ADIS16448Swerve.html
@@ -1,11 +1,11 @@
-
+
ADIS16448Swerve
-
+
diff --git a/docs/swervelib/imu/ADIS16470Swerve.html b/docs/swervelib/imu/ADIS16470Swerve.html
index 1d6e7a3..0d5fa0b 100644
--- a/docs/swervelib/imu/ADIS16470Swerve.html
+++ b/docs/swervelib/imu/ADIS16470Swerve.html
@@ -1,11 +1,11 @@
-
+
ADIS16470Swerve
-
+
diff --git a/docs/swervelib/imu/ADXRS450Swerve.html b/docs/swervelib/imu/ADXRS450Swerve.html
index 0e60a3b..b739a4d 100644
--- a/docs/swervelib/imu/ADXRS450Swerve.html
+++ b/docs/swervelib/imu/ADXRS450Swerve.html
@@ -1,11 +1,11 @@
-
+
ADXRS450Swerve
-
+
diff --git a/docs/swervelib/imu/AnalogGyroSwerve.html b/docs/swervelib/imu/AnalogGyroSwerve.html
index 160f03f..b427f7a 100644
--- a/docs/swervelib/imu/AnalogGyroSwerve.html
+++ b/docs/swervelib/imu/AnalogGyroSwerve.html
@@ -1,11 +1,11 @@
-
+
AnalogGyroSwerve
-
+
diff --git a/docs/swervelib/imu/NavXSwerve.html b/docs/swervelib/imu/NavXSwerve.html
index 30f68ab..7343ab1 100644
--- a/docs/swervelib/imu/NavXSwerve.html
+++ b/docs/swervelib/imu/NavXSwerve.html
@@ -1,11 +1,11 @@
-
+
NavXSwerve
-
+
diff --git a/docs/swervelib/imu/Pigeon2Swerve.html b/docs/swervelib/imu/Pigeon2Swerve.html
index ddfe6d9..eb1d6c6 100644
--- a/docs/swervelib/imu/Pigeon2Swerve.html
+++ b/docs/swervelib/imu/Pigeon2Swerve.html
@@ -1,11 +1,11 @@
-
+
Pigeon2Swerve
-
+
diff --git a/docs/swervelib/imu/PigeonSwerve.html b/docs/swervelib/imu/PigeonSwerve.html
index 04941d2..6f2a820 100644
--- a/docs/swervelib/imu/PigeonSwerve.html
+++ b/docs/swervelib/imu/PigeonSwerve.html
@@ -1,11 +1,11 @@
-
+
PigeonSwerve
-
+
diff --git a/docs/swervelib/imu/SwerveIMU.html b/docs/swervelib/imu/SwerveIMU.html
index 7c54148..d4f7aad 100644
--- a/docs/swervelib/imu/SwerveIMU.html
+++ b/docs/swervelib/imu/SwerveIMU.html
@@ -1,11 +1,11 @@
-
+
SwerveIMU
-
+
diff --git a/docs/swervelib/imu/package-summary.html b/docs/swervelib/imu/package-summary.html
index 64ba25f..9fac4f7 100644
--- a/docs/swervelib/imu/package-summary.html
+++ b/docs/swervelib/imu/package-summary.html
@@ -1,11 +1,11 @@
-
+
swervelib.imu
-
+
diff --git a/docs/swervelib/imu/package-tree.html b/docs/swervelib/imu/package-tree.html
index cb1a781..050186a 100644
--- a/docs/swervelib/imu/package-tree.html
+++ b/docs/swervelib/imu/package-tree.html
@@ -1,11 +1,11 @@
-
+
swervelib.imu Class Hierarchy
-
+
diff --git a/docs/swervelib/math/Matter.html b/docs/swervelib/math/Matter.html
index 9fb9db9..e62d30b 100644
--- a/docs/swervelib/math/Matter.html
+++ b/docs/swervelib/math/Matter.html
@@ -1,11 +1,11 @@
-
+
Matter
-
+
diff --git a/docs/swervelib/math/SwerveMath.html b/docs/swervelib/math/SwerveMath.html
index 0f430a7..3adc36b 100644
--- a/docs/swervelib/math/SwerveMath.html
+++ b/docs/swervelib/math/SwerveMath.html
@@ -1,11 +1,11 @@
-
+
SwerveMath
-
+
@@ -162,38 +162,45 @@ loadScripts(document, 'script');
Calculate the meters per rotation for the integrated encoder.
-static SwerveModuleConfiguration
-getSwerveModule(SwerveModule[] modules,
+static edu.wpi.first.math.controller.SimpleMotorFeedforward
+createDriveFeedforward(double optimalVoltage,
+ double maxSpeed,
+ double wheelGripCoefficientOfFriction)
+
+Create the drive feedforward for swerve modules.
+
+static SwerveModuleConfiguration
+getSwerveModule(SwerveModule[] modules,
boolean front,
boolean left)
-
+
Get the fruthest module from center based on the module locations.
-static edu.wpi.first.math.geometry.Translation2d
-limitVelocity(edu.wpi.first.math.geometry.Translation2d commandedVelocity,
+static edu.wpi.first.math.geometry.Translation2d
+limitVelocity(edu.wpi.first.math.geometry.Translation2d commandedVelocity,
edu.wpi.first.math.kinematics.ChassisSpeeds fieldVelocity,
edu.wpi.first.math.geometry.Pose2d robotPose,
double loopTime,
double robotMass,
List<Matter> matter,
SwerveDriveConfiguration config)
-
+
Limits a commanded velocity to prevent exceeding the maximum acceleration given by calcMaxAccel(edu.wpi.first.math.geometry.Rotation2d, java.util.List<swervelib.math.Matter>, double, swervelib.parser.SwerveDriveConfiguration).
-static double
-normalizeAngle(double angle)
-
+static double
+normalizeAngle(double angle)
+
Normalize an angle to be within 0 to 360.
-static double
-placeInAppropriate0To360Scope(double scopeReference,
+static double
+placeInAppropriate0To360Scope(double scopeReference,
double newAngle)
-
+
Put an angle within the 360 deg scope of a reference.
-static edu.wpi.first.math.geometry.Twist2d
-PoseLog(edu.wpi.first.math.geometry.Pose2d transform)
-
+static edu.wpi.first.math.geometry.Twist2d
+PoseLog(edu.wpi.first.math.geometry.Pose2d transform)
+
Logical inverse of the Pose exponential from 254.
@@ -276,6 +283,24 @@ loadScripts(document, 'script');
-
+
+createDriveFeedforward
+public static edu.wpi.first.math.controller.SimpleMotorFeedforward createDriveFeedforward(double optimalVoltage,
+ double maxSpeed,
+ double wheelGripCoefficientOfFriction)
+Create the drive feedforward for swerve modules.
+
+- Parameters:
+optimalVoltage - Optimal voltage to calculate kV (voltage/max Velocity)
+maxSpeed - Maximum velocity in meters per second to use for the feed forward, should be
+ as close to physical max as possible.
+wheelGripCoefficientOfFriction - Wheel grip coefficient of friction for kA (voltage/(cof*9.81))
+- Returns:
+- Drive feedforward for drive motor on a swerve module.
+
+
+
+-
calculateDegreesPerSteeringRotation
public static double calculateDegreesPerSteeringRotation(double angleGearRatio,
@@ -448,7 +473,7 @@ loadScripts(document, 'script');
- Parameters:
moduleState - Current SwerveModuleState requested.
lastModuleState - Previous SwerveModuleState used.
-maxSpeed - Maximum speed of the modules, should be in SwerveDriveConfiguration.maxSpeed.
+maxSpeed - Maximum speed of the modules.
diff --git a/docs/swervelib/math/package-summary.html b/docs/swervelib/math/package-summary.html
index 6540264..0b90eb8 100644
--- a/docs/swervelib/math/package-summary.html
+++ b/docs/swervelib/math/package-summary.html
@@ -1,11 +1,11 @@
-
+
swervelib.math
-
+
diff --git a/docs/swervelib/math/package-tree.html b/docs/swervelib/math/package-tree.html
index 35ea833..eed75fe 100644
--- a/docs/swervelib/math/package-tree.html
+++ b/docs/swervelib/math/package-tree.html
@@ -1,11 +1,11 @@
-
+
swervelib.math Class Hierarchy
-
+
diff --git a/docs/swervelib/motors/SparkMaxBrushedMotorSwerve.html b/docs/swervelib/motors/SparkMaxBrushedMotorSwerve.html
index eedf591..8204c42 100644
--- a/docs/swervelib/motors/SparkMaxBrushedMotorSwerve.html
+++ b/docs/swervelib/motors/SparkMaxBrushedMotorSwerve.html
@@ -1,11 +1,11 @@
-
+
SparkMaxBrushedMotorSwerve
-
+
diff --git a/docs/swervelib/motors/SparkMaxSwerve.SparkMAX_slotIdx.html b/docs/swervelib/motors/SparkMaxSwerve.SparkMAX_slotIdx.html
index 0b0d274..5c8dab0 100644
--- a/docs/swervelib/motors/SparkMaxSwerve.SparkMAX_slotIdx.html
+++ b/docs/swervelib/motors/SparkMaxSwerve.SparkMAX_slotIdx.html
@@ -1,11 +1,11 @@
-
+
SparkMaxSwerve.SparkMAX_slotIdx
-
+
diff --git a/docs/swervelib/motors/SparkMaxSwerve.html b/docs/swervelib/motors/SparkMaxSwerve.html
index ccade8d..4c86c53 100644
--- a/docs/swervelib/motors/SparkMaxSwerve.html
+++ b/docs/swervelib/motors/SparkMaxSwerve.html
@@ -1,11 +1,11 @@
-
+
SparkMaxSwerve
-
+
diff --git a/docs/swervelib/motors/SwerveMotor.html b/docs/swervelib/motors/SwerveMotor.html
index 34af854..dab068a 100644
--- a/docs/swervelib/motors/SwerveMotor.html
+++ b/docs/swervelib/motors/SwerveMotor.html
@@ -1,11 +1,11 @@
-
+
SwerveMotor
-
+
diff --git a/docs/swervelib/motors/TalonFXSwerve.html b/docs/swervelib/motors/TalonFXSwerve.html
index f70195d..5ad8938 100644
--- a/docs/swervelib/motors/TalonFXSwerve.html
+++ b/docs/swervelib/motors/TalonFXSwerve.html
@@ -1,11 +1,11 @@
-
+
TalonFXSwerve
-
+
diff --git a/docs/swervelib/motors/TalonSRXSwerve.html b/docs/swervelib/motors/TalonSRXSwerve.html
index d12ddff..014def2 100644
--- a/docs/swervelib/motors/TalonSRXSwerve.html
+++ b/docs/swervelib/motors/TalonSRXSwerve.html
@@ -1,11 +1,11 @@
-
+
TalonSRXSwerve
-
+
diff --git a/docs/swervelib/motors/package-summary.html b/docs/swervelib/motors/package-summary.html
index 08846eb..f5ba064 100644
--- a/docs/swervelib/motors/package-summary.html
+++ b/docs/swervelib/motors/package-summary.html
@@ -1,11 +1,11 @@
-
+
swervelib.motors
-
+
diff --git a/docs/swervelib/motors/package-tree.html b/docs/swervelib/motors/package-tree.html
index 58890a1..3fbe8ea 100644
--- a/docs/swervelib/motors/package-tree.html
+++ b/docs/swervelib/motors/package-tree.html
@@ -1,11 +1,11 @@
-
+
swervelib.motors Class Hierarchy
-
+
diff --git a/docs/swervelib/package-summary.html b/docs/swervelib/package-summary.html
index e6a09a9..5b3fbb3 100644
--- a/docs/swervelib/package-summary.html
+++ b/docs/swervelib/package-summary.html
@@ -1,11 +1,11 @@
-
+
swervelib
-
+
diff --git a/docs/swervelib/package-tree.html b/docs/swervelib/package-tree.html
index 0f6b1f3..efb96e0 100644
--- a/docs/swervelib/package-tree.html
+++ b/docs/swervelib/package-tree.html
@@ -1,11 +1,11 @@
-
+
swervelib Class Hierarchy
-
+
diff --git a/docs/swervelib/parser/PIDFConfig.html b/docs/swervelib/parser/PIDFConfig.html
index a1f7c47..79bd299 100644
--- a/docs/swervelib/parser/PIDFConfig.html
+++ b/docs/swervelib/parser/PIDFConfig.html
@@ -1,11 +1,11 @@
-
+
PIDFConfig
-
+
diff --git a/docs/swervelib/parser/SwerveControllerConfiguration.html b/docs/swervelib/parser/SwerveControllerConfiguration.html
index 252ca43..ed0d78f 100644
--- a/docs/swervelib/parser/SwerveControllerConfiguration.html
+++ b/docs/swervelib/parser/SwerveControllerConfiguration.html
@@ -1,11 +1,11 @@
-
+
SwerveControllerConfiguration
-
+
@@ -102,11 +102,6 @@ loadScripts(document, 'script');
Maximum angular velocity in rad/s
-double
-
-
-Maximum robot speed in meters per second.
-
@@ -118,14 +113,16 @@ loadScripts(document, 'script');
Constructor
Description
-SwerveControllerConfiguration(SwerveDriveConfiguration driveCfg,
- PIDFConfig headingPIDF)
+SwerveControllerConfiguration(SwerveDriveConfiguration driveCfg,
+ PIDFConfig headingPIDF,
+ double maxSpeedMPS)
Construct the swerve controller configuration.
-SwerveControllerConfiguration(SwerveDriveConfiguration driveCfg,
+SwerveControllerConfiguration(SwerveDriveConfiguration driveCfg,
PIDFConfig headingPIDF,
- double angleJoyStickRadiusDeadband)
+ double angleJoyStickRadiusDeadband,
+ double maxSpeedMPS)
Construct the swerve controller configuration.
@@ -165,13 +162,6 @@ loadScripts(document, 'script');
-
-
-maxSpeed
-public double maxSpeed
-Maximum robot speed in meters per second.
-
-
--
maxAngularVelocity
public double maxAngularVelocity
@@ -187,31 +177,36 @@ loadScripts(document, 'script');
Constructor Details
-
-
+
SwerveControllerConfiguration
public SwerveControllerConfiguration(SwerveDriveConfiguration driveCfg,
PIDFConfig headingPIDF,
- double angleJoyStickRadiusDeadband)
+ double angleJoyStickRadiusDeadband,
+ double maxSpeedMPS)
Construct the swerve controller configuration.
- Parameters:
-driveCfg - Drive configuration.
headingPIDF - Heading PIDF configuration.
angleJoyStickRadiusDeadband - Deadband on radius of angle joystick.
+maxSpeedMPS - Maximum speed in meters per second for angular velocity, remember if you have
+ feet per second use Units.feetToMeters(double).
-
-
+
SwerveControllerConfiguration
+ PIDFConfig headingPIDF,
+ double maxSpeedMPS)
Construct the swerve controller configuration. Assumes hypotenuse deadband of 0.5 (minimum radius for angle to be
set on angle joystick is .5 of the controller).
- Parameters:
driveCfg - Drive configuration.
headingPIDF - Heading PIDF configuration.
+maxSpeedMPS - Maximum speed in meters per second for angular velocity, remember if you have feet per second
+ use Units.feetToMeters(double).
diff --git a/docs/swervelib/parser/SwerveDriveConfiguration.html b/docs/swervelib/parser/SwerveDriveConfiguration.html
index d80df03..5087f5d 100644
--- a/docs/swervelib/parser/SwerveDriveConfiguration.html
+++ b/docs/swervelib/parser/SwerveDriveConfiguration.html
@@ -1,11 +1,11 @@
-
+
SwerveDriveConfiguration
-
+
@@ -91,16 +91,6 @@ loadScripts(document, 'script');
Modifier and Type
Field
Description
-double
-
-
-Max module speed in meters per second.
-
-double
-
-
-Max module speed in meters per second.
-
@@ -111,26 +101,26 @@ loadScripts(document, 'script');
Invert the imu measurements.
-double
-
+int
+
-Max module speed in meters per second.
-
-int
-
-
Number of modules on the robot.
-edu.wpi.first.math.geometry.Translation2d[]
-
-
+edu.wpi.first.math.geometry.Translation2d[]
+
+
Swerve Module locations.
-
-
-
+
+
+
Swerve Modules.
+
+
+
+Physical characteristics of the swerve drive from physicalproperties.json.
+
@@ -142,10 +132,11 @@ loadScripts(document, 'script');
Constructor
Description
-SwerveDriveConfiguration(SwerveModuleConfiguration[] moduleConfigs,
+SwerveDriveConfiguration(SwerveModuleConfiguration[] moduleConfigs,
SwerveIMU swerveIMU,
- double maxSpeed,
- boolean invertedIMU)
+ boolean invertedIMU,
+ edu.wpi.first.math.controller.SimpleMotorFeedforward driveFeedforward,
+ SwerveModulePhysicalCharacteristics physicalCharacteristics)
Create swerve drive configuration.
@@ -164,7 +155,8 @@ loadScripts(document, 'script');
Method
Description
-createModules(SwerveModuleConfiguration[] swerves)
+createModules(SwerveModuleConfiguration[] swerves,
+ edu.wpi.first.math.controller.SimpleMotorFeedforward driveFeedforward)
Create modules based off of the SwerveModuleConfiguration.
@@ -207,27 +199,6 @@ loadScripts(document, 'script');
-
-
-maxSpeed
-public double maxSpeed
-Max module speed in meters per second.
-
-
--
-
-attainableMaxTranslationalSpeedMetersPerSecond
-public double attainableMaxTranslationalSpeedMetersPerSecond
-Max module speed in meters per second.
-
-
--
-
-attainableMaxRotationalVelocityRadiansPerSecond
-public double attainableMaxRotationalVelocityRadiansPerSecond
-Max module speed in meters per second.
-
-
--
moduleCount
public int moduleCount
@@ -241,6 +212,13 @@ loadScripts(document, 'script');
Swerve Modules.
+-
+
+physicalCharacteristics
+
+Physical characteristics of the swerve drive from physicalproperties.json.
+
+
@@ -250,19 +228,20 @@ loadScripts(document, 'script');
Constructor Details
-
-
+
SwerveDriveConfiguration
public SwerveDriveConfiguration(SwerveModuleConfiguration[] moduleConfigs,
SwerveIMU swerveIMU,
- double maxSpeed,
- boolean invertedIMU)
+ boolean invertedIMU,
+ edu.wpi.first.math.controller.SimpleMotorFeedforward driveFeedforward,
+ SwerveModulePhysicalCharacteristics physicalCharacteristics)
Create swerve drive configuration.
- Parameters:
moduleConfigs - Module configuration.
swerveIMU - Swerve IMU.
-maxSpeed - Max speed of the robot in meters per second.
invertedIMU - Invert the IMU.
+driveFeedforward - The drive motor feedforward to use for the SwerveModule.
@@ -275,13 +254,16 @@ loadScripts(document, 'script');
Method Details
-
-
+
createModules
-
+public SwerveModule[] createModules(SwerveModuleConfiguration[] swerves,
+ edu.wpi.first.math.controller.SimpleMotorFeedforward driveFeedforward)
Create modules based off of the SwerveModuleConfiguration.
- Parameters:
swerves - Swerve constants.
+driveFeedforward - Drive feedforward created using
+ SwerveMath.createDriveFeedforward(double, double, double).
- Returns:
- Swerve Modules.
diff --git a/docs/swervelib/parser/SwerveModuleConfiguration.html b/docs/swervelib/parser/SwerveModuleConfiguration.html
index b72f3ad..577e06b 100644
--- a/docs/swervelib/parser/SwerveModuleConfiguration.html
+++ b/docs/swervelib/parser/SwerveModuleConfiguration.html
@@ -1,11 +1,11 @@
-
+
SwerveModuleConfiguration
-
+
@@ -16,11 +16,7 @@
-