Class SwerveDriveConfig
java.lang.Object
yams.core.mechanisms.config.SwerveDriveConfig<SwerveDriveConfig>
yams.commands2.config.SwerveDriveConfig
Command-based extension of
SwerveDriveConfig that adds the
Subsystem 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.command2.Subsystem swerveSubsystem, SwerveModule... modules) Create theSwerveDriveConfigfor theSwerveDrive -
Method Summary
Modifier and TypeMethodDescriptionclone()Clone theSwerveDriveConfigwithout modules, subsystem, telemetry name, gyro supplier, gyro angular velocity supplier, gyro offset, and gyro inversion.org.wpilib.command2.SubsystemGet the swerve drive subsystem.protected SwerveDriveConfigself()Get this config as its concrete type, so chainedwithcalls keep the subclass type.withSubsystem(org.wpilib.command2.Subsystem subsystem) Define aSubsystemfor 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:
swerveSubsystem- SwerveDrive subsystem.modules-SwerveModules for the swerve drive.
-
SwerveDriveConfig
public SwerveDriveConfig()Create theSwerveDriveConfigfor theSwerveDrive- Implementation Note:
- Must define a Subsystem with
withSubsystem(Subsystem)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, subsystem, telemetry name, gyro supplier, gyro angular velocity supplier, gyro offset, and gyro inversion.- Specified by:
clonein classSwerveDriveConfig<SwerveDriveConfig>- Returns:
- New
SwerveDriveConfig
-
withSubsystem
Define aSubsystemfor theSwerveDrive- Parameters:
subsystem-Subsystemfor the swerve drive.- Returns:
SwerveDriveConfigfor chaining.
-
getSubsystem
public org.wpilib.command2.Subsystem getSubsystem()Get the swerve drive subsystem.- Returns:
- Swerve drive subsystem.
-