当前位置:   article > 正文

在GAZEBO中使用URDF模型_gazebo导入urdf

gazebo导入urdf

一、背景

URDF模型是一种用在ROS中描述机器人结构的模型,但有很多局限性,例如不能描述机器人和它所在世界的相对位置关系等等。现在一种比较新的模型叫做SDF,可以说是完全取代了URDF模型,而且SDF模型也是GAZEBO中默认使用的模型。但是GAZEBO也提供了对URDF模型的支持,前提是要在URDF模型中加入一些新的元素。

二、概述

把URDF模型成功转换成SDF模型,有些必须的和可选的属性元素需要添加到URDF模型中。

必选:每个 <link> 元素中必须设置 <inertial> 元素

可选:(1)在 <link> , <joint>, <model> 中设置 <gazebo>元素;(2)添加 <link name ="world"/>如果机器人需要固定在某个位置的话

三、具体修改措施

1.文件头部

URDF文件的头部改成 <robot name="rrbot" xmlns:xacro="http://www.ros.org/wiki/xacro">

2.如果需要把机器人固定到某个位置(平面上),加入下面的语句:

  1. <!-- Used for fixing robot to Gazebo 'base_link' -->
  2. <link name="world"/>
  3. <joint name="fixed" type="fixed">
  4. <parent link="world"/>
  5. <child link="link1"/>
  6. </joint>
3.Links修改

(1)每个link元素中除了<vision>和<collision>属性,必须设置<inertial>属性

(2)<material>元素的使用方法需要改变,例如原来的<material>元素为:

  1. <material name="orange">
  2. <color rgba="${255/255} ${108/255} ${10/255} 1.0"/>
  3. </material>
需要修改成:

  1. <gazebo reference="link1">
  2. <material>Gazebo/Orange</material>
  3. </gazebo>
4.Joints修改

  • The <origin><parent> and <child> are required
  • <calibration> and <safety_controller> are ignored
  • In the <dynamics> tag, only the damping property is used for gazebo4 and earlier. Gazebo5 and up also uses the friction property.
  • All of properties in the <limit> tag are optional
四、验证修改后的模型

使用一下命令:

  1. # gazebo2 and below
  2. gzsdf print MODEL.urdf
  3. # gazebo3 and above
  4. gz sdf -p MODEL.urdf
终端下会提示SDF文件生成与否,同时会显示出URDF转换SDF需要的某些信息;GAZEBO-1.9及更高版本需要用下边的命令查询转换结果的信息:

  cat ~/.gazebo/gzsdf.log
如果生成成功,可以用spawn方式或者roslaunch方式把SDF模型导入到GAZEBO中。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/979033
推荐阅读
相关标签
  

闽ICP备14008679号