Antes importamos un modelo en nuestra librería de un robot codificado en formato URDF. Con smimport podemos también leer directamente archivos exportados de CAD en formato xml.
>> [model2, importInfo] = smimport('robot_cad.xml');
Esta importación nos crea un archivo script de matlab (robot_cad_Datafile.m) con los parámetros necesarios para poder correr el modelo slx creado.
Si en un momento dado necesitamos el modelo en formato Matlab (rigid body tree) podemos generarlo a partir del modelo de simscape creado anteriormente:
>> model1 = importrobot('robot_cad.slx');
En la ayuda de matlab leemos la siguiente explicación:
[H,dataFileName] = smimport(modelSource) creates a Simscape Multibody model from a CAD, URDF, or Robotics System Toolbox model.
modelSource is the name of the file or object containing the model or, for CAD import, an intermediate representation of it. CAD models must be in XML files, URDF models in URDF files, and Robotics System Toolbox models in RigidBodyTree objects. XML files must conform to the Simscape Multibody XML schema and URDF files must conform to the URDF specification.
El típico software de diseño mecánico CAD, como SolidWorks, suele incluir herramientas de exportación a formato xml compatible con Simscape (https://es.mathworks.com/help/physmod/smlink/ref/linking-and-unlinking-simmechanics-link-software-with-solidworks.html):