Abstract A novel Generalized Udwadia-Kalaba (GUK) control method is proposed in this paper to effectively deal with the constraint-following problem with comprehensive constraints, be it equality constraints or inequality constraints. Fully considering the complex application scenario in practice which encompassed both clear and feasible trajectory, the equality constraints and inequality constraints are simultaneously applied to design rational and reliable controller. Specifically, a state transformation function is introduced to describe the inequality constraints. Further, the dynamic model with comprehensive constraints is established based on the GUK theory. Then, a corresponding constraint-following control is presented to render the system performance, uniform boundedness and uniform ultimate boundedness. The effectiveness of the GUK control is verfied by the stability analysis based on Lyapunov minimax approach and experimental verification of unmanned underwater vehicle (UUV). The desired control performances of UUV, constraint-following and collision avoidance, can be achieved. As an illustrative application, the UUV is designed to navigate through narrow sea trenches. Meanwhile, through comparative analysis with the linear quadratic regulator (LQR) method and Udwadia-Kalaba (UK) method, the superiority of this approach is demonstrated.