PLG Motor encoder not resetting with .reset()

We can talk to the encoder, getting outputs, getting positive and negative values, but they’re not resetting. We are using the TalonSRX but the DIO ports are going directly to the RIO.

[Solved: bad wiring, didn’t have the ground connected on the encoder.]

package frc.robot.subsystems;

import com.ctre.phoenix.motorcontrol.ControlMode;
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

public class TalonSRXSubsystem extends SubsystemBase {
    private TalonSRX motor2 = new TalonSRX(2);
    Encoder plgEncoder = new Encoder(4, 5);

    public TalonSRXSubsystem() {

    public void stopMotor2() {
        motor2.set(ControlMode.PercentOutput, 0);

    public void setPower2(double v2) {
        motor2.set(ControlMode.PercentOutput, v2);

    public void periodic() {
        SmartDashboard.putNumber("Encoder Distance", plgEncoder.getDistance());

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