From 315ed227036526f0d831e02942c9ecc3076a9c43 Mon Sep 17 00:00:00 2001 From: aarav18 Date: Fri, 7 Feb 2020 17:02:43 -0700 Subject: [PATCH] Wrote Java Docs for PID Methods --- .../java/frc4388/robot/subsystems/Drive.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc4388/robot/subsystems/Drive.java b/src/main/java/frc4388/robot/subsystems/Drive.java index 6a79518..2a96a7c 100644 --- a/src/main/java/frc4388/robot/subsystems/Drive.java +++ b/src/main/java/frc4388/robot/subsystems/Drive.java @@ -269,7 +269,9 @@ public class Drive extends SubsystemBase { } /** - * Add your docs here. + * Initializes the drive train gains kP, kI, kD, and kF + * @param slot Either "Distance PID", "Velocity PID", "Motion Magic PID", or "Turning PID" + * @param gains A gains object which is the gains that are set for the slot */ public void setDriveTrainGains(String slot, Gains gains){ /* Distance */ @@ -319,7 +321,11 @@ public class Drive extends SubsystemBase { public void driveWithInput(double move, double steer){ m_driveTrain.arcadeDrive(move, steer); } - + /** + * Runs a position PID while driving straight (has not been tested) + * @param targetPos The position to drive to in units + * @param targetGyro The angle to drive at in units + */ public void runDriveStraightPositionPID(double targetPos, double targetGyro) { m_rightFrontMotor.selectProfileSlot(DriveConstants.SLOT_DISTANCE, DriveConstants.PID_PRIMARY); m_rightFrontMotor.selectProfileSlot(DriveConstants.SLOT_TURNING, DriveConstants.PID_TURN); @@ -330,7 +336,11 @@ public class Drive extends SubsystemBase { m_driveTrain.feedWatchdog(); } - + /** + * Runs velocity PID while driving straight + * @param targetVel The velocity to drive at in units + * @param targetGyro The angle to drive at in units + */ public void runDriveStraightVelocityPID(double targetVel, double targetGyro) { m_rightFrontMotor.selectProfileSlot(DriveConstants.SLOT_VELOCITY, DriveConstants.PID_PRIMARY); m_rightFrontMotor.selectProfileSlot(DriveConstants.SLOT_TURNING, DriveConstants.PID_TURN); @@ -341,7 +351,11 @@ public class Drive extends SubsystemBase { m_driveTrain.feedWatchdog(); } - + /** + * Runs motion magic PID while driving straight (has not been tested) + * @param targetPos The position to drive to in units + * @param targetGyro The angle to drive at in units + */ public void runMotionMagicPID(double targetPos, double targetGyro){ m_rightFrontMotor.selectProfileSlot(DriveConstants.SLOT_MOTION_MAGIC, DriveConstants.PID_PRIMARY); m_rightFrontMotor.selectProfileSlot(DriveConstants.SLOT_TURNING, DriveConstants.PID_TURN);