Dynamic analysis and control of gyroscopic inverted pendulum