gazebo通过sdf搭建仿真环境和机器人Husky

2023-11-13

具体格式要求可参考:http://sdformat.org/spec?ver=1.6&elem=sdf

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">
    <light name='sun' type='directional'>
      <cast_shadows>1</cast_shadows>
      <pose>-11.82075 -19.38429 17.2198 0 -0 0</pose>
      <diffuse>0.7 0.7 0.7 1</diffuse>
      <specular>0.2 0.2 0.2 1</specular>
      <attenuation>
        <range>1000</range>
        <constant>0.9</constant>
        <linear>0.01</linear>
        <quadratic>0.001</quadratic>
      </attenuation>
      <direction>0.3698 0.4 -0.5</direction>
    </light>
    <model name="ground">
      <static>true</static>
      <link name="link">
        <pose>-6.2343 -8.1302 0 0 -0 0</pose>
        <visual name="visual">
          <cast_shadows>false</cast_shadows>
          <pose>0 0 0 0 -0 0</pose>
          <geometry>
           <mesh>
              <uri>model://xxx_3D_visual.dae</uri>
                <scale>1 1 1</scale>
              </mesh>
          </geometry>
        </visual>
        <collision name="collision">
          <pose>0 0 0 0 0 0</pose>
          <geometry>
            <mesh>
              <uri>model://xxx_3D_collision.stl</uri>
                <scale>1 1 1</scale>
              </mesh>
          </geometry>
        </collision>
      </link>
    </model>
    <scene>
      <ambient>0.4 0.4 0.4 1</ambient>
      <background>0.7 0.7 0.7 1</background>
      <shadows>1</shadows>
    </scene>
  </world>
</sdf>

world文件与机器人model模型属性定义类似,可以引用3D的mesh文件比如.dae .stl等作为visual或者collision,并可以定义物理环境条件等。

Husky官方地址:http://wiki.ros.org/Robots/Husky

这里的Husky模型被缩小了,比原来的机器人小很多,参数不一致!大约1/3

<?xml version='1.0'?>
<sdf version='1.6'>
  <model name='xxx_husky'>
    <link name='base_link'>
      <inertial>
        <mass>3.3855</mass>
        <pose frame=''>-0.085613 -0.00084 0.1 0 -0 0</pose>
        <inertia>
          <ixx>0.22343</ixx>
          <ixy>0</ixy>
          <ixz>0.0275174</ixz>
          <iyy>0.342518</iyy>
          <iyz>0.00023962</iyz>
          <izz>0.21241</izz>
        </inertia>
      </inertial>
      <self_collide>0</self_collide>
      <enable_wind>0</enable_wind>
      <kinematic>0</kinematic>
      <pose frame=''>0 0 0.02 0 -0 0</pose>
      <gravity>1</gravity>
      <visual name='body'>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <geometry>
          <mesh>
            <uri>model://husky/meshes/body.dae</uri>
            <scale>0.33 0.33 0.3</scale>
          </mesh>
        </geometry>
      </visual>
      <collision name='collision'>
        <laser_retro>0</laser_retro>
        <max_contacts>10</max_contacts>
        <pose frame=''>0 0 0.05 0 -0 0</pose>
        <geometry>
          <box>
            <size>0.33 0.16 0.06</size>
          </box>
        </geometry>
      </collision>
    </link>
    <link name='back_left_wheel'>
      <pose frame=''>-0.09 0.1 0.035 0 -0 0</pose>
      <inertial>
        <mass>0.26357</mass>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <inertia>
          <ixx>0.00246688</ixx>
          <ixy>0</ixy>
          <ixz>0</ixz>
          <iyy>0.00246688</iyy>
          <iyz>0</iyz>
          <izz>0.00441058</izz>
        </inertia>
      </inertial>
      <self_collide>0</self_collide>
      <enable_wind>0</enable_wind>
      <kinematic>0</kinematic>
      <gravity>1</gravity>
      <visual name='back_left_wheel'>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <geometry>
          <mesh>
            <uri>model://husky/meshes/wheel.dae</uri>
            <scale>0.3 0.3 0.3</scale>
          </mesh>
        </geometry>
      </visual>
      <collision name='back_left_wheel_collision'>
        <laser_retro>0</laser_retro>
        <max_contacts>10</max_contacts>
        <pose frame=''>0 0 0 -1.5707 0 0</pose>
        <geometry>
          <cylinder>
            <radius>0.055</radius>
            <length>0.03</length>
          </cylinder>
        </geometry>
        <surface>
          <friction>
            <ode>
              <mu>0.5</mu>
              <mu2>50</mu2>
              <fdir1>0 0 0</fdir1>
              <slip1>0.01</slip1>
              <slip2>0</slip2>
            </ode>           
          </friction>
        </surface>
      </collision>
    </link>
    <link name='back_right_wheel'>
      <pose frame=''>-0.09 -0.1 0.035 0 -0 0</pose>
      <inertial>
        <mass>0.26357</mass>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <inertia>
          <ixx>0.00246688</ixx>
          <ixy>0</ixy>
          <ixz>0</ixz>
          <iyy>0.00246688</iyy>
          <iyz>0</iyz>
          <izz>0.00441058</izz>
        </inertia>
      </inertial>
      <self_collide>0</self_collide>
      <enable_wind>0</enable_wind>
      <kinematic>0</kinematic>
      <gravity>1</gravity>
      <visual name='back_right_wheel'>
        <pose frame=''>0 0 0 -3.14159 0 0</pose>
        <geometry>
          <mesh>
            <uri>model://husky/meshes/wheel.dae</uri>
            <scale>0.3 0.3 0.3</scale>
          </mesh>
        </geometry>
      </visual>
      <collision name='back_right_wheel_collision'>
        <laser_retro>0</laser_retro>
        <max_contacts>10</max_contacts>
        <pose frame=''>0 0 0 -1.5707 0 0</pose>
        <geometry>
          <cylinder>
            <radius>0.055</radius>
            <length>0.03</length>
          </cylinder>
        </geometry>
        <surface>
          <friction>
            <ode>
              <mu>0.5</mu>
              <mu2>50</mu2>
              <fdir1>0 0 0</fdir1>
              <slip1>0.01</slip1>
              <slip2>0</slip2>
            </ode>
          </friction>
        </surface>
      </collision>
    </link>
    <link name='front_left_wheel'>
      <pose frame=''>0.09 0.1 0.035 0 -0 0</pose>
      <inertial>
        <mass>0.26357</mass>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <inertia>
          <ixx>0.00246688</ixx>
          <ixy>0</ixy>
          <ixz>0</ixz>
          <iyy>0.00246688</iyy>
          <iyz>0</iyz>
          <izz>0.00441058</izz>
        </inertia>
      </inertial>
      <self_collide>0</self_collide>
      <enable_wind>0</enable_wind>
      <kinematic>0</kinematic>
      <gravity>1</gravity>
      <visual name='front_left_wheel'>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <geometry>
          <mesh>
            <uri>model://husky/meshes/wheel.dae</uri>
            <scale>0.3 0.3 0.3</scale>
          </mesh>
        </geometry>
      </visual>
      <collision name='front_left_wheel_collision'>
        <laser_retro>0</laser_retro>
        <max_contacts>10</max_contacts>
        <pose frame=''>0 0 0 -1.5707 0 0</pose>
        <geometry>
          <cylinder>
            <radius>0.055</radius>
            <length>0.03</length>
          </cylinder>
        </geometry>
        <surface>
          <friction>
            <ode>
              <mu>0.5</mu>
              <mu2>50</mu2>
              <fdir1>0 0 0</fdir1>
              <slip1>0.01</slip1>
              <slip2>0</slip2>
            </ode>
          </friction>
        </surface>
      </collision>
    </link>
    <link name='front_right_wheel'>
      <pose frame=''>0.09 -0.1 0.035 0 -0 0</pose>
      <inertial>
        <mass>0.26357</mass>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <inertia>
          <ixx>0.00246688</ixx>
          <ixy>0</ixy>
          <ixz>0</ixz>
          <iyy>0.00246688</iyy>
          <iyz>0</iyz>
          <izz>0.00441058</izz>
        </inertia>
      </inertial>
      <self_collide>0</self_collide>
      <enable_wind>0</enable_wind>
      <kinematic>0</kinematic>
      <gravity>1</gravity>
      <visual name='front_right_wheel'>
        <pose frame=''>0 0 0 -3.14159 0 0</pose>
        <geometry>
          <mesh>
            <uri>model://husky/meshes/wheel.dae</uri>
            <scale>0.3 0.3 0.3</scale>
          </mesh>
        </geometry>
      </visual>
      <collision name='front_right_wheel_collision'>
        <laser_retro>0</laser_retro>
        <max_contacts>10</max_contacts>
        <pose frame=''>0 0 0 -1.5707 0 0</pose>
        <geometry>
          <cylinder>
            <radius>0.055</radius>
            <length>0.03</length>
          </cylinder>
        </geometry>
        <surface>
          <friction>
            <ode>
              <mu>0.5</mu>
              <mu2>50</mu2>
              <fdir1>0 0 0</fdir1>
              <slip1>0.01</slip1>
              <slip2>0</slip2>
            </ode>
          </friction>
        </surface>
      </collision>
    </link>
    <link name='ray_sensor'>
      <pose frame=''>0 0 0.09 0 -0 0</pose>
      <sensor name='head_hokuyo_sensor' type='ray'>
        <visualize>0</visualize>
        <update_rate>10</update_rate>
        <ray>
          <scan>
            <horizontal>
              <samples>720</samples>
              <resolution>1</resolution>
              <min_angle>-3.14159</min_angle>
              <max_angle>3.14159</max_angle>
            </horizontal>
            <vertical>
              <samples>1</samples>
              <min_angle>0</min_angle>
              <max_angle>0</max_angle>
            </vertical>
          </scan>
          <range>
            <min>0.1</min>
            <max>16</max>
            <resolution>0.01</resolution>
          </range>
          <noise>
            <type>gaussian</type>
            <mean>0</mean>
            <stddev>0.01</stddev>
          </noise>
        </ray>
        <plugin name='gazebo_ros_head_hokuyo_controller' filename='libgazebo_ros_laser.so'>
          <topicName>laser_scan</topicName>
          <frameName>base_link</frameName>
        </plugin>
      </sensor>
      <self_collide>0</self_collide>
      <inertial>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <inertia>
          <ixx>1</ixx>
          <ixy>0</ixy>
          <ixz>0</ixz>
          <iyy>1</iyy>
          <iyz>0</iyz>
          <izz>1</izz>
        </inertia>
        <mass>1</mass>
      </inertial>
      <enable_wind>0</enable_wind>
      <kinematic>0</kinematic>
      <gravity>1</gravity>
      <visual name='ray_sensor_visual'>
        <pose frame=''>0 0 0 1.5708 0 -1.5708</pose>
        <geometry>
          <mesh>
            <uri>model://husky/meshes/eye_vision_camera.dae</uri>
            <scale>0.2 0.2 0.2</scale>
          </mesh>
        </geometry>
      </visual>
      <collision name='ray_sensor_collision'>
        <laser_retro>0</laser_retro>
        <max_contacts>10</max_contacts>
        <pose frame=''>0 0 0.015 0 -0 0</pose>
        <geometry>
          <cylinder>
            <radius>0.01</radius>
            <length>0.03</length>
          </cylinder>
        </geometry>
      </collision>
    </link>
    <joint name='back_left_joint' type='revolute'>
      <parent>base_link</parent>
      <child>back_left_wheel</child>
      <pose frame=''>0 0 0 0 -0 0</pose>
      <axis>
        <xyz>0 1 0</xyz>
        <use_parent_model_frame>1</use_parent_model_frame>
        <limit>
          <lower>-1e+16</lower>
          <upper>1e+16</upper>
          <effort>-1</effort>
          <velocity>-1</velocity>
        </limit>
        <dynamics>
          <spring_reference>0</spring_reference>
          <spring_stiffness>0</spring_stiffness>
          <damping>0</damping>
          <friction>0</friction>
        </dynamics>
      </axis>
      <physics>
        <ode>
          <limit>
            <cfm>0</cfm>
            <erp>0.9</erp>
          </limit>
          <suspension>
            <cfm>0</cfm>
            <erp>0.2</erp>
          </suspension>
        </ode>
      </physics>
    </joint>
    <joint name='back_right_joint' type='revolute'>
      <parent>base_link</parent>
      <child>back_right_wheel</child>
      <pose frame=''>0 0 0 0 -0 0</pose>
      <axis>
        <xyz>0 1 0</xyz>
        <use_parent_model_frame>1</use_parent_model_frame>
        <limit>
          <lower>-1e+16</lower>
          <upper>1e+16</upper>
          <effort>-1</effort>
          <velocity>-1</velocity>
        </limit>
        <dynamics>
          <spring_reference>0</spring_reference>
          <spring_stiffness>0</spring_stiffness>
          <damping>0</damping>
          <friction>0</friction>
        </dynamics>
      </axis>
      <physics>
        <ode>
          <limit>
            <cfm>0</cfm>
            <erp>0.9</erp>
          </limit>
          <suspension>
            <cfm>0</cfm>
            <erp>0.2</erp>
          </suspension>
        </ode>
      </physics>
    </joint>
    <joint name='front_left_joint' type='revolute'>
      <parent>base_link</parent>
      <child>front_left_wheel</child>
      <pose frame=''>0 0 0 0 -0 0</pose>
      <axis>
        <xyz>0 1 0</xyz>
        <use_parent_model_frame>1</use_parent_model_frame>
        <limit>
          <lower>-1e+16</lower>
          <upper>1e+16</upper>
          <effort>-1</effort>
          <velocity>-1</velocity>
        </limit>
        <dynamics>
          <spring_reference>0</spring_reference>
          <spring_stiffness>0</spring_stiffness>
          <damping>0</damping>
          <friction>0</friction>
        </dynamics>
      </axis>
      <physics>
        <ode>
          <limit>
            <cfm>0</cfm>
            <erp>0.9</erp>
          </limit>
          <suspension>
            <cfm>0</cfm>
            <erp>0.2</erp>
          </suspension>
        </ode>
      </physics>
    </joint>
    <joint name='front_right_joint' type='revolute'>
      <parent>base_link</parent>
      <child>front_right_wheel</child>
      <pose frame=''>0 0 0 0 -0 0</pose>
      <axis>
        <xyz>0 1 0</xyz>
        <use_parent_model_frame>1</use_parent_model_frame>
        <limit>
          <lower>-1e+16</lower>
          <upper>1e+16</upper>
          <effort>-1</effort>
          <velocity>-1</velocity>
        </limit>
        <dynamics>
          <spring_reference>0</spring_reference>
          <spring_stiffness>0</spring_stiffness>
          <damping>0</damping>
          <friction>0</friction>
        </dynamics>
      </axis>
      <physics>
        <ode>
          <limit>
            <cfm>0</cfm>
            <erp>0.9</erp>
          </limit>
          <suspension>
            <cfm>0</cfm>
            <erp>0.2</erp>
          </suspension>
        </ode>
      </physics>
    </joint>
    <joint name='ray_sensor_joint' type='fixed'>
      <parent>base_link</parent>
      <child>ray_sensor</child>
      <pose frame=''>0 0 0 0 -0 0</pose>
      <physics>
        <ode>
          <limit>
            <cfm>0</cfm>
            <erp>0.2</erp>
          </limit>
          <suspension>
            <cfm>0</cfm>
            <erp>0.2</erp>
          </suspension>
        </ode>
      </physics>
    </joint>
    <static>0</static>
    <allow_auto_disable>1</allow_auto_disable>
    <plugin name='husky_diff_controller' filename='libhusky_gazebo_plugins.so'>
      <alwaysOn>1</alwaysOn>
      <updateRate>50.0</updateRate>
      <backLeftJoint>back_left_joint</backLeftJoint>
      <backRightJoint>back_right_joint</backRightJoint>
      <frontLeftJoint>front_left_joint</frontLeftJoint>
      <frontRightJoint>front_right_joint</frontRightJoint>
      <wheelSeparation>0.2</wheelSeparation>
      <wheelDiameter>0.11</wheelDiameter>
      <torque>5</torque>
    </plugin>
    <plugin name='p3d_base_controller' filename='libgazebo_ros_p3d.so'>
      <alwaysOn>1</alwaysOn>
      <updateRate>50.0</updateRate>
      <bodyName>base_link</bodyName>
      <topicName>base_pose_ground_truth</topicName>
      <gaussianNoise>0</gaussianNoise>
      <frameName>map</frameName>
      <xyzOffsets>0 0 0</xyzOffsets>
      <rpyOffsets>0 0 0</rpyOffsets>
    </plugin>
  </model>
</sdf>

model.sdf文件一般保存到.gazebo/models/中。

可以在gazeb中使用model editor进行编辑和查看

如何启动world文件:rosrun gazebo_ros gazebo xxx.world

然后加载机器人模型!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

gazebo通过sdf搭建仿真环境和机器人Husky 的相关文章

随机推荐

  • 【深入理解Linux内核】【分页】相关函数或宏

    PAGE SHIFT PMD SHIFT PUDSHIFT PGDIR SHIFT 指定offset字段位数 指定offset和table总位数 确定页上级目录能够映射的区域大小 确定页全局目录能够映射的区域大小 PTRS PER PTE
  • 第二讲:网线的制作方法及步骤

    这几年 网络搭建与应用 专业技能大赛所需网线需要参赛学生自己制作 所以今天讲讲网线的制作方法及步骤 所要原料 双绞线 RJ45水晶头 所需工具 双绞线压线钳 双绞线测试仪 在制作网线之前 我们先来了解双绞线的连接方法 双绞线的连接方法有两种
  • windows下redis 和 hiredis的编译与使用

    转 http www cnblogs com raker p 4368741 html 果然 高端的程序员真心是鸟都不鸟windows的 redis的客户端找了一圈愣是没有C 的windows版本 我要做个windows上的C 的服务器都没
  • ubuntu安装SSH2

    apt get install libssh2 1 dev libssh2 php service apache2 restart 安装完成之后 可以使用SCP远程复制文件 connection ssh2 connect 192 168 1
  • 读取本地文件到读出p.node涉及的函数

    这里是读取本地文件的所调用的函数 func ParseNode rawurl string Node error if m incompleteNodeURL FindStringSubmatch rawurl m nil id err H
  • 【学习笔记】多模态综述

    多模态综述 前言 1 CLIP ViLT 2 ALBEF 3 VLMO 4 BLIP 5 CoCa 6 BeiTv3 总结 参考链接 前言 本篇学习笔记虽然是多模态综述 本质上是对ViLT后多模态模型的总结 时间线为2021年至2022年
  • Linux文件描述符和重定向

    文件描述符 0 stdin 标准输入 1 stdout 标准输出 2 stderr 标准错误 成功和不成功的命令 student myhost ls ls cannot access No such file or directory st
  • STM32定时器

    目录 一 定时器的基本介绍 二 定时器的原理框图 1 定时器时钟 2 时基单元 3 捕获输入 4 PWM输出 三 定时器的应用 1 定时器的基础定时计数功能 2 PWM比较输出 3 外部脉冲计数 a 外部触发输入 ETR 外部时钟模式2 b
  • 617. 合并二叉树(c++)

    暴力解 当t1为空返回t2 当t2为空返回t1 当t1 t2都有值 new新节点为两个节点的和 新节点左子树为原始节点左子树合并 新节点右子树为原始节点右子树合并 Definition for a binary tree node stru
  • stm32 /*TIM定时器使用

    提示 文章写完后 目录可以自动生成 如何生成可参考右边的帮助文档 文章目录 一部分 定时器定时计数功能 一 定时器RCC内部时钟初始化配置 二 定时时间的计算 试验现象 晶振原理 1s时间计算 1min时间计算 制作时钟读数表 试验现象 试
  • leetcode刷题(四)——概率论与数理统计(一)

    leetcode刷题系列四 主要的内容涉及概率论和数理统计的知识 例题 算法分析 int dp 12 70 double dicesProbability int n int returnSize int i j k double f do
  • ubuntu安装及深度学习框架(CUDA、cuDNN、Anaconda、pytorch、pycharm)

    文章目录 前言 一 安装ubuntu20 04 4 1 准备工作 2 开始安装 二 安装英伟达驱动 方案一 不推荐 1 下载NVIDIA驱动 2 安装GCC 3 卸载原有NVIDIA驱动 一般都没有 4 禁用通用驱动 三 安装英伟达驱动 方
  • 上位机与欧姆龙PLC的Fins tcp通讯

    参考1 147条消息 欧姆龙PLC的FinsTCP协议 weixin 37700863的博客 CSDN博客 欧姆龙fins协议tcp 参考2 147条消息 FinsTCP协议报文详细分析 常哥说编程的博客 CSDN博客 fins协议 参考3
  • 在R语言中利用mice包进行缺失值的线性回归填补

    在数据分析中 我们会经常遇到缺失值问题 一般的缺失值的处理方法有删除法和填补法 通过删除法 我们可以删除缺失数据的样本或者变量 而缺失值填补法又可分为单变量填补法和多变量填补法 其中单变量填补法又可分为随机填补法 中位数 中值填补法 回归填
  • 常见http状态码详解

    状态码 类别 原因短语 1XX Informational 信息性状态码 接受的请求正在处理 2XX Success 成功状态码 请求正常处理完毕 3XX Redirection 重定向状态码 需要进行附加操作以完成请求 4XX Clien
  • 架构总结图

  • 斑马网络和荣威RX5深度研究

    锋影 email 174176320 qq com 佐智汽车就李想的观点访谈了两位业内专家 他们的回答如下 专家A 这个是需求推动 有需求就有人做 特斯拉用Linux一样有地图 Android过于复杂 可靠性问题比Linux大几个数量级 做
  • 调用服务工具类-HttpsUtil

    import java io BufferedReader import java io IOException import java io InputStream import java io InputStreamReader imp
  • 星际文件存储IPFS是如何颠覆云存储的?

    一句话概括 IPFS The InterPlanetary File System 星际文件存储系统是一种点到点的分布式文件系统 它连接的计算设备都拥有相同的文件管理模式 从某种意义上来说这个概念跟Web的最初理念很类似 但是实际上IPFS
  • gazebo通过sdf搭建仿真环境和机器人Husky

    具体格式要求可参考 http sdformat org spec ver 1 6 elem sdf