In this paper, the weak points have been investigated, the proposal to solve them, the application of the solution and the comparison of the results in the mode of simulation and experimental testing have been discussed. For this purpose, a four-wheel mobile robot has been considered for simulation and implementation, and a linear quadratic regulator controller and a nonlinear model predictive controller have been used to control it. But the combination of these classic and modern controllers with machine learning can greatly help to make these controllers work more accurately; As a result, in order to increase the accuracy of the performance of these controllers, by training neural networks of multilayer perceptrons, the controllers have been made intelligent. Controllers with cost function have coefficients as weighting to the matrix of system state variables and control input, which are greatly affected by changing these two weighting matrices of problem solving and optimization. For this reason, it is necessary to extract these two matrices for each separate path in order to improve the performance of the controller by trial and error. But by applying the proposed network which is trained with a new algorithm, not only the performance accuracy has increased, but the network extracts these two matrices without the need to spend human energy. Also, in order to reduce the existing time delays, especially in the implementation of the nonlinear controller on the robot in the experimental mode, by training other neural networks to optimally extract the benefit of the forecast horizon, reducing the calculations and increasing the speed of the solution has been achieved. In the hardware part, by examining and using operators such as the pixy camera and the U2D2 interface, which are faster than the usual method, the solution time has been reduced.