Motion Planning by Trajectory Smoothing with Motion Primitives