© 2022, Emerald Publishing Limited.Purpose: This study aims to optimize autonomous performance (i.e. both longitudinal and lateral) and endurance of the quadrotor type aerial vehicle simultaneously depending on the autopilot gain coefficients and battery weight. Design/methodology/approach: Quadrotor design processes are critical to performance. Unmanned aerial vehicle durability is an important performance parameter. One of the factors affecting durability is the battery. Battery weight, energy capacity and discharge rate are important design parameters of the battery. In this study, proper autopilot gain coefficients and battery weight are obtained by using a stochastic optimization method named as simultaneous perturbation stochastic approximation (SPSA). Because there is no direct correlation between battery weight and battery energy density, artificial neural network (ANN) is benefited to obtain battery energy density corresponding to resulted battery weight found from SPSA algorithm. By using the SPSA algorithm optimum performance index is obtained, then obtained data is used for longitudinal and lateral autonomous flight simulations. Findings: With SPSA, the best proportional integrator and derivative (PID) coefficients and battery weight, energy efficiency and endurance were obtained in case of morphing. Research limitations/implications: It takes a long time to find the most suitable battery values depending on quadrotor endurance. However, this situation can be overcome with the proposed SPSA. Practical implications: It is very useful to determine quadrotor endurance, PID coefficients and morphing rate using the optimization method. Social implications: Determining quadrotor endurance, PID coefficients and morphing rate using the optimization method provides advantages in terms of time, cost and practicality. Originality/value: The proposed method improves quadrotor endurance. In addition, with the SPSA optimization method and ANN, the parameters required for endurance will be obtained faster and more securely. In addition, the energy density according to the battery weight also contributes to the clean environment and energy efficiency.