In this paper a method for the automatic generation of dynamics for modular robots is presented. A modular reconfigurable robot consists of link modules and joint modules of various specifications. We analyze the abstract architecture of modular robots. A total of nine types of connecting forms and three types of joint forms are identified with reference to their own systems. The geometric relationships are derived by the group theory. According to the modular idea, the formulations of the velocity, acceleration and other essential equations of the link module and the joint module are formed compensatively and recursively. Then the dynamic model is generated automatically by a compensative and recursive method.