Text this: Safety-critical nonlinear optimal predictive control with adaptive error elimination algorithm for robotic system