This commit is contained in:
ryan123rudder
2020-02-01 12:40:39 -07:00
parent 68eb59bdc6
commit 43a454f9de
3 changed files with 9 additions and 10 deletions
@@ -60,7 +60,7 @@ public class RobotContainer {
m_robotIntake.setDefaultCommand(new RunIntakeWithTriggers(m_robotIntake, getOperatorController()));
// continually sends updates to the Blinkin LED controller to keep the lights on
m_robotLED.setDefaultCommand(new RunCommand(() -> m_robotLED.updateLED(), m_robotLED));
m_robotShooter.setDefaultCommand(new RunCommand(() -> m_robotShooter.runDrumShooter(0), m_robotShooter));
m_robotShooter.setDefaultCommand(new RunCommand(() -> m_robotShooter.runDrumShooter(0.2), m_robotShooter));
}
/**
@@ -91,7 +91,7 @@ public class RobotContainer {
.whenPressed(new DriveAtVelocityPID(m_robotDrive, 2000));
new JoystickButton(getOperatorJoystick(), XboxController.X_BUTTON)
.whileHeld(new ShooterVelocityControlPID(m_robotShooter, 3200));
.whileHeld(new ShooterVelocityControlPID(m_robotShooter, 13200));
/*new JoystickButton(getDriverJoystick(), XboxController.LEFT_JOYSTICK_BUTTON)
.whenPressed(new InstantCommand(null, m_robotDrive));*/
@@ -31,8 +31,8 @@ public class ShooterVelocityControlPID extends CommandBase {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
System.err.println(m_shooter.m_shooterFalcon.getActiveTrajectoryVelocity());
m_shooter.runDrumShooterVelocityPID(m_targetVel, m_shooter.m_shooterFalcon.getActiveTrajectoryVelocity());
System.err.println(m_shooter.m_shooterFalcon.getSelectedSensorVelocity());
m_shooter.runDrumShooterVelocityPID(m_targetVel, m_shooter.m_shooterFalcon.getSelectedSensorVelocity());
}
// Called once the command ends or is interrupted.
@@ -79,11 +79,10 @@ public class Shooter extends SubsystemBase {
*/
public void runDrumShooterVelocityPID(double targetVel, double actualVel) {
velP = actualVel/targetVel;
if(velP < 0.1){
velP = 0.1;
}
double runSpeed = velP*(1-velP);
//System.err.println(runSpeed);
m_shooterFalcon.set(TalonFXControlMode.PercentOutput, runSpeed/*ShooterConstants.ENCODER_TICKS_PER_REV/600*/);
double runSpeed = actualVel + (20000*velP);
if (runSpeed > targetVel) {runSpeed = targetVel;}
System.err.println(velP + " " + runSpeed);
SmartDashboard.putNumber("shoot", actualVel);
m_shooterFalcon.set(TalonFXControlMode.Velocity, runSpeed);
}
}