  This paper introduces a control architecture for real-time and onboard
control of Unmanned Aerial Vehicles (UAVs) in environments with obstacles using
the Model Predictive Path Integral (MPPI) methodology. MPPI allows the use of
the full nonlinear model of UAV dynamics and a more general cost function at
the cost of a high computational demand. To run the controller in real-time,
the sampling-based optimization is performed in parallel on a graphics
processing unit onboard the UAV. We propose an approach to the simulation of
the nonlinear system which respects low-level constraints, while also able to
dynamically handle obstacle avoidance, and prove that our methods are able to
run in real-time without the need for external computers. The MPPI controller
is compared to MPC and SE(3) controllers on the reference tracking task,
showing a comparable performance. We demonstrate the viability of the proposed
method in multiple simulation and real-world experiments, tracking a reference
at up to 44 km/h and acceleration close to 20 m/s^2, while still being able to
avoid obstacles. To the best of our knowledge, this is the first method to
demonstrate an MPPI-based approach in real flight.
