Control of an inverted pendulum model using LQR with two feedback loops