  Unmanned Aerial Vehicles (UAVs) have significantly enhanced fog computing by
acting as both flexible computation platforms and communication mobile relays.
In this paper, we propose a holistic framework that jointly optimizes the total
latency and energy consumption for UAV-assisted fog computing in a
three-dimensional spatial domain with varying terrain elevations and dynamic
task generations. Our proposed framework considers three important and
interdependent modules: attitude control, trajectory planning, and task
assignment. We first establish a fuzzy proportional-integral-derivative control
model to determine the UAV's attitude. Then, we propose an enhanced Ant Colony
System (ACS) based algorithm, that includes a safety value and a decoupling
mechanism to overcome the convergence issue in classical ACS, to compute the
optimal UAV trajectory. Finally, we design an algorithm based on the Particle
Swarm Optimization technique, to determine where each offloaded task should be
executed. Under our proposed framework, the outcome of one module would affect
the decision-making in one other, providing a holistic perspective of the
system and thus leading to improved solutions. We demonstrate by extensive
simulation results that our proposed framework can significantly improve the
overall performance, measured by latency and energy consumption, compared to
existing baseline approaches.
