public class SwerveDrive
extends Drive
This class provides the basic functionality of a swerve drive using class SwerveKinematics
.
class SwerveKinematics
Modifier and Type | Class and Description |
---|---|
static class |
SwerveDrive.SwerveLocalizer
Default localizer for swerve drives based on the drive encoder positions, module orientations, and (optionally) a
heading sensor.
|
Constructor and Description |
---|
SwerveDrive(double kV,
double kA,
double kStatic,
double trackWidth,
double wheelBase)
This class provides the basic functionality of a swerve drive using
class SwerveKinematics . |
SwerveDrive(double kV,
double kA,
double kStatic,
double trackWidth)
This class provides the basic functionality of a swerve drive using
class SwerveKinematics . |
Modifier and Type | Method and Description |
---|---|
Localizer |
getLocalizer()
Localizer used to determine the evolution of
poseEstimate . |
java.util.List<java.lang.Double> |
getModuleOrientations()
Returns the current module orientations in radians. Orientations should exactly match the order in
setModuleOrientations . |
java.util.List<java.lang.Double> |
getWheelPositions()
Returns the positions of the wheels in linear distance units. Positions should exactly match the ordering in
setMotorPowers . |
void |
setDrivePower(Pose2d drivePower)
Sets the current commanded drive state of the robot. Feedforward is not applied to
drivePower . |
void |
setDriveSignal(DriveSignal driveSignal)
Sets the current commanded drive state of the robot. Feedforward is applied to
driveSignal before it reaches
the motors. |
void |
setLocalizer(Localizer p)
Localizer used to determine the evolution of
poseEstimate . |
void |
setModuleOrientations(double frontLeft,
double rearLeft,
double rearRight,
double frontRight)
Sets the module orientations. All values are in radians.
|
void |
setMotorPowers(double frontLeft,
double rearLeft,
double rearRight,
double frontRight)
Sets the following motor powers (normalized voltages). All arguments are on the interval
[-1.0, 1.0] . |
getExternalHeading, getLocalizer, getPoseEstimate, getRawExternalHeading, setDrivePower, setDriveSignal, setExternalHeading, setLocalizer, setPoseEstimate, updatePoseEstimate
@JvmOverloads public SwerveDrive(double kV, double kA, double kStatic, double trackWidth, double wheelBase)
This class provides the basic functionality of a swerve drive using class SwerveKinematics
.
kV
- velocity feedforwardkA
- acceleration feedforwardkStatic
- additive constant feedforwardtrackWidth
- lateral distance between pairs of wheels on different sides of the robotwheelBase
- distance between pairs of wheels on the same side of the robotclass SwerveKinematics
@JvmOverloads public SwerveDrive(double kV, double kA, double kStatic, double trackWidth)
This class provides the basic functionality of a swerve drive using class SwerveKinematics
.
kV
- velocity feedforwardkA
- acceleration feedforwardkStatic
- additive constant feedforwardtrackWidth
- lateral distance between pairs of wheels on different sides of the robotclass SwerveKinematics
@NotNull public Localizer getLocalizer()
Localizer used to determine the evolution of poseEstimate
.
poseEstimate
public void setLocalizer(@NotNull Localizer p)
Localizer used to determine the evolution of poseEstimate
.
poseEstimate
public void setDriveSignal(@NotNull DriveSignal driveSignal)
Sets the current commanded drive state of the robot. Feedforward is applied to driveSignal
before it reaches
the motors.
driveSignal
public void setDrivePower(@NotNull Pose2d drivePower)
Sets the current commanded drive state of the robot. Feedforward is not applied to drivePower
.
drivePower
public void setMotorPowers(double frontLeft, double rearLeft, double rearRight, double frontRight)
Sets the following motor powers (normalized voltages). All arguments are on the interval [-1.0, 1.0]
.
public void setModuleOrientations(double frontLeft, double rearLeft, double rearRight, double frontRight)
Sets the module orientations. All values are in radians.
@NotNull public java.util.List<java.lang.Double> getWheelPositions()
Returns the positions of the wheels in linear distance units. Positions should exactly match the ordering in
setMotorPowers
.
setMotorPowers
@NotNull public java.util.List<java.lang.Double> getModuleOrientations()
Returns the current module orientations in radians. Orientations should exactly match the order in
setModuleOrientations
.
setModuleOrientations