From 29cdf74ea12b52a182914ed21b878a0c9c79e051 Mon Sep 17 00:00:00 2001 From: mayabartels Date: Thu, 13 Feb 2020 18:57:11 -0800 Subject: [PATCH] PIDs fully added and tested for Neos When robot is enabled once after robot code is deplyed, the program works. But, after the robot is disabled and re-enabled, the neo attempts to stay at one position and PID loops will no longer run because the Neo is focused on one position. There were also several commands taken out when testing (ie. the idle shooter command) --- src/main/java/frc4388/robot/RobotContainer.java | 4 +++- .../java/frc4388/robot/subsystems/Shooter.java | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index d6c8a4d..1c6f0d8 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -137,9 +137,11 @@ public class RobotContainer { /* TEST shooter rotate PIDs */ new JoystickButton(getOperatorJoystick(), XboxController.Y_BUTTON) - .whileHeld(new RunCommand(() -> m_robotShooter.runAngleAdjustPID(1, 0.2, 0.0, 0.0, 0.0, 0.0, 1, -1))); + .whileHeld(new RunCommand(() -> m_robotShooter.runAngleAdjustPID(360, 0.2, 0.0, 0.0, 0.0, 0.0, 1, -1))); new JoystickButton(getOperatorJoystick(), XboxController.B_BUTTON) .whileHeld(new RunCommand(() -> m_robotShooter.runshooterRotatePID(360, 0.2, 0.0, 0.0, 0.0, 0.0, 1, -1))); + new JoystickButton(getOperatorJoystick(), XboxController.X_BUTTON) + .whileHeld(new RunCommand(() -> m_robotShooter.runshooterRotatePID(720, 0.2, 0.0, 0.0, 0.0, 0.0, 1, -1))); /* TEST for both commands above */ } diff --git a/src/main/java/frc4388/robot/subsystems/Shooter.java b/src/main/java/frc4388/robot/subsystems/Shooter.java index 7d2b87f..527bfa4 100644 --- a/src/main/java/frc4388/robot/subsystems/Shooter.java +++ b/src/main/java/frc4388/robot/subsystems/Shooter.java @@ -41,6 +41,10 @@ public class Shooter extends SubsystemBase { * Creates a new Shooter subsystem. */ public Shooter() { + //Testing purposes reseting gyros + resetGyroAngleAdj(); + resetGyroShooterRotate(); + m_shooterFalcon.configFactoryDefault(); m_shooterFalcon.setNeutralMode(NeutralMode.Coast); @@ -134,4 +138,16 @@ public class Shooter extends SubsystemBase { m_shooterRotatePIDController.setReference(targetAngle, ControlType.kPosition); } + + /* For Testing Purposes, reseting gyro for angle adjuster */ + public void resetGyroAngleAdj() + { + m_angleEncoder.setPosition(0); + } + + /* For Testing Purposes, reseting gyro for shooter rotation */ + public void resetGyroShooterRotate() + { + m_shooterRotateEncoder.setPosition(0); + } } \ No newline at end of file