Hardware and Software-in-the-Loop Simulation of an Unmanned Aerial Vehicle