swerve Drive
fun swerveDrive(gyroId: Int, canBus: CANBus = CANBus.roboRIO(), block: SwerveDriveBuilder.() -> Unit): SwerveDrive
Creates a swerve drive subsystem with a DSL for module configuration.
Usage Example:
val drive = swerveDrive(gyroId = 0) {
modules(
frontLeft = module(1, 2, 3, Rotation2d.fromDegrees(0.0)),
frontRight = module(4, 5, 6, Rotation2d.fromDegrees(90.0)),
backLeft = module(7, 8, 9, Rotation2d.fromDegrees(180.0)),
backRight = module(10, 11, 12, Rotation2d.fromDegrees(270.0))
)
config {
trackWidthMeters = 0.6
wheelBaseMeters = 0.6
maxLinearVelocityMPS = 4.5
}
}Content copied to clipboard