Sir Henry Wheatley, 1st Baronet — army officer and courtier, 1777-1852