From 572dd7c730f527c99a673b1070ea384ba0138ea1 Mon Sep 17 00:00:00 2001 From: Aarav Shah <91212@psdschools.org> Date: Thu, 13 Feb 2020 17:51:54 -0700 Subject: [PATCH] Took out straight from methods --- .../robot/commands/DriveStraightAtVelocityPID.java | 2 +- .../robot/commands/DriveStraightToPositionPID.java | 2 +- .../commands/DriveWithJoystickUsingDeadAssistPID.java | 2 +- src/main/java/frc4388/robot/subsystems/Drive.java | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/frc4388/robot/commands/DriveStraightAtVelocityPID.java b/src/main/java/frc4388/robot/commands/DriveStraightAtVelocityPID.java index 7b82ff8..14cc97e 100644 --- a/src/main/java/frc4388/robot/commands/DriveStraightAtVelocityPID.java +++ b/src/main/java/frc4388/robot/commands/DriveStraightAtVelocityPID.java @@ -37,7 +37,7 @@ public class DriveStraightAtVelocityPID extends CommandBase { @Override public void execute() { //System.err.println(m_drive.m_rightFrontMotor.getClosedLoopError(DriveConstants.PID_TURN)); - m_drive.runDriveStraightVelocityPID(-m_targetVel, m_targetGyro); + m_drive.runDriveVelocityPID(-m_targetVel, m_targetGyro); } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc4388/robot/commands/DriveStraightToPositionPID.java b/src/main/java/frc4388/robot/commands/DriveStraightToPositionPID.java index 0b9b998..3b74edf 100644 --- a/src/main/java/frc4388/robot/commands/DriveStraightToPositionPID.java +++ b/src/main/java/frc4388/robot/commands/DriveStraightToPositionPID.java @@ -47,7 +47,7 @@ public class DriveStraightToPositionPID extends CommandBase { //System.err.println("| \n Sensor Pos \n" + m_drive.m_rightFrontMotor.getSelectedSensorPosition(DriveConstants.PID_PRIMARY)); //System.err.println("Sensor Error \n" + m_drive.m_rightFrontMotor.getClosedLoopError(DriveConstants.PID_PRIMARY)); //System.err.println("Sensor Target \n" + m_drive.m_rightFrontMotor.getClosedLoopTarget(DriveConstants.PID_PRIMARY)); - m_drive.runDriveStraightPositionPID(m_targetPosOut, m_targetGyro); + m_drive.runDrivePositionPID(m_targetPosOut, m_targetGyro); } // Called once the command ends or is interrupted. diff --git a/src/main/java/frc4388/robot/commands/DriveWithJoystickUsingDeadAssistPID.java b/src/main/java/frc4388/robot/commands/DriveWithJoystickUsingDeadAssistPID.java index 0a7938e..7aaf5a9 100644 --- a/src/main/java/frc4388/robot/commands/DriveWithJoystickUsingDeadAssistPID.java +++ b/src/main/java/frc4388/robot/commands/DriveWithJoystickUsingDeadAssistPID.java @@ -96,7 +96,7 @@ public class DriveWithJoystickUsingDeadAssistPID extends CommandBase { } /* If the move stick is not being used */ else { - m_drive.runDriveStraightVelocityPID(0, m_targetGyro); + m_drive.runDriveVelocityPID(0, m_targetGyro); isAuxPIDEnabled = true; } } diff --git a/src/main/java/frc4388/robot/subsystems/Drive.java b/src/main/java/frc4388/robot/subsystems/Drive.java index 3cbf888..5db8a18 100644 --- a/src/main/java/frc4388/robot/subsystems/Drive.java +++ b/src/main/java/frc4388/robot/subsystems/Drive.java @@ -309,12 +309,12 @@ public class Drive extends SubsystemBase { } /** - * Runs position PID while driving straight. + * Runs position PID. * Position is absolute and displacement should be handled on the command side. * @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) { + public void runDrivePositionPID(double targetPos, double targetGyro) { m_rightFrontMotor.selectProfileSlot(DriveConstants.SLOT_DISTANCE, DriveConstants.PID_PRIMARY); m_rightFrontMotor.selectProfileSlot(DriveConstants.SLOT_TURNING, DriveConstants.PID_TURN); @@ -325,12 +325,12 @@ public class Drive extends SubsystemBase { } /** - * Runs velocity PID while driving straight + * Runs velocity PID * * @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) { + public void runDriveVelocityPID(double targetVel, double targetGyro) { m_rightFrontMotor.selectProfileSlot(DriveConstants.SLOT_VELOCITY, DriveConstants.PID_PRIMARY); m_rightFrontMotor.selectProfileSlot(DriveConstants.SLOT_TURNING, DriveConstants.PID_TURN); m_rightFrontMotor.set(TalonFXControlMode.Velocity, targetVel, DemandType.AuxPID, targetGyro); @@ -362,7 +362,7 @@ public class Drive extends SubsystemBase { public void runTurningPID(double targetAngle) { double targetGyro = (targetAngle / 360) * DriveConstants.TICKS_PER_GYRO_REV; - runDriveStraightVelocityPID(0, targetGyro); + runDriveVelocityPID(0, targetGyro); } /**