In this study, invasive weed optimization (IWO) was used to investigate the optimum Q values of the linear quadratic regulator (LQR) for the inverted balance control of the Robogymnast. The Robogymnast is a triple-link pendulum developed to study control problems associated with complex underactuated mechanisms, particularly inverted pendulums. Built to exploit the natural dynamics of the mechanism, it mimics the human acrobat swinging from a high bar. Two motors, located on joint 2 (hips) and joint 3 (knees), control the movement of the mechanism. Joint 1 (hands/arms) is firmly attached to a freely rotating high bar mounted on ball bearings. The LQR is a popular and commonly used controller that employs feedback gains as part of its control mechanism. The main contribution of this paper is to demonstrate how the IWO can be used successfully to obtain the optimal Q values required by the LQR to maintain the Robogymnast in an upright configuration.