一、Simmechanics
到MALTAB官网下载simlink
https://cn.mathworks.com/products/simmechanics/download_smlink.html
按照步骤安装,然后在 SolidWorks 工具-插件里勾选simscape multibody link选项
在工具栏可以看到simscape multibody link,选择export,选择第一个(不要选第二个first generation,因为MATLAB快不支持第一代了),完成以上步骤后就会自动生成xml文件了(中文名零件名可能会影响导出)。
二、SolidWorks生成URDF文件
URDF (Unified Robot Description File)
Generate URDF from SolidWorks
Download sw_urdf_exporter plugin
-
- The address for plugin download http://wiki.ros.org/sw_urdf_exporter
Prepare The Assembly SolidWorks Model
-
- Create the reference frames of each joints respectively according to the DH model
- Create the reference axis of each joints respectively (basically along with each z axis)
Using Plugin to export URDF
-
- tools ---> file ---> export as urdf
-
- Define the link relationship
-
- please input the joint limit otherwise there will have some errors
- Check the origin blocks for each joint since the MH has experienced the wrong transformation generated by the plugin
Conclusion
- Be caution about the direction of frame and axis
- Be caution about the frame transformation