Obstacle Avoidance using Dynamic Movement Primitives and Reinforcement Learning