The paper is devoted to a problem of PI and PID controllers design intended to control tracking systems with linear single input single output (SISO) control plants. A quadratic cost function is selected as quality criterion to measure the controller performance. The design problem solution is reduced to an optimization procedure that is solved by a method similar to gradient conjugate approach (the direction on each optimization step is determined according to the mentioned method and the step length -- according to Armijo rule). Numerical examples demonstrate application of the proposed design algorithm to an used in practice benchmark model and to a quadcopter model obtained from the real experiment.