Text this: Real-Time Optimal Control Technique of A Rotary Inverted Pendulum System