The tuning of PID controllers can essentially be posed as the problem of selecting open-loop zeros such as to obtain a desired system response. In this paper, the general case wherein stable open-loop system zeros can be cancelled is considered, allowing more freedom in placing open-loop zeros, as opposed to just two in the case of a PID controller. Similar to the PID controller, integrators are added in an outer loop, giving the controlled system desired input tracking and disturbance rejection properties. Plant poles can be placed, e.g., by optimization, in an inner loop, if desired. We assume that we can possibly only access the plant input and the plant output, thus a reduced order observer is included. Subsequently, optimal zeros in the outer loop are computed such as to minimize the deviation from a desired reference impulse response. Thus, the generalized PID controller is designed such that we can have any dynamic response of any order, a completely new transfer function in open loop, i.e., a new set of optimized zeros and a new set of selected or optimized poles. The closed loop is shown to be stable.