Regarding the command continuing to run between the robot being enabled/disabled:
Your command will only finish if the onTarget method returns true.
Code:
protected boolean isFinished() {
return Robot.pidelevator.onTarget();
}
When the robot is disabled commands aren't automatically disabled, the command is still trying to move the motors, the outputs to the motor controllers are disabled. So when you re-enable, the command continues to try to get the elevator to the setpoint.
Add something like:
Code:
Scheduler.getInstance().removeAll();
Scheduler.getInstance().disable();
in your disabled periodic() method inside your main robot class. This will disable any command that's active when the robot is disabled.