Real-Time Determination And Inversion Of Vibration Modes For Control Of Elastic Inverted Pendulum