Products & Services Solutions Academia Support User Community Company

Learn more about SimMechanics   

Trimming and Linearizing Through Inverse Dynamics

About Trimming and Inverse Dynamics

This case study finds a Stewart platform steady state with the SimMechanics Kinematics mode . You specify motions and determine the forces and torques to produce those motions (the inverse dynamics problem). If you are not familiar with implementing inverse dynamics in the SimMechanics environment, work through the Finding Forces from Motions section of the Analyzing Motion chapter before attempting this case study.

Use the Inverse Dynamics and Kinematics modes for inverse-dynamic analysis of open- and closed-topology systems, respectively. The Stewart platform has a closed topology and thus requires the Kinematics mode. Once you have an operating point, you can linearize the motion.

What Is Trimming?

Trimming a system means locating a configuration of its states with certain prior conditions imposed on the states and possibly their derivatives. In a mechanical context, it means imposing conditions on certain positions and velocities, then determining the remaining positions and velocities such that the entire state of the machine is consistent. A by-product of mechanical trimming is determination of the forces/torques necessary to produce the specified motion. These motion states constitute a trim or operating point. Trimming problems can have one solution, more than one, or none.

Pure inverse dynamics imposes prior motions on all degrees of freedom. Then all the states are determined. (The consistency of the motions is not guaranteed, but must be checked.) Only the forces/torques remain to be found.

Ways to Find an Operating Point

To find an operating point or steady state for a SimMechanics model,

Trimming in the Kinematics Mode

Here are the files needed for this case study. The models also call the initialization M-files. Open the first model by clicking the first link.

FilePurpose
mech_stewart_control_equilKinematics model for determining Stewart platform force equilibrium
mech_stewart_control_equil_legLibrary model of Stewart platform leg for kinematic analysis
mech_stewart_control_plantForward dynamics model for linearizing the Stewart platform
mech_stewartplatform_legLibrary model of Stewart platform leg for forward dynamic analysis

Simulation Settings for Inverse Dynamics

The mech_stewart_control_equil model has some preset nondefault settings.

Configuration Parameters

SettingValue
Solver > Simulation time > Stop time0.005 seconds
Data Import/Export > Save to workspaceTime and States selected >
tout and xout
SimMechanics > DiagnosticsMark automatically cut joints selected
SimMechanics > VisualizationDisplay machines after updating diagram and
Show animation during simulation selected

Machine Environment

SettingValue
Parameters > Analysis modeKinematics
Parameters > Machine Dimensionality3D Only
Constraints > Constraint solver typeMachine Precision
Constraints > Use robust singularity handlingSelected

Specifying the Motion

The six Stewart platform legs are instances of a basic leg saved in the mech_stewart_control_equil_leg library. It takes as inputs the motion actuation signals that specify position and velocity as a function of time. The position signals specify the platform's motion relative to the initial geometric configuration.

In mech_stewart_control_equil, the Motion subsystem specifies motion as trivial: zeroes for all six leg positions and velocities. That is, the model holds the platform still in its initial state.

Measuring the Steady-State Forces

Each Stewart platform leg outputs the computed leg force needed to maintain the motion specified by the motion actuation. These six measured forces are directed to your MATLAB workspace by the To Workspace block.

  1. Open the To Workspace dialog.

    The output forces are stored in the vector variable Forces. The block retains the force vector only from the last time step.

  2. Close the To Workspace dialog.

Running the Model and Obtaining the Outputs

Now run mech_stewart_control_equil.

  1. Click Start and wait for the simulation to finish.

  2. In your workspace, locate tout and xout. These are the time steps and the corresponding state values, respectively.

    In the Inverse Dynamics mode, there are 40 mechanical states counted by Simulink, associated with the mechanical constraints. Consult Identifying the Simulink and Mechanical States of the Stewart Platform earlier in this chapter.

  3. Locate Forces in the workspace. These are the six force values along each leg to hold the platform still against falling by gravity. The values are positive (expansive) along the legs.

Linearizing the Stewart Platform at an Operating Point

Knowing the steady-state forces needed to keep the platform still, you now linearize another version of the model, mech_stewart_control_plant. It has settings similar to mech_stewart_control_equil, except that:

Open the mech_stewart_control_plant model.

Close the model.

Linearizing the Forward Dynamics Model

You can simulate the mech_stewart_control_plant model without opening it.

  1. At the command line, enter

    nomForces = Forces'; % Transpose the force vector
  2. Linearize the model by entering

    [A,B,C,D] = ...
       linmod('mech_stewart_control_plant',[],nomForces);

    The arguments are, in order,

    • Model name

    • Model state vector (not used)

    • Model input vector u = nomForces

These (unreduced) output matrices are the standard state-space representation of a linearized model. The space is defined by x, u, and y, the state, input, and output vectors, respectively.

There are 52 states, 6 inputs, and 12 outputs. Thus A, B, C, D have dimensions 52-by-52, 52-by-6, 12-by-52, and 12-by-6, respectively. Not all these matrix entries are independent.

Finding the Minimal Realization of the Linearized Model

Of the 52 mechanical states, the Stewart platform has only 12 independent states, corresponding to six degrees of freedom (DoFs). Each DoF corresponds to one position and one velocity.

To eliminate the redundant states, enter

[a,b,c,d] = ...
   minreal(A,B,C,D);
40 states removed.

at the command line. The a, b, c, d matrices are reduced in size to 12-by-12, 12-by-6, 12-by-12, 12-by-6, respectively.

For More About Linearization and State Space

See Open-Topology Linearization: Double Pendulum in the Analyzing Motion chapter and the Simulink documentation.

Further Suggestions for Inverse Dynamics Trimming

Trimming in the Kinematics Mode and Linearizing the Stewart Platform at an Operating Point preceding present the simplest possible trimming scenario:

General Trimming Conditions: Mixed Dynamics

In a more typical trimming problem, you specify some of the DoFs by motion actuation and leave the others free to respond to forces/torques. Such a scenario is a mixed dynamics problem. In the SimMechanics environment, you can solve such problems in

Complementarity of Inverse and Forward Dynamics

Actuate DoF with...Sense on DoF...
Forces/torquesMotions
MotionsForces/torques

If you want to solve such a problem for the Stewart platform, you need to

Using the Operating Point to Linearize a Model

The steady-state outputs are in turn the inputs for linearization.

Complementarity of Trimming and Linearization

Trimming Output Becomes......Linearization Input
Measured motions become......Motion actuation signals
Measured forces/torques become......Force/torque actuation signals

To carry out a linearization of your system,

  1. Create a variant model in Forward Dynamics mode that takes

    • The steady-state forces as linearization input force actuation

    • The steady-state motions as linearization input motion actuation

  2. Linearize with linmod.

    linmod('forward_dynamics_model_to_linearize', state, input)

    This command can feed model inputs into the linearized simulation as a command argument. See the command reference for more details.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS