Learning compositional models of robot skills for task and motion planning