Constrained Dynamic Movement Primitives for Safe Learning of Motor Skills