Main Content

URDF Import

导入URDF模型

You import a URDF model into theSimscape™ Multibody™环境使用这件smimportfunction with the URDF file name as its principal argument. The function identifies the model type—URDF or XML—via the file extension. If you omit the extension, the function assumes that the file is in the XML format more commonly used for CAD import. For example, the command

smimport('sm_humanoid.urdf')
tells the function to import a URDF model namedsm_humanoid.。这command

smimport('sm_humanoid')

tells the function to import a multibody model from an intermediate XML file namedsm_humanoid.。如果该函数发现没有具有指定名称的XML文件,则它返回错误 - 即使存在同一文件夹中具有相同名称的URDF文件。通常,在尝试导入URDF模型时,您必须明确地包含URDF文件扩展名。

您可以导入的URDF实体

Simscape Multibodysoftware supports only a subset of all the available URDF elements and attributes. You can import a URDF model with unsupported elements or attributes, but all such entities are ignored. The following code shows the elements and attributes that you can and cannot import. Elements are shown in bold font and attributes in regular font. Unsupported elements and attributes are shown in red.

<robot姓名> <link姓名> <惯性> <originXYZ rpy /> <大量的价值/> <inertiaixx iyy izz ixy ixz iyz /> 惯性> <visual姓名> <originXYZ rpy /> <几何学> <盒子size /> <cylinder半径长度/> <sphere半径/> <文件名scale/> 几何学> <material姓名> <颜色rgba /> <质地文件名/> material> visual> <collision姓名> <originxyz rpy/> <几何学> <盒子size/> <cylinder半径长度/> <sphereradius/> <文件名scale/> 几何学> collision> link> <联合的名称类型> <originXYZ rpy /> <link /> <childlink /> <axisxyz /> <calibration升起/> <calibration落下/> <动力学damping摩擦/> <限制lower upper努力速度/> <mimic联合的multiplier offset/> <safety_controllersoft_lower_limit.。。。。。。soft_upper_limit k_position k_velocity./> 联合的> robot>

Mapping toSimscape多体Blocks

这URDFelement maps into aSimscape Multibody模型。这元素嵌套在里面元素映射到Simulink金宝app®子系统blocks representing the links or, inSimscape Multibodynomenclature, bodies. Theelements map into equivalentSimscape Multibody联合的块。这姓名这些元素的属性分别映射到模型名称,子系统块名称和联合块名称。

这子系统blocks comprise solid,惯性,Rigid Transform, 和Reference Frame块。固体块提供身体的几何形状和颜色;这些块对应于URDF模型的标签并被命名Visual。这惯性block provides the mass, center of mass, moments of inertia, and products of inertia of the body; this block corresponds to the<惯性>元素的the URDF model and it is named惯性

Rigid Transformblocks provide the translational and rotational offsets from the local reference frame of the body to the Inertial and Visual elements. These transforms are derived from the<原产地>本文的要素<惯性>elements of links, as well as from the<原产地><轴>elements of joints. TheReference Frameblock identifies the local reference frame of the body.

使用的关节块类型取决于属性的元素。URDF与URDF之间的联合映射Simscape Multibody软件在很大程度上直观。一种元素的类型棱柱地图进入了一个棱柱联络block. A元素的类型固定的maps into aWeld Jointblock. The table shows the mappings for the remaining URDF元素。

URDF与urdf之间的对应Simscape多体关节

URDF 属性 Simscape Multibody联合块 自由程度
旋转 Revolute Joint 一个带有关节限制的旋转
连续的 Revolute Joint One rotational (without joint limits)
棱柱图 棱柱联络 一个具有联合限制的平移
固定的 Weld Joint Zero (rigid connection)
floating 6-DOF Joint 三个旋转和三个平移
planar Planar Joint Two rotational and one translational

忽略了联合限制

导入简单的URDF模型

一种s an example, import the double-pendulum URDF model described in theCreate a Simple URDF Model部分。如果在继续之前尚未这样做,请创建URDF模型。要导入模型,请导航到您保存双摆型URDF模型的文件夹。然后,在matlab®command prompt, enter the command

smimport('double_pendulum.urdf')
If you saved your URDF model under a different name, use that name instead. The function imports the URDF model and generates an equivalentSimscape Multibody模型。该图显示了带块的结果模型及其连接线略微重新排列。

关于进口模型

elements namedlink A,link B, 和link Cin the URDF model map into Simulink Subsystem blocks also namedlink A,link B, 和link C。这elements named联合的一种联合的B- 离开类型set to连续的—map intoSimscape MultibodyRevolute Jointblocks also named联合的一种联合的B

这block diagram reflects the topology of the URDF model—an unbranched kinematic tree.link Cconnects tolink B作为那个元素的孩子。link Bin turn connects tolink A作为那个元素的孩子。link A是根链路,因此是接地的 - 在刚性连接中反映的条件link AWorld Frame块。

URDF Model Topology

代表URDF的子系统块元素各自包括一个小块图,其中一个参考帧块,一个砖坚固块,一惯性block, and multipleRigid Transform块。这子系统blocks are not masked and can be opened directly with a double click. The figure shows the block diagram of thelink A子系统block.

砖坚固块是翻译的等价物URDF element and is named Visual. This block contains the relevant parameters of the元素,包括链接几何和颜色。这惯性块是翻译的等价物<惯性>URDF element and is accordingly named Inertial. This block contains the relevant parameters of the<惯性>元素,包括链接质量,惯性矩,惯性产品。下载188bet金宝搏

link A子系统

Reference Frameblock identifies the local reference frame of theURDF元素。该帧与关节连接帧与父链路一致,或者在这种情况下,root链接到World Frameblock. TheRigid Transformblocks specify the translational and rotational transforms to the reference frames of the<惯性>,, 和URDF elements. An additionalRigid Transformblock specifies the rotation transform needed to align theSimscape Multibody带URDF关节轴的关节轴。

一种ssemble and Simulate the Imported Model

在模型上构建以获得有意义的模拟。例如,您可以使用联合状态目标以不稳定的配置组装双摆,并模拟其在重力下的下降:

  1. 在里面dialog box of the joint_A block, select theState Targets>Specify Position Target复选框并设置价值参数到30.Deg。该参数设置上节接头的起始角度。

  2. 在里面Solverpane of the Configuration Parameters window, click一种dditional options和set theMax step size参数到0.01。This value keeps the solver step size small enough to produce a smooth animation during simulation. Increase the value if simulation proceeds slowly.

  3. 更新框图并运行模拟。在里面造型tab, clickUpdate Model。您可以通过选择来模拟模型。力学探险家显示双摆在重力下的动画。

URDF Import Limitations

URDF models allow only tree topologies. Some URDF variants, such as SDF (Simulation Description Format) and DrakeURDF, add support for kinematic loops. You cannot import models in these alternative formats. You can, however, add kinematic loops to an imported model once in theSimscape Multibodyenvironment.

不支持某些URDF元素和来自URDF扩展的属性。金宝app扩展包括elements used to model gear trains and parallel linkages,用于模拟凉亭环境中URDF模型的元素,且常用于常用元素。

也不支持某些核心URDF元素和属性。金宝app不支金宝app持的元素包括<碰撞>,用于链接碰撞检测,和<限制>, used for joint motion limits. Unsupported attributes includescalefor mesh file scaling,摩擦用于联合内部力学,和more。Un金宝appsupported URDF elements and attributes are ignored during import.

Mesh Geometries

You can import URDF models with references to external geometry files, but the files must be in STL (Standard Tessellation Language) format.

Collada,或DAE,几何文件,常见的URDF模型中,不受支持金宝appSimscape Multibodysoftware. If you import a model with references to DAE files, the geometries derived from those files are not rendered. The lack of visualization may limit your ability to analyze a model but has no impact on the model dynamics.

物理单位

导入模型的块参数自动设置为URDF默认单位SI。您可以在导入后修改单位,但必须以黑色块为基础而进行。支持各种其他单位,包括MKS(米千克二),USC(美国常规金宝app)和其他单位系统的核心。

Differences from CAD Import

尽管他们的相似之处,包括他们对相互依赖的smimportfunction, CAD and URDF import differ in some important aspects:

  • CAD模型以中间XML格式导入。URDF模型直接以URDF格式导入。

    这intermediate XML files provide the information needed to recreate the CAD models in theSimscape Multibodyenvironment. The same information is provided directly in URDF files when importing URDF models. XML multibody description files must conform to theSimscape多体XML Schema.。SeeExporting a CAD Modelfor ways to generate a valid XML file.

  • 导入的CAD模型具有在MATLAB文件中定义的数值参数。导入的URDF模型将其数值参数硬编码到块对话框中。

    CAD import uses a detached data framework that places all block parameter values in a cell structure defined in a separate MATLAB data file. The detached data framework enables you to update a previously imported model when you modify the source CAD model. URDF import lacks this feature and does not support model update.

See Also

相关话题