William Kirkwood
Products Consulting Training and Events Support Store
2002 Issues
September
July
May
March
January
2001 Issues
November
September
June
March
2000 Issues
December
September
June
March
Archived Articles
1999-1998
Subscribe Now

September 2002
Volume 10, number 5

 

Creating a Stewart Platform Model Using SimMechanics (continued)


Linearizing the Model

We now extract a linear model of the Stewart Platform so that we can use more powerful linear control design techniques such as those found in the µ-Analysis and Synthesis Toolbox.


First, we must find the equilibrium point for our nonlinear model. We do this by extracting the equilibrium forces for each leg that keep the Stewart Platform stationary. These are the forces that are being applied when the system is in the initial resting state. To do this, we first extract the plant model into a new Simulink model and then set the Actuator block property to motion and set the position, velocity, and acceleration to zero. We also set the Sensor block for each leg to extract the computed force. To find the equilibrium point where the net force acting on the model is zero, we need to change the Analysis Mode parameter.


In the Simulink model, we select the Mechanical Environment Settings under the Simulation menu. This will display the mechanical parameters that we set for our model. By changing the Analysis Mode, SimMechanics can compute the motion that results from applying forces to a mechanical system or the forces required to produce a specified motion in a mechanical system. Here, the Kinematic Analysis Mode is selected because the Stewart Platform is a closed-loop system, and we want to compute the forces applied without the system moving. Once this is selected, we simulate the model and use the output from the Sensor blocks to obtain the force that will be applied to the Actuator blocks for each of the legs when the platform is at rest. To do this at the MATLAB command prompt, we can use:


sim(‘StewartPlatformEquilibrium’); u = Forces’;

Now, we are ready to extract linear models. To linearize the model near the equilibrium point, we can use the linmod command on just the plant model:


[A,B,C,D] = linmod(‘StewartPlatformPlant’,[],u);

This will generate an LTI state-space model from a SimMechanics model to use as an input to the Control Systems Toolbox and the µ-Analysis and Synthesis Toolbox commands that generate controller models.


The linearization command returns an LTI system with the same number of states as the number of states in the tree of the mechanical system (52 in this case). Since this model is closed, the number of independent states is smaller (12 in this case). We use the minreal function to get at the minimal realization of the plant with 12 states:


[A,B,C,D] = minreal(A,B,C,D);

These are the state-space matrices that we will use to design the controller for the Stewart Platform model.


Designing the Multivariable Controller

Designing the multivariable ControllerWe now use the Control System Toolbox and the µ-Analysis and Synthesis Toolbox to synthesize a multivariable, robust controller for the Stewart Platform. The details of the design, which we don’t include here, can be found in the file StewartMVController.m. You can simulate the Stewart Platform with the multivariable controller by changing the controller configurable subsystem to use the H_inf controller.


Simulate and Visualize the Model

Now that we have modeled our system with Simulink and SimMechanics, we can validate the design by simulating the system. We start the simulation by selecting Simulink and Start in the model window menu bar. During the simulation, we can view signals with the Scope block. The first plot in our scope shows the x, y, and z values of the position of the Body block representing the top plate moving over time as the model simulates. The second plot shows the difference between the desired value of the leg lengths calculated in the Leg Trajectory subsystem and the actual value of the leg lengths changing over time. The third plot shows the force on each leg during the simulation.


Simulate and visualize modelThe Virtual Reality Toolbox or MATLAB graphics options can be used to create three-dimensional animations for systems designed in SimMechanics. Either tool can be used to analyze the numerical results that quantify the motion of your mechanical system. Let’s view the basic animation provided by MATLAB graphics. The Visualization tab under the Mechanical Environment Settings provides us with two options for representing the shapes of each body: equivalent ellipsoids and convex hulls. Equivalent ellipsoids are the shape of the body based on its mass properties and inertia position, and convex hulls are the shape of the body based on its coordinate systems.




  Scope image
Once we select the shapes that we want to represent the bodies, we request that SimMechanics draw the representation animating during simulation. Now we can simulate the model. Visualizing our model during simulation makes it easy to see that our model simulates faster than the clock time on a standard PC.

Top view VR imageA more realistic way of visualizing the model can be done using the Virtual Reality Toolbox. The Virtual Reality Toolbox uses Virtual Reality Modeling Language (VRML), to create and populate virtual worlds with user-defined bodies. The simplest way to use the Virtual Reality Toolbox with SimMechanics is by selecting Virtual Reality Toolbox instead of MATLAB graphics under the Visualization tab of the Mechanical Environment Settings. This will provide the same options for body shapes that are available for MATLAB graphics. With Virtual Reality Toolbox selected, your default VRML viewer will open, showing a representation for the initial position of the model.


It is also possible to create or import a VRML scene of the Stewart Platform and hook it up to our Simulink and SimMechanics model using the Virtual Reality Toolbox blocks.


Future Directions

This article investigated the Stewart Platform, and how to create a model of the controller and mechanical components using SimMechanics. SimMechanics made it easy to build a hierarchical model of the mechanical plant and to modify the settings of the model. The model was trimmed and linearized using command-line functionality, demonstrating that it is easy to link the model with MATLAB advanced control design products. Most importantly, this example demonstrated how plant modeling, controller synthesis, and closed-loop simulation can all be performed within one environment.


There are other components of the Stewart Platform not explored in this example, such as linear motors, limit switches, and safety critical logic. These tasks could easily be performed using Simulink, Stateflow, SimMechanics, and SimPowerSystems.


Files required to run this demonstration can be downloaded at:
www.mathworks.com/matlabcentral/fileexchange/Files.jsp?fileId=2334


To find out more about products mentioned in this article, visit:

MATLAB
Simulink
SimMechanics
SimPowerSystems
Virtual Reality Toolbox


 
   News & Notes  I Using MathWorks Products For...  I MATLAB Based Books  I Third-Party Products
   
 
The MathWorks, Inc.    Trademarks   Privacy Policy