Trajectory Planning and Control for Robotic Magnetic Manipulation