Design Controllers
Controllers can be found in everything from rockets during liftoff to skyscrapers and Segways. By combining the Wolfram Language's control system framework with system models, control systems can easily be designed and tested. In this example, a controller to keep a Segway upright is designed, based on a linearized representation of the model.
Linearize a Segway model around the upright position by using the initial values from the model and extract the state variables you are interested in.
Define weight variables for the control design. Use a large penalty for deviations in the angle of the Segway (revolute1.phi).
Compute the gains for the LQ controller.
Save the computed values of the LQ controller to the model with a controller.
With the control parameters saved in the model, show a 3D animation in SystemModeler.