description |
---|
This one is a bit complicated |
YAGSL stores the maximum speed and uses it in the following functions
-
SwerveDriveKinematics.desaturateWheelSpeeds
-
SwerveMath.calculateMaxAngularVelocity
-
SwerveDriveTelemetry.maxSpeed
-
SwerveMath.antiJitter
-
SwerveMath.createDriveFeedforward
The maximum speed represents the physical maximum speed of the robot.
You can change your maximum speed by using SwerveDrive.setMaximumSpeed
the initial maximum speed is given in SwerveParser.createSwerveDrive
for initial values like the maximum angular velocity and drive feedforward and telemetry maximum speed.
{% hint style="info" %} The maximum speed in telemetry does not change because most widgets do not support this and it might break them! {% endhint %}
/**
* Initialize {@link SwerveDrive} with the directory provided.
*
* @param directory Directory of swerve drive config files.
*/
public SwerveSubsystem(File directory)
{
// Configure the Telemetry before creating the SwerveDrive to avoid unnecessary objects being created.
SwerveDriveTelemetry.verbosity = TelemetryVerbosity.HIGH;
swerveDrive = new SwerveParser(directory).createSwerveDrive(Constants.MAX_SPEED);
swerveDrive.setMaximumSpeed(Units.feetToMeters(12.4)); // 12.4ft/s to m/s
}