Import an Onshape Humanoid Model
You can import a CAD assembly model from Onshape® software
into the Simscape™
Multibody™ environment. The import process occurs
in two steps based on the
smimport functions. The
the assembly model in an intermediate XML conforming to the Simscape
smimport function converts the intermediate
XML file into a Simscape
Multibody version of the original Onshape model.
This example shows how to import an Onshape model of a humanoid robot assembly. The model comprises
various parts representing the torso, head, and limbs of the robot. The
parts connect through
Revolute mates that
represent the various joints. The model is identical to that shown in Import a URDF Humanoid Model. Enter the following URL in your
web browser to access the model (Onshape login required):
Export the Model
smexportonshape function to export
At the MATLAB® command prompt, navigate to a folder for which you have write privileges—for example:
Store the model URL in a MATLAB variable named
assemblyURL = 'https://cad.onshape.com/documents/5817806f96eae5105bfa5085/w/15ab3bfb58cacbf427d77ff3/e/181493813f84966648a8db1b';
Export the model and save the XML file name in a variable named
exportedModel = smexportonshape(assemblyURL);
You may be prompted to log in to your Onshape account. The
smexportonshapefunction generates the XML multibody description file for this model and a set of STEP files for the various part geometries.
Import the Model
smimport function to import the
XML multibody description file:
The function generates a Simscape Multibody model of the humanoid robot.
Build on the model, for example, by adding control systems to
actuate the various joints. For a controlled example, at the MATLAB command
the model to view a simple animation.