Learning and executing generalized robot plans