Main Content

Import a Robotic Arm CAD Model

Example Overview

This example shows how to generate a Simscape™ Multibody™ model from a multibody description XML file using the smimport function. The example is based on a multibody description file named sm_robot and a set of part geometry files included in your Simscape Multibody installation. These files describe the robotic arm model shown in the figure.

Example Files

The multibody description and part geometry files used in this example are located in the folder

where matlabroot is the root folder of your MATLAB® installation, for example:

Import the Model

At the MATLAB command prompt, enter the command:

Simscape Multibody software generates the model described in the sm_robot.xml file using the default smimport function settings.

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.

Visualize the Model

Update the diagram to visualize the model. In the Modeling tab, click Update Model. 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 Y up (XY Front). Then, select a standard view from the View > Standard Views menu to apply the new view convention.

Build on the Model

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.

See Also

Related Topics