赞
踩
一、背景
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.如果需要把机器人固定到某个位置(平面上),加入下面的语句:
- <!-- Used for fixing robot to Gazebo 'base_link' -->
- <link name="world"/>
-
- <joint name="fixed" type="fixed">
- <parent link="world"/>
- <child link="link1"/>
- </joint>
3.Links修改
(1)每个link元素中除了<vision>和<collision>属性,必须设置<inertial>属性
(2)<material>元素的使用方法需要改变,例如原来的<material>元素为:
- <material name="orange">
- <color rgba="${255/255} ${108/255} ${10/255} 1.0"/>
- </material>
需要修改成:
- <gazebo reference="link1">
- <material>Gazebo/Orange</material>
- </gazebo>
4.Joints修改
<origin>
, <parent>
and <child>
are required<calibration>
and <safety_controller>
are ignored<dynamics>
tag, only the damping
property is used for gazebo4 and earlier. Gazebo5 and up also uses the friction
property.<limit>
tag are optional使用一下命令:
- # gazebo2 and below
- gzsdf print MODEL.urdf
- # gazebo3 and above
- gz sdf -p MODEL.urdf
终端下会提示SDF文件生成与否,同时会显示出URDF转换SDF需要的某些信息;GAZEBO-1.9及更高版本需要用下边的命令查询转换结果的信息:
cat ~/.gazebo/gzsdf.log
如果生成成功,可以用spawn方式或者roslaunch方式把SDF模型导入到GAZEBO中。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。