Learning a generative model for robot control using visual feedback