Inspired by the limited battery life of multi-rotor unmanned aerial vehicles (UAVs), this research investigated hierarchical real-time control of UAVs with the generation of energy-optimal reference trajectories. The goal was to design a reference generator and controller based on optimal-control theory that would guarantee energy consumption close to optimal with lower computational cost. First, a least-squares-estimation-(LSE) algorithm identified the parameters of the UAV mathematical model. Then, by considering a precise electrical model for the brushless DC motors and rest-to-rest maneuvers, the extraction of clear rules to compute the optimal mission time and generate ’energetic trajectories’ was performed. These rules emerged from analyzing the optimal-control strategy results that minimized the consumption over many simulations. Afterward, a hierarchical controller tracked those desired energetic trajectories identified as sub-optimal. Numerical experiments compared the results regarding trajectory tracking, energy performance index, and battery state of charge (SOC). A co-simulation framework consisting of commercial software tools, Simcenter Amesim for the physical modeling of the UAV, and Matlab-Simulink executed numerical simulations of the implemented controller.