abstract class SwerveDrive : Drive
This class provides the basic functionality of a swerve drive using SwerveKinematics.
kStatic
- additive constant feedforward
trackWidth
- lateral distance between pairs of wheels on different sides of the robot
wheelBase
- distance between pairs of wheels on the same side of the robot
class SwerveLocalizer : Localizer
Default localizer for swerve drives based on the drive encoder positions, module orientations, and (optionally) a heading sensor. |
SwerveDrive(kV: Double, kA: Double, kStatic: Double, trackWidth: Double, wheelBase: Double = trackWidth)
This class provides the basic functionality of a swerve drive using SwerveKinematics. |
open var localizer: Localizer
Localizer used to determine the evolution of poseEstimate. |
var externalHeading: Double
The robot's heading in radians as measured by an external sensor (e.g., IMU, gyroscope). |
|
var poseEstimate: Pose2d
The robot's current pose estimate. |
|
abstract val rawExternalHeading: Double
The raw heading used for computing externalHeading. Not affected by externalHeading setter. |
abstract fun getModuleOrientations(): List<Double>
Returns the current module orientations in radians. Orientations should exactly match the order in setModuleOrientations. |
|
abstract fun getWheelPositions(): List<Double>
Returns the positions of the wheels in linear distance units. Positions should exactly match the ordering in setMotorPowers. |
|
open fun setDrivePower(drivePower: Pose2d): Unit
Sets the current commanded drive state of the robot. Feedforward is not applied to drivePower. |
|
open fun setDriveSignal(driveSignal: DriveSignal): Unit
Sets the current commanded drive state of the robot. Feedforward is applied to driveSignal before it reaches the motors. |
|
abstract fun setModuleOrientations(frontLeft: Double, rearLeft: Double, rearRight: Double, frontRight: Double): Unit
Sets the module orientations. All values are in radians. |
|
abstract fun setMotorPowers(frontLeft: Double, rearLeft: Double, rearRight: Double, frontRight: Double): Unit
Sets the following motor powers (normalized voltages). All arguments are on the interval |
fun updatePoseEstimate(): Unit
Updates poseEstimate with the most recent positional change. |