goto 0 methods for hood + turret

This commit is contained in:
aarav18
2022-03-14 18:58:44 -06:00
parent 8a25b7c1d5
commit ed10b1e83f
4 changed files with 18 additions and 4 deletions
@@ -322,7 +322,7 @@ public class RobotContainer {
.whenPressed(new Shoot(m_robotSwerveDrive, m_robotBoomBoom, m_robotTurret, m_robotHood));*/
new JoystickButton(getOperatorController(), XboxController.Button.kA.value)
.whileHeld(new RunCommand(() -> m_robotTurret.runshooterRotatePID(-44 * ShooterConstants.TURRET_DEGREES_PER_ROT), m_robotTurret));
.whileHeld(new RunCommand(() -> m_robotTurret.runShooterRotatePID(-44 * ShooterConstants.TURRET_DEGREES_PER_ROT), m_robotTurret));
//B > Shoot with Lime
new JoystickButton(getOperatorController(), XboxController.Button.kB.value)
@@ -43,7 +43,7 @@ public class AimToCenter extends CommandBase {
@Override
public void execute() {
m_targetAngle = angleToCenter(x, y, m_drive.getRegGyro().getDegrees());
m_turret.runshooterRotatePID(m_targetAngle);
m_turret.runShooterRotatePID(m_targetAngle);
// Check if limelight is within range (comment out to disable vision odo)
if (Math.abs(m_turret.getBoomBoomAngleDegrees() - m_targetAngle) < VisionConstants.RANGE){
@@ -90,7 +90,14 @@ public class Hood extends SubsystemBase {
m_angleAdjusterMotor.set(input);
}
public void resetGyroAngleAdj(){
/**
* Run a PID to go to the zero position.
*/
public void gotoZero() {
runAngleAdjustPID(0);
}
public void resetGyroAngleAdj() {
m_angleEncoder.setPosition(0);
}
@@ -93,7 +93,7 @@ public class Turret extends SubsystemBase {
m_boomBoomRotateMotor.set(input * ShooterConstants.TURRET_SPEED_MULTIPLIER);
}
public void runshooterRotatePID(double targetAngle) {
public void runShooterRotatePID(double targetAngle) {
targetAngle = targetAngle / ShooterConstants.TURRET_DEGREES_PER_ROT;
m_boomBoomRotatePIDController.setReference(targetAngle, ControlType.kPosition);
}
@@ -102,6 +102,13 @@ public class Turret extends SubsystemBase {
m_boomBoomRotateEncoder.setPosition(0);
}
/**
* Run a PID to go to the zero position.
*/
public void gotoZero() {
runShooterRotatePID(0);
}
public double getboomBoomRotatePosition() {
return m_boomBoomRotateEncoder.getPosition();
}