Planning And Control In Face Of Uncertainty With Applications To Legged Robots