Learning To Walk On Rough Terrain And Collision Localization For Legged Robots With Machine Learning