Although the PID controller structure is widely and successfully used in industry, optimizing its parameters, especially in the face of complex systems, has always been challenging. In this paper, the use of a proportional-integral-derivative (PID) controller to control a model of a quadrotor with nonlinear dynamics is investigated. In this regard, after presenting the designed nonlinear dynamic quadrotor model, four distinct methods for adjusting the parameters of this controller are examined and compared. These four techniques, which are classified into two categories, online and offline, include online techniques of neural network and fuzzy inference, and offline techniques of genetic and particle swarm optimization algorithms. Finally according to the results of numerical simulations and the results of comparing a predefined squared cost function calculated in each case, in the presence of a relatively large disturbance with amplitude and frequency that is selected in the whole time simulation affects the system, shown in general, the order online algorithms, especially despite the mentioned disturbance, have better performance in controlling the dynamics of the system because they update the control coefficients of the closed-loop system momentarily in each step of numerical simulation. The simulation results are performed in MATLAB-Simulink environment and the results are visible.