Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 14

State-Space Modeling of a Rotary Inverted Pendulum

Recommended resources

Hello! Welcome to the second lesson in our module on modeling MIMO systems.

In the last lesson, we established the general framework for representing MIMO systems in state-space and practiced deriving models from differential equations and block diagrams. Now, it's time to apply those skills to the system you're most interested in: the rotary inverted pendulum.

Today's learning outcome is to derive the state-space model for a rotary inverted pendulum. This is a cornerstone of the course, as this model will be the basis for all the analysis and controller design we do in the upcoming lessons. This system is a classic and challenging control problem because it's inherently unstable—like balancing a stick on your finger, but with rotational motion.

The System: A Rotary Inverted Pendulum

First, let's get a clear picture of the physical system we're dealing with.

SRV02 Rotary Inverted Pendulum Model with Equations
A diagram of a rotary inverted pendulum. The system consists of a motor-driven arm that rotates in the horizontal plane (angle \(\theta\)) and a pendulum attached to the end of the arm, which is free to swing (angle \(\alpha\)). The goal is to control the motor to keep the pendulum balanced upright.

As shown, the key components are:

  • A servo motor that applies a torque to a rotary arm.
  • A rotary arm of length that rotates horizontally. Its angle is denoted by .
  • A pendulum of length and mass attached to the end of the arm. Its angle relative to the vertical is .

Our control input will be the voltage applied to the motor, and the variables we want to control are the angles and .


Modeling Strategy

Deriving the model from first principles is a multi-step process:

  1. Mechanical Model: We'll start by applying physical laws (like Euler-Lagrange) to the arm and pendulum to get a set of coupled, nonlinear differential equations describing their motion.
  2. Electrical Model: We will then model the DC motor to find the relationship between the applied voltage (our actual input, ) and the torque () it produces. This step is crucial for a realistic model and connects directly to your background in electrical engineering.
  3. Combine and Linearize: We'll combine the electrical and mechanical models and then linearize the resulting nonlinear equations around the desired operating point (i.e., the pendulum balanced upright).
  4. State-Space Formulation: Finally, we'll arrange these linearized equations into the standard MIMO state-space form: .

The following resource provides a step-by-step derivation that follows this exact strategy.

CACSD Practical Session Rotary Inverted Pendulum

This guide, 'CACSD Practical Session Rotary Inverted Pendulum', walks through the complete physical modeling of the system. It's an excellent resource because it separates the mechanical and electrical parts before combining them.

Please read Sections 2.1 through 2.1.3 (from page 2 to the top of page 5). In 2.1.1, focus on the choice of state variables and the resulting nonlinear equations (5) and (6). You don't need to re-derive the Euler-Lagrange equations yourself; focus on understanding what the terms in the final equations represent. In 2.1.2, pay close attention to Equation (7). This is the key link between the motor voltage and the mechanical torque. In 2.1.3, follow how the nonlinear equations are simplified (linearized) and then rearranged to create the final A and B matrices.


Deconstructing the Model Derivation

Let's summarize the key stages from the document you just read.

1. Nonlinear Equations of Motion

The document uses the Euler-Lagrange method to arrive at two coupled, second-order nonlinear differential equations.

  • Equation (5) describes the motion of the rotary arm ():
  • Equation (6) describes the motion of the pendulum ():

Notice the coupling terms like and . These show that the motion of the arm affects the pendulum and vice-versa. The presence of trigonometric functions () and squared velocity terms () makes these equations nonlinear.

2. The Motor Model

Section 2.1.2 introduces the DC motor equations. For our purposes, the most important result is Equation (7), which gives the generated torque as a function of the input voltage and the arm's angular velocity :

This equation shows that the torque isn't just proportional to voltage; there's also a "back-EMF" damping effect proportional to the motor's speed. By substituting this expression for into the mechanical equations, we can describe the entire system's dynamics in terms of the voltage input .

3. Linearization and State-Space Formulation

To use linear control techniques, we must linearize the model around the unstable equilibrium point: (pendulum upright and not moving). For small deviations around this point:

  • Terms like are considered negligible.

Applying these approximations to the combined electro-mechanical equations yields a set of linear differential equations. The final step is to define the state vector and arrange these equations into matrix form.

A logical choice for the state variables, stemming from the two second-order differential equations, is the angles and their velocities:

With this state vector, the input , and the definitions of the constants from the resource, the system can be written as:

The first two rows are simply the definitions and . The last two rows contain the complex dynamics derived from the linearized physics. This is our complete linear state-space model for the rotary inverted pendulum.

Another very similar derivation is presented in the resource "EE-479 Digital Control System Project 3 Rotary Inverted ...", which you can use as an alternative reference. It uses slightly different notation but arrives at the same underlying model structure (see Equation 3.23 in that document).

Test your understanding!

Given the state vector , suppose we can measure both the arm angle and the pendulum angle . Our output vector would then be .

What are the and matrices for the output equation ?

Show answer

We want to express the output vector in terms of the state vector .

The outputs are:

The input does not directly affect the outputs. Therefore, the output equation is:

The matrix is and the matrix is , which are the correct dimensions for a system with 4 states, 1 input, and 2 outputs.


Conclusion

In this lesson, you have taken a significant step toward your goal by deriving a complete, linearized state-space model for the rotary inverted pendulum. This process integrated concepts from physics, electrical engineering, and control theory.

Key Takeaways:

  • Modeling a complex electro-mechanical system involves deriving equations for both its mechanical and electrical components.
  • The dynamics of the rotary inverted pendulum are inherently nonlinear and coupled.
  • Linearization around an equilibrium point (even an unstable one) allows us to create a linear model suitable for standard control design techniques.
  • The final state-space model consists of a 4x4 matrix and a 4x1 matrix, representing a system with 4 state variables and 1 control input (voltage).

Preview of the Next Lesson:
Now that we have the state-space model , what does it tell us about the system's behavior? In the next lesson, we will derive the transfer function matrix from this MIMO state-space representation. This will give us a frequency-domain perspective, helping us understand how the motor voltage input influences the arm and pendulum angles, and will reveal important properties of the system.