Pdp inconsistent current reading

Last year we were able to use the current measurement from the pdp to indicate when our lift was at the top. This year, using similar code we are not getting the pdp to consistently display the current. We are putting a sufficient load at various times that we should see it change. It seems to pick a number and only display that number. Below are abreviated sections of the code we think should be making this work:

import edu.wpi.first.wpilibj.PowerDistributionPanel;

public class Robot extends TimedRobot {

PowerDistributionPanel pdp;


public void robotInit() {
chooser.setDefaultOption(“Default Auto”, defaultAuto);
chooser.addOption(“My Auto”, customAuto);
SmartDashboard.putData(“Auto choices”, chooser);

    pdp = new PowerDistributionPanel();


public void teleopPeriodic() {

    SmartDashboard.putBoolean("IMU_Connected", ahrs.isConnected());

    double xSpeed = driveJoystick.getX();
    double ySpeed = driveJoystick.getY();
    double zRotation = driveJoystick.getTwist();

    driveTrain.driveCartesian(ySpeed, xSpeed, zRotation);
    // kicker();

void intake() {
    if (buttonsJoystickButtons.isPressed(intakeDown)) {
        intakeMotor.set(ControlMode.PercentOutput, 0);
    } else if (driveJoystickButtons.isPressed(intakeUp)) {
            intakeMotor.set(ControlMode.PercentOutput, intakeMotorPower);

void lift() {

    double X = buttonsJoystick.getY();
    double x1 = X * liftPower;

    double Current = pdp.getCurrent(14);
    SmartDashboard.putNumber("Lift Current", Current);
    SmartDashboard.putNumber("Encoder ",enc.getRaw());


This probably wont help much but I know I have been told in the past the PDP updates very slowly. You could potentially use the motor controller instead to get the current.

I’m thinking we put a TalonSRX in place of the Spark and read/set current limits directly to the Talon.

We’ve never had luck with physical limit switches.

Thanks for the advice!

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