This example shows you how to import the model of a Stewart platform CAD assembly. The import procedure makes use of the mech_import command. You use the command to specify the Physical Modeling XML file that SimMechanics Link generated during CAD Export. For a step-by-step description of the CAD Export procedure, see Export a CAD Stewart Platform
Move or copy the stewart_platform.xml file into your working MATLAB® folder.
To generate a new Simulink® model, enter mech_import('stewart_platform') at the MATLAB command line, and wait for the model generation stewart_platform to finish.
The complete Stewart platform model contains seven subsystems.
Stewart Platform Model: Base, Legs, and Top Plate
The subsystems correspond to the subassemblies of the original CAD assembly — the base plate and the six platform legs.
The base plate subassembly BaseRingAssembly-1 contains six subassemblies, modeling a base swivel bearing for each leg.
The six leg subassemblies, ActuatorAssm, model the upper and lower halves of each leg and represent part of their DoFs.
For each leg, there are six DoFs. Two pairs of revolutes associated with each leg represent the two universal joints connecting each leg to the top and base plates, respectively. Each of these universals has two DoFs.
At the top level, there are two revolutes, one attached to either end of a leg subassembly, connecting each leg to the base and top plates, respectively.
Within each leg subassembly, there are two other revolutes, each one connecting the leg to the top and base plates, respectively.
One of the revolutes inside the leg subassembly pairs with one of the revolutes outside the leg assembly to make up a two-DoF universal. These pairs occur twice on each leg, one connecting the leg to the top plate, the other connecting the leg to the base plate.
Within each leg subassembly, there is one prismatic, representing the leg's freedom to expand or contract along its shaft.
Within each swivel bearing subassembly, itself located within the base ring assembly, is another revolute representing each leg's freedom to rotate about its shaft.
Each leg has six DoFs. However, the constraints imposed by attaching each leg to fixed points on the base and top plates, respectively, reduce these to one independent DoF for each leg — the freedom to expand or contract along its shaft.
The rotational DoFs associated with the universals at the attachment points are completely dependent on the leg's prismatic DoF.
The rotational DoFs associated with the cylindricals in each leg are completely dependent on the universals at the top and bottom of each leg.
The generated model contains a large number of redundant Root Weld and zero-mass Root Part blocks. You can delete these and not affect the model's dynamics, as long as you take care to reconnect the remaining bodies properly after deleting each Weld.
If you want the motion of the platform to be controlled by something other than gravity, you need to add the appropriate ActuatorsActuators to the model. To quantify the model's motion, you need to make precise measurements with SensorsSensors. You can drive the actuators with external control signals to model an open-loop controller for the Stewart platform. If you introduce feedback from the sensors to the actuators, you can model a closed-loop controller.
Without any external forces acting, apart from gravity, the platform collapses under its own weight. You can verify this by running and visualizing your Stewart platform model.
In the SimMechanics 1G node, select Display machines after updating diagram and Show animation during simulation.
In the Simulink Editor window that contains your model, select Simulation > Update Diagram. The SimMechanics™ visualization window opens with the SimMechanics controls. The window displays the Stewart platform in its initial position.
The mobile plate falls under its own weight and reaches the base plate in about 0.2 seconds. Because there is nothing to stop the legs or the top plate, the platform continues to collapse: the mobile plate falls below the base plate, and the upper and lower parts of each leg come apart.
This visualization of the Stewart platform uses custom body visualization with the STLSTL body geometry files exported from the original CAD assembly.
SimMechanics Visualization of the CAD-Based Stewart Platform (Custom Body Geometries)