Using Bayesian Dynamical Systems for Motion Template Libraries