I am trying to use a PID command to get our robot to rotate so our vision target is centered on our camera, however, when run our PID command the output is always 0
here is our code if anyone knows how to fix this help would be appreciated
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot.commands;
import edu.wpi.first.wpilibj.controller.PIDController;
import edu.wpi.first.wpilibj2.command.PIDCommand;
import frc.robot.RobotContainer;
import edu.wpi.first.wpilibj.smartdashboard.*;
// NOTE: Consider using this command inline, rather than writing a subclass. For more
// information, see:
// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
public class VisionRotate extends PIDCommand {
/**
* Creates a new VisionRotate.
*/
public VisionRotate() {
super(
// The controller that the command will use
new PIDController(1, 0, 0),
// This should return the measurement
() -> RobotContainer.vision.getCenter(),
// This should return the setpoint (can also be a constant)
() -> 0,
// This uses the output
output -> {
SmartDashboard.putNumber("pidoutput", output);
});
getController().enableContinuousInput(-.3, .3);
getController().setTolerance(.005);
// Use addRequirements() here to declare subsystem dependencies.
// Configure additional PID options by calling `getController` here.
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
if (RobotContainer.vision.getCenter() > .005 & RobotContainer.vision.getCenter() < -.005) {
return false;
} else {
return true;
}
}
}