Modular robots offer the possibility to design robots with a high diversity of shapes and functionalities. This nice feature also brings an important challenge: namely how to design efficient locomotion gaits for arbitrary robot structures with many degrees of freedom. In this paper, we present a framework that allows one to explore and identify highly different gaits for a given arbitraryshaped modular robot. For this, we use simulated robots made of several Roombots modules that have three rotational joints each. These modules have as interesting feature that they can produce both oscillatory movements (i.e. periodic movements around a rest position) and rotational movements (i.e. with continuously increasing angle), leading to very rich locomotion patterns. Here we ask ourselves which types of movements — purely oscillatory, purely rotational, or a combination of both— lead to the fastest gaits. To address this question we designed a control architecture based on a distributed system of coupled phase oscillators that can produce synchronized rotations and oscillations in many degrees of freedom. We also designed a specific optimization algorithm that can automatically design hybrid controllers, i.e. controllers that use oscillations in some joints and rotations in others, for fast gaits. The proposed framework is verified through multiple simulations for several robot morphologies. The results show that (i) the question whether it is better to oscillate or to rotate depends on the morphology of the robot, and that in general it is best to do both, (ii) the optimization framework can successfully generate hybrid controllers that outperform purely oscillatory and purely rotational ones, and (iii) the resulting gaits are fast, innovative, and would have been hard to design by hand