Class SwerveDriveConfig
java.lang.Object
yams.core.mechanisms.config.SwerveDriveConfig<SwerveDriveConfig>
yams.commands3.config.SwerveDriveConfig
Command-based extension of
SwerveDriveConfig that adds the
Mechanism binding.
Usage Example
// Build each SwerveModule (see SwerveModuleConfig for per-module setup), then:
SwerveDriveConfig config = new SwerveDriveConfig(this, fl, fr, bl, br)
.withGyro(gyro::getRotation3d)
.withMaximumChassisSpeed(MetersPerSecond.of(4.5), DegreesPerSecond.of(360))
.withTranslationController(new PIDController(1.0, 0, 0))
.withRotationController(new PIDController(1.0, 0, 0))
.withStartingPose(new Pose2d());
SwerveDrive drive = new SwerveDrive(config);
-
Constructor Summary
ConstructorsConstructorDescriptionCreate theSwerveDriveConfigfor theSwerveDriveSwerveDriveConfig(org.wpilib.command3.Mechanism swerveMechanism, SwerveModule... modules) Create theSwerveDriveConfigfor theSwerveDrive -
Method Summary
Modifier and TypeMethodDescriptionclone()Clone theSwerveDriveConfigwithout modules, mechanism, telemetry name, gyro supplier, gyro angular velocity supplier, gyro offset, and gyro inversion.org.wpilib.command3.MechanismGet the swerve drive mechanism.protected SwerveDriveConfigself()Get this config as its concrete type, so chainedwithcalls keep the subclass type.withMechanism(org.wpilib.command3.Mechanism mechanism) Define aMechanismfor theSwerveDriveMethods inherited from class SwerveDriveConfig
cubeTranslation, getAntiTippingCorrection, getCenterOfRotation, getDiscretization, getGyroOffset, getGyroRotation3d, getInitialPose, getMaximumChassisAngularVelocity, getMaximumChassisLinearVelocity, getMaximumModuleLinearVelocity, getModules, getModuleStateOptimization, getRotationPID, getSwerveDriveTelemetryConfig, getTelemetryName, getTelemetryVerbosity, getTranslationPID, optimizeRobotRelativeChassisSpeeds, scaleTranslation, useExternalFeedbackSensor, withAntiTipping, withAntiTipping, withCenterOfRotation, withCenterOfRotation, withDiscretizationTime, withGyro, withGyroAngularVelocityScaleFactor, withGyroHeadingAxis, withGyroInverted, withGyroOffset, withGyroVelocity, withMaximumChassisSpeed, withMaximumModuleSpeed, withModules, withModuleStateOptimization, withRotationController, withSimDiscretizationTime, withSimGyroAngularVelocityScaleFactor, withSimRotationController, withSimTranslationController, withStartingPose, withTelemetry, withTelemetry, withTranslationController
-
Constructor Details
-
SwerveDriveConfig
Create theSwerveDriveConfigfor theSwerveDrive- Parameters:
swerveMechanism- SwerveDrive mechanism.modules-SwerveModules for the swerve drive.
-
SwerveDriveConfig
public SwerveDriveConfig()Create theSwerveDriveConfigfor theSwerveDrive- Implementation Note:
- Must define a Mechanism with
withMechanism(Mechanism)and modules withSwerveDriveConfig.withModules(SwerveModule...)
-
-
Method Details
-
self
Description copied from class:SwerveDriveConfigGet this config as its concrete type, so chainedwithcalls keep the subclass type.- Specified by:
selfin classSwerveDriveConfig<SwerveDriveConfig>- Returns:
- this
SwerveDriveConfig.
-
clone
Clone theSwerveDriveConfigwithout modules, mechanism, telemetry name, gyro supplier, gyro angular velocity supplier, gyro offset, and gyro inversion.- Specified by:
clonein classSwerveDriveConfig<SwerveDriveConfig>- Returns:
- New
SwerveDriveConfig
-
withMechanism
Define aMechanismfor theSwerveDrive- Parameters:
mechanism-Mechanismfor the swerve drive.- Returns:
SwerveDriveConfigfor chaining.
-
getMechanism
public org.wpilib.command3.Mechanism getMechanism()Get the swerve drive mechanism.- Returns:
- Swerve drive mechanism.
-