Package swervelib
Class SwerveDriveTest
java.lang.Object
swervelib.SwerveDriveTest
Class to perform tests on the swerve drive.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidangleModules(SwerveDrive swerveDrive, edu.wpi.first.math.geometry.Rotation2d moduleAngle) Set the angle of the modules to a givenRotation2dstatic voidcenterModules(SwerveDrive swerveDrive) Set the modules to center to 0.static doublefindCouplingRatio(SwerveDrive swerveDrive, double volts, boolean automatic) Find the coupling ratio for all modules.static doublefindDriveMotorKV(SwerveDrive swerveDrive, double minMovement, double testDelaySeconds, double maxVolts) Find the minimum amount of power required to move the swerve drive motors.static voidpowerAngleMotors(SwerveDrive swerveDrive, double percentage) Power the angle motors for the swerve drive to a set percentage.static voidpowerAngleMotorsVoltage(SwerveDrive swerveDrive, double volts) Power the angle motors for the swerve drive to a set voltage.static voidpowerDriveMotorsDutyCycle(SwerveDrive swerveDrive, double percentage) Power the drive motors for the swerve drive to a set duty cycle percentage.static voidpowerDriveMotorsVoltage(SwerveDrive swerveDrive, double volts) Power the drive motors for the swerve drive to a set voltage.
-
Constructor Details
-
SwerveDriveTest
public SwerveDriveTest()
-
-
Method Details
-
angleModules
public static void angleModules(SwerveDrive swerveDrive, edu.wpi.first.math.geometry.Rotation2d moduleAngle) Set the angle of the modules to a givenRotation2d- Parameters:
swerveDrive-SwerveDriveto use.moduleAngle-Rotation2dto set every module to.
-
powerDriveMotorsDutyCycle
Power the drive motors for the swerve drive to a set duty cycle percentage.- Parameters:
swerveDrive-SwerveDriveto control.percentage- Duty cycle percentage of voltage to send to drive motors.
-
powerAngleMotors
Power the angle motors for the swerve drive to a set percentage.- Parameters:
swerveDrive-SwerveDriveto control.percentage- DutyCycle percentage to send to angle motors.
-
powerDriveMotorsVoltage
Power the drive motors for the swerve drive to a set voltage.- Parameters:
swerveDrive-SwerveDriveto control.volts- DutyCycle percentage of voltage to send to drive motors.
-
powerAngleMotorsVoltage
Power the angle motors for the swerve drive to a set voltage.- Parameters:
swerveDrive-SwerveDriveto control.volts- Voltage to send to angle motors.
-
centerModules
Set the modules to center to 0.- Parameters:
swerveDrive- Swerve Drive to control.
-
findDriveMotorKV
public static double findDriveMotorKV(SwerveDrive swerveDrive, double minMovement, double testDelaySeconds, double maxVolts) Find the minimum amount of power required to move the swerve drive motors.- Parameters:
swerveDrive-SwerveDriveto control.minMovement- Minimum amount of movement to drive motors.testDelaySeconds- Time in seconds for the motor to move.maxVolts- The maximum voltage to send to drive motors.- Returns:
- minimum voltage required.
-
findCouplingRatio
Find the coupling ratio for all modules.- Parameters:
swerveDrive-SwerveDriveto operate with.volts- Voltage to send to angle motors to spin.automatic- Attempt to automatically spin the modules.- Returns:
- Average coupling ratio.
-