We’ve used commands in the past. I’m trying to understand the new command framework. I’ve read a lot of the docs, but I don’t see how to start one of these new commands, particularly in auto mode. I saw the section on triggers and buttons, but what is the new analogy to the old autonomousCommand.start() ?
It could also be because I’m also trying to do a PIDCommand for the first time as well. We’re trying to use PID to center on the limelight target.
package frc.robot.commands;
import edu.wpi.first.wpilibj.controller.PIDController;
import edu.wpi.first.wpilibj2.command.PIDCommand;
import frc.robot.Robot;
import frc.robot.subsystems.*;
public class PIDDriveTrainAim extends PIDCommand {
public PIDDriveTrainAim( PIDDriveTrain drive) {
super(
// The controller that the command will use
new PIDController(1.0, 0, 0),
// This should return the measurement
() -> Robot.getLimelightXOffset(),
// This should return the setpoint (can also be a constant)
() -> 0,
// This uses the output
output -> drive.useOutput(output, 0 ),
// this requires the drive
drive
);
getController().setTolerance(0.1);
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return getController().atSetpoint();
}
}
Also, anyone know why cut & pasting from VS Code causes all the extra lines? Or is there a better way of formatting it here other than the preformatted text?