This example shows how to generate a Simscape™
from a multibody description XML file using the
The example is based on a multibody description file named sm_robot
and a set of part geometry files included in your Simscape
These files describe the robotic arm model shown in the figure.
The multibody description and part geometry files used in this example are located in the folder
At the MATLAB command prompt, enter the command:
The blocks in the generated model are parameterized in terms of MATLAB variables. The numerical values of these variables are defined in a data file that is named sm_robot.m and stored in the same active folder as the generated model.
Update the diagram to visualize the model. You can do this from the Simulink® menu bar by selecting Simulation > Update Diagram. Mechanics Explorer opens with a static visualization of the robotic arm model in its initial configuration.
The default view convention in Mechanics Explorer differs from that in the CAD application used to create the original assembly model. Mechanics Explorer uses a Z-axis-up view convention while the CAD application uses a Y-axis-up view convention.
Change the view convention from the Mechanics Explorer toolstrip
by setting the View convention parameter to
up (XY Front). Then, select a standard view from the View > Standard Views menu to apply the new view convention.
Try to simulate the model. Because the robotic arm lacks a control system, it simply flails under gravity. You can use Simulink blocks to create the control system needed to guide the robotic arm motion. A control system would convert motion sensing outputs into actuation inputs at the various joints. You can expose the sensing and actuation ports from the joint block dialog boxes.