TalonFX Configs (Slot0 & Output)
We use Slot0Configs for PID/FF, plus output and motion configs. Gravity compensation type depends on mechanism.
Slot0Configs slot0 = new Slot0Configs();
slot0.kP = Gains.kP; slot0.kI = Gains.kI; slot0.kD = Gains.kD;
slot0.kS = Gains.kS; slot0.kV = Gains.kV; slot0.kG = Gains.kG;
slot0.GravityType = GravityTypeValue.Arm_Cosine; // or Elevator_Static
MotorOutputConfigs out = new MotorOutputConfigs()
.withInverted(InvertedValue.Clockwise_Positive)
.withPeakForwardDutyCycle(Constants.maxForward)
.withPeakReverseDutyCycle(Constants.maxReverse);
TalonFXConfiguration all = new TalonFXConfiguration();
all.Slot0 = slot0;
all.MotorOutput = out;
fx.getConfigurator().apply(all);
Tip: Use
StaticFeedforwardSignValue.UseClosedLoopSignfor elevators to keep kS direction consistent with setpoint sign.