TalonFX Falcon 500 Shooter Follower Code Issues

Hello FRC programmers!

I am a programmer on team 4829. We recently tested our shooter code on our shooter mechanism, which has two motors. We wanted to use a follower object so that both motors would be moving together. However, when testing the code, the follower motor did not receive any voltage (marked by yellow LED on motor) while the leader motor did. This happened when were set both motors to a low voltage ~ 0.4 volts. I have our code posted below. Could anyone help resolve this issue?

Any help is greatly appreciated!

  public ShooterSubsystem() { 
    leaderFlywheel = new TalonFX(ShooterConstants.LEADER_FLYWHEEL_ID);
    followerFlywheel = new TalonFX(ShooterConstants.FOLLOWER_FLYWHEEL_ID);
    follower = new Follower(leaderFlywheel.getDeviceID(), true);

TalonFXConfiguration shooterConfig = new TalonFXConfiguration();
    shooterConfig.Slot0.kP = ShooterConstants.SHOOT_P;
    shooterConfig.Slot0.kI = ShooterConstants.SHOOT_I;
    shooterConfig.Slot0.kD = ShooterConstants.SHOOT_D;
    shooterConfig.Slot0.kS = ShooterConstants.SHOOT_S;
    shooterConfig.Slot0.kV = ShooterConstants.SHOOT_V;
    shooterConfig.Slot0.kA = ShooterConstants.SHOOT_A;
    shooterConfig.MotorOutput.NeutralMode = NeutralModeValue.Coast;
    shooterConfig.MotorOutput.Inverted = InvertedValue.CounterClockwise_Positive; 
    shooterConfig.MotorOutput.DutyCycleNeutralDeadband = HardwareConstants.MIN_FALCON_DEADBAND;
    leaderFlywheel.getConfigurator().apply(shooterConfig, HardwareConstants.TIMEOUT_S);


  public void setRPM(double leaderRPM) {
    VelocityVoltage leaderSpeed = new VelocityVoltage(leaderRPM / 60.0);
    leaderFlywheel.setControl(leaderSpeed);
    followerFlywheel.setControl(follower);

Not sure if this will solve the problem but the only difference between your code and my code is we are doing followerFlywheel.setControl(follower); in the constuctor and applying configs to both the follower and leader flywheels.

Thanks, we will get back once we try it out.

If you issue the follower control request in the constructor, AND you never call set_control() on the motor again, then it will follow just fine.

There’s definitely no need to to call it on a loop as long as you don’t use it in any other way.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.