  It is promising but challenging to design flocking control for a robot swarm
to autonomously follow changing patterns or shapes in a optimal distributed
manner. The optimal flocking control with dynamic pattern formation is,
therefore, investigated in this paper. A predictive flocking control algorithm
is proposed based on a Gibbs random field (GRF), where bio-inspired potential
energies are used to charaterize ``robot-robot'' and ``robot-environment''
interactions. Specialized performance-related energies, e.g., motion
smoothness, are introduced in the proposed design to improve the flocking
behaviors. The optimal control is obtained by maximizing a posterior
distribution of a GRF. A region-based shape control is accomplished for pattern
formation in light of a mean shift technique. The proposed algorithm is
evaluated via the comparison with two state-of-the-art flocking control methods
in an environment with obstacles. Both numerical simulations and real-world
experiments are conducted to demonstrate the efficiency of the proposed design.
