Miller's initial code for pd_controller.