Abstract— Biological systems achieve amazing adaptive behavior with local agents performing simple sensing and actions. Modular robots with similar properties can potentially achieve self-adaptation tasks robustly. Inspired by this principle, we present a generalized distributed consensus framework for selfadaptation tasks in modular robotics. We demonstrate that a variety of modular robotic systems and tasks can be formulated within such a framework, including (1) an adaptive column that can adapt to external force, (2) a modular gripper that can manipulate fragile objects, and (3) a modular tetrahedral robot that can locomote towards a light source. We also show that control algorithms derived from this framework are provably correct. In real robot experiments, we demonstrate that such a control scheme is robust towards real world sensing and actuation noise. This framework can potentially be applied to a wide range of distributed robotics applications.