Controlling robots with multiple degrees of freedom (DOFs) is still an open and challenging issue, notably because planning complex, multidimensional trajectories in time-varying environments is a laborious and costly process. In this dissertation, we propose a control architecture where the planning consists in defining the key characteristics of the desired movement (e.g., the target for reaching), while the generation of the complete trajectory is based on predefined dynamics. More precisely, the generation of joint trajectories is decoupled from high-level planning (i.e., the definition of the task) through the use of a combination of discrete and rhythmic motor primitives, that is, movements with predefined dynamics. The concept of motor primitives is inspired by the study of the motor system of vertebrates: animals are capable not only of performing highly complex tasks in a robust way but also of rapidly adapting to changes or uncertainties in the environment. Interestingly, the planning of movements and the actual generation of trajectories are most likely decoupled in vertebrates: the actual spatio-temporal sequence of activation of the muscles is produced at the spinal level through neural networks called central pattern generators (CPGs). These networks are activated by simple, non-patterned control signals from the brain, that is, only the key parameters of the movement seems to be needed from the brain for a task to be completed. Here we develop a control architecture for the generation of both discrete and rhythmic movements based on motor primitives that has the following attributes (i) the planning phase is simplified thanks to the motor primitives, in the sense that the control commands that are required are reduced to the key characteristics of the movement, (ii) the implementation intrinsically ensures smooth transitions between different tasks (discrete and rhythmic) (iii) the dynamics of the motor primitives can be modulated by sensory feedback in order to have fast adaptive responses and (iv) several DOFs can be coupled together to ensure coordinated behaviors. In addition, this method has a low computational cost and is well-fitted for applications requiring fast control loops. We illustrate the efficiency of the architecture through two applications: (a) interactive drumming with the Hoap2 and the iCub and (b) infant-like crawling and reaching with the iCub.