Self-Supervised Learning for Control and Planning