In formation-maintenance (formation control) tasks, robots maintain their relative position with respect to their peers, according to a desired geometric shape. Previous work has examined formation-maintenance algorithms, based on formation control graphs, that ensure the theoretical stability of the formation. However, an exponential number of stable controllers exists. Thus a key question is how to select (construct) a formation controller that optimizes desired properties, such as sensor usage. We present a novel representation of the sensing capabilities of robots in formations, using a monitoring multigraph. We first show that graph-theoretic techniques can then be used to efficiently compute optimal sensing policies that maintain a given formation, while minimizing sensing costs. In particular, separation-bearing (distance-angle) control targets are automatically constructed for each individual robot in the formation, taking into account its specific sensor morphology. Then, we present a protocol allowing control graphs to be switched on line, to allow robots to adjust to sensory failures. We report on results from comprehensive experiments with physical and simulated robots. The results show that the use of the dynamic protocol allows formations of real robots to move significantly faster and with greater precision, while reducing the number of formation failures, due to sensor limitations. We also evaluate the sensitivity of our approach to communication reliability, and discuss opportunities and challenges raised by our approach.