gazebo小车模型(附带仿真环境)

Posted zylyehuo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了gazebo小车模型(附带仿真环境)相关的知识,希望对你有一定的参考价值。

gazebo小车模型(附带仿真环境)

参考链接

1、(https://blog.csdn.net/qq_43406338/article/details/109600827?ops_request_misc="request_id"%3A"168087043216800182749128"%2C"scm"%3A"20140713.130102334.pc_all."&request_id=168087043216800182749128&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-1-109600827-null-null.142v82insert_down1,201v4add_ask,239v2insert_chatgpt&utm_term=Resource not found%3A gazebo_ros ROS path [0]%3D%2Fopt%2Fros%2Fmelodic%2Fshare%2Fros ROS path [1]%3D%2Fhome%2Fyehuo%2Fmycar_ws%2Fsrc ROS path [2]%3D%2Fopt%2Fros%2Fmelodic%2Fshare The traceback for the exception was written to the log &spm=1018.2226.3001.4187)
2、(https://blog.csdn.net/samsu0108/article/details/121686776?ops_request_misc=&request_id=&biz_id=102&utm_term=[Err] [REST.cc:205] Error in R&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-0-121686776.142v82insert_down1,201v4add_ask,239v2insert_chatgpt&spm=1018.2226.3001.4187)
3、(https://blog.csdn.net/qq_39400324/article/details/125051463?ops_request_misc=&request_id=&biz_id=102&utm_term=Error [Converter.cc:151] Unabl&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-0-125051463.142v82insert_down1,201v4add_ask,239v2insert_chatgpt&spm=1018.2226.3001.4187)
4、(http://www.autolabor.com.cn/book/ROSTutorials/di-6-zhang-ji-qi-ren-xi-tong-fang-zhen/66-urdfji-cheng-gazebo.html)
5、(https://www.bilibili.com/video/BV1Ci4y1L7ZZ?p=271&vd_source=4acdb875c05ce9dccfce3cd6cfaac651)

成果图

STEP1:创建工作空间

mkdir -p mycar_ws/src
cd mycar
catkin_make

STEP2:在vscode中准备需要的文件夹

右键src,点击Create Catkin Package
先输入包名:mycar
再输入依赖工具:urdf xacro gazebo_ros gazebo_ros_control gazebo_plugins

STEP3:在vscode中准备需要的文件夹

在mycar目录下依次创建 launch、urdf、worlds文件夹
在 mycar/urdf 文件夹下再创建 xacro文件夹
结构如下图所示

STEP4:mycar/launch

创建 environment.launch 文件

mycar/launch/environment.launch

<launch>

    <param name="robot_description" command="$(find xacro)/xacro $(find mycar)/urdf/xacro/car.urdf.xacro" />

    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="world_name" value="$(find mycar)/worlds/box_house.world" />
    </include>

    <node pkg="gazebo_ros" type="spawn_model" name="model" args="-urdf -model mycar -param robot_description"  />
</launch>

STEP5:下载worlds文件夹下需要的文件

终端输入命令
git clone https://github.com/zx595306686/sim_demo.git
得到以下文件

将第三个文件 box_house.world 复制到mycar_ws中创建的worlds文件夹下

STEP6:mycar/urdf/xacro

创建以下文件

mycar/urdf/xacro/car_base.urdf.xacro

<robot name="mycar" xmlns:xacro="http://www.ros.org/wiki/xacro">

    <xacro:property name="PI" value="3.141"/>

    <material name="black">
        <color rgba="0.0 0.0 0.0 1.0" />
    </material>

    <xacro:property name="footprint_radius" value="0.001" /> 
    <xacro:property name="base_radius" value="0.1" /> 
    <xacro:property name="base_length" value="0.08" /> 
    <xacro:property name="earth_space" value="0.015" /> 
     <xacro:property name="base_joint_z" value="$base_length / 2 + earth_space" /> 

     <xacro:property name="base_mass" value="2" /> 

    <!-- base -->
    <link name="base_footprint">
      <visual>
        <geometry>
          <sphere radius="$footprint_radius" />
        </geometry>
      </visual>
    </link>

    <link name="base_link">
      <visual>
        <geometry>
          <cylinder radius="$base_radius" length="$base_length" />
        </geometry>
        <origin xyz="0 0 0" rpy="0 0 0" />
        <material name="baselink_color">
          <color rgba="1.0 0.5 0.2 0.7" />
        </material>
      </visual>

      <collision>
        <geometry>
          <cylinder radius="$base_radius" length="$base_length" />
        </geometry>
        <origin xyz="0 0 0" rpy="0 0 0" />
      </collision>
      <xacro:cylinder_inertial_matrix m="$base_mass" r="$base_radius" h="$base_length" />

    </link>

    <gazebo reference="base_link">
        <material>Gazebo/Yellow</material>
    </gazebo>

    <joint name="link2footprint" type="fixed">
      <parent link="base_footprint" />
      <child link="base_link" />
      <origin xyz="0 0 $earth_space + base_length / 2 "  rpy="0 0 0"/>
    </joint>

    <!-- qudong wheel -->
    <xacro:property name="wheel_radius" value="0.0325" />
    <xacro:property name="wheel_length" value="0.015" />
    <xacro:property name="wheel_mass" value="0.05" />
    
    <xacro:macro name="add_wheels" params="name flag">
      <link name="$name_wheel">
        <visual>
          <geometry>
            <cylinder radius="$wheel_radius" length="$wheel_length" />
          </geometry>
          <origin xyz="0.0 0.0 0.0" rpy="$PI / 2 0.0 0.0" />
          <material name="black" />
        </visual>

        <collision>
          <geometry>
            <cylinder radius="$wheel_radius" length="$wheel_length" />
          </geometry>
          <origin xyz="0.0 0.0 0.0" rpy="$PI / 2 0.0 0.0" />
        </collision>
        <xacro:cylinder_inertial_matrix m="$wheel_mass" r="$wheel_radius" h="$wheel_length" />

      </link>

      <gazebo reference="$name_wheel">
        <material>Gazebo/Red</material>
      </gazebo>

      <joint name="$name_wheel2base_link" type="continuous">
        <parent link="base_link" />
        <child link="$name_wheel" />
        <origin xyz="0 $flag * base_radius $-(earth_space + base_length / 2 - wheel_radius) " />
        <axis xyz="0 1 0" />
      </joint>
    </xacro:macro>
    <xacro:add_wheels name="left" flag="1" />
    <xacro:add_wheels name="right" flag="-1" />
 
    <!-- zhicheng/wanxiang wheel -->
    <xacro:property name="support_wheel_radius" value="0.0075" /> 
    <xacro:property name="support_wheel_mass" value="0.01" /> 

    <xacro:macro name="add_support_wheel" params="name flag" >
      <link name="$name_wheel">
        <visual>
            <geometry>
                <sphere radius="$support_wheel_radius" />
            </geometry>
            <origin xyz="0 0 0" rpy="0 0 0" />
            <material name="black" />
        </visual>

        <collision>
            <geometry>
                <sphere radius="$support_wheel_radius" />
            </geometry>
            <origin xyz="0 0 0" rpy="0 0 0" />
        </collision>
        <xacro:sphere_inertial_matrix m="$support_wheel_mass" r="$support_wheel_radius" />

      </link>

      <gazebo reference="$name_wheel">
        <material>Gazebo/Red</material>
      </gazebo>

      <joint name="$name_wheel2base_link" type="continuous">
          <parent link="base_link" />
          <child link="$name_wheel" />
          <origin xyz="$flag * (base_radius - support_wheel_radius) 0 $-(base_length / 2 + earth_space / 2)" />
          <axis xyz="1 1 1" />
      </joint>
    </xacro:macro>

    <xacro:add_support_wheel name="front" flag="1" />
    <xacro:add_support_wheel name="back" flag="-1" />

</robot>

mycar/urdf/xacro/car_camera.urdf.xacro

<robot name="my_camera" xmlns:xacro="http://wiki.ros.org/xacro">

    <xacro:property name="camera_length" value="0.01" />
    <xacro:property name="camera_width" value="0.025" /> 
    <xacro:property name="camera_height" value="0.025" /> 
    <xacro:property name="camera_x" value="0.08" />
    <xacro:property name="camera_y" value="0.0" /> 
    <xacro:property name="camera_z" value="$base_length / 2 + camera_height / 2" /> 
    <xacro:property name="camera_mass" value="0.01" />

   
    <link name="camera">
        <visual>
            <geometry>
                <box size="$camera_length $camera_width $camera_height" />
            </geometry>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
            <material name="black" />
        </visual>

        <collision>
            <geometry>
                <box size="$camera_length $camera_width $camera_height" />
            </geometry>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
        </collision>
        <xacro:Box_inertial_matrix m="$camera_mass" l="$camera_length" w="$camera_width" h="$camera_height" />

    </link>

    <gazebo reference="camera">
        <material>Gazebo/Blue</material>
    </gazebo>


    <joint name="camera2base_link" type="fixed">
        <parent link="base_link" />
        <child link="camera" />
        <origin xyz="$camera_x $camera_y $camera_z" />
    </joint>
    
</robot>

mycar/urdf/xacro/car_laser.urdf.xacro

<robot name="my_laser" xmlns:xacro="http://wiki.ros.org/xacro">

    <xacro:property name="support_length" value="0.15" /> 
    <xacro:property name="support_radius" value="0.01" /> 
    <xacro:property name="support_x" value="0.0" /> 
    <xacro:property name="support_y" value="0.0" /> 
    <xacro:property name="support_z" value="$base_length / 2 + support_length / 2" /> 
    <xacro:property name="support_mass" value="0.02" /> 


    <link name="support">
        <visual>
            <geometry>
                <cylinder radius="$support_radius" length="$support_length" />
            </geometry>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
            <material name="red">
                <color rgba="0.8 0.2 0.0 0.8" />
            </material>
        </visual>

        <collision>
            <geometry>
                <cylinder radius="$support_radius" length="$support_length" />
            </geometry>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
        </collision>

        <xacro:cylinder_inertial_matrix m="$support_mass" r="$support_radius" h="$support_length" />

    </link>

    <gazebo reference="support">
        <material>Gazebo/Grey</material>
    </gazebo>

    <joint name="support2base_link" type="fixed">
        <parent link="base_link" />
        <child link="support" />
        <origin xyz="$support_x $support_y $support_z" />
    </joint>


    <xacro:property name="laser_length" value="0.05" />
    <xacro:property name="laser_radius" value="0.03" />
    <xacro:property name="laser_x" value="0.0" />
    <xacro:property name="laser_y" value="0.0" /> 
    <xacro:property name="laser_z" value="$support_length / 2 + laser_length / 2" /> 
     <xacro:property name="laser_mass" value="0.1" />

  
    <link name="laser">
        <visual>
            <geometry>
                <cylinder radius="$laser_radius" length="$laser_length" />
            </geometry>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
            <material name="black" />
        </visual>

        <collision>
            <geometry>
                <cylinder radius="$laser_radius" length="$laser_length" />
            </geometry>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
        </collision>
        <xacro:cylinder_inertial_matrix m="$laser_mass" r="$laser_radius" h="$laser_length" />

    </link>

    <gazebo reference="laser">
        <material>Gazebo/Black</material>
    </gazebo>

    <joint name="laser2support" type="fixed">
        <parent link="support" />
        <child link="laser" />
        <origin xyz="$laser_x $laser_y $laser_z" />
    </joint>

</robot>

mycar/urdf/xacro/car.urdf.xacro

<robot name="car" xmlns:xacro="http://wiki.ros.org/xacro">
    <xacro:include filename="inertial_matrix.xacro" />
    <xacro:include filename="car_base.urdf.xacro" />
    <xacro:include filename="car_camera.urdf.xacro" />
    <xacro:include filename="car_laser.urdf.xacro" />
</robot>

mycar/urdf/xacro/inertial_matrix.xacro

<robot name="base" xmlns:xacro="http://wiki.ros.org/xacro">
    <!-- Macro for inertia matrix -->
    <xacro:macro name="sphere_inertial_matrix" params="m r">
        <inertial>
            <mass value="$m" />
            <inertia ixx="$2*m*r*r/5" ixy="0" ixz="0"
                iyy="$2*m*r*r/5" iyz="0" 
                izz="$2*m*r*r/5" />
        </inertial>
    </xacro:macro>

    <xacro:macro name="cylinder_inertial_matrix" params="m r h">
        <inertial>
            <mass value="$m" />
            <inertia ixx="$m*(3*r*r+h*h)/12" ixy = "0" ixz = "0"
                iyy="$m*(3*r*r+h*h)/12" iyz = "0"
                izz="$m*r*r/2" /> 
        </inertial>
    </xacro:macro>

    <xacro:macro name="Box_inertial_matrix" params="m l w h">
       <inertial>
               <mass value="$m" />
               <inertia ixx="$m*(h*h + l*l)/12" ixy = "0" ixz = "0"
                   iyy="$m*(w*w + l*l)/12" iyz= "0"
                   izz="$m*(w*w + h*h)/12" />
       </inertial>
   </xacro:macro>
</robot>

STEP7:运行

启动 roscore

建议在vscode外终端启动(也可在vscode中启动)

设置环境变量,启动gazebo

在vscode中新建终端
注意要进入 mycar_ws 路径下
依次执行以下命令

出现如下画面即代表创建成功
第一次创建时可检查一下左栏选项是否一致

常见问题汇总

1、ResourceNotFound: gazebo_ros

ResourceNotFound: gazebo_ros
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/park/catkin_ws/src
ROS path [2]=/opt/ros/kinetic/share
问题:找不到资源
解决办法:直接安装缺失的gazebo:
$ sudo apt-get install ros-kinetic-gazebo-ros-pkgs ros-kinetic-gazebo-ros-control

2、[Err] [REST.cc:205] Error in REST request Gazebo 启动报错

1、在终端输入命令
   sudo vim ~/.ignition/fuel/config.yaml
2、将https://api.ignitionfuel.org替换为https://fuel.ignitionrobotics.org

3、Unable to convert from SDF version 1.7 to 1.6

将 environment.world文件 中第一行的<sdf version = \'1.7\'>该为<sdf version = \'1.6\'>即可。

Gazebo機器人仿真學習探索筆記機器人模型

gazebo_models:https://bitbucket.org/osrf/gazebo_models

模型庫下載,可以參考如下命令:

~/Rob_Soft/Gazebo7$ hg clone https://bitbucket.org/osrf/gazebo_models
下載更改目錄下載到指定文件夾中。




模型庫的結構 目錄 配置等可以參考官方文檔,注意model.sdf。

當然也可以將自己制作的模型上傳到庫中,文檔中也有具體說明。

code$ hg clone https://yourname@bitbucket.org/yourname/gazebo_models
gazebo_models$ hg add mymodel
gazebo_models$ hg add mymodel/model.config
gazebo_models$ hg add mymodel/model.sdf
gazebo_models$ hg commit
gazebo_models$ hg push


SDF模型生成

~/Rob_Soft/Gazebo7$ gedit box.sdf
在其中輸入:

<?xml version='1.0'?>
<sdf version="1.4">
<model name="my_model">
  <pose>0 0 0.5 0 0 0</pose>
  <static>true</static>
    <link name="link">
      <inertial>
        <mass>1.0</mass>
        <inertia> <!-- interias are tricky to compute -->
          <!-- http://answers.gazebosim.org/question/4372/the-inertia-matrix-explained/ -->
          <ixx>0.083</ixx>       <!-- for a box: ixx = 0.083 * mass * (y*y + z*z) -->
          <ixy>0.0</ixy>         <!-- for a box: ixy = 0 -->
          <ixz>0.0</ixz>         <!-- for a box: ixz = 0 -->
          <iyy>0.083</iyy>       <!-- for a box: iyy = 0.083 * mass * (x*x + z*z) -->
          <iyz>0.0</iyz>         <!-- for a box: iyz = 0 -->
          <izz>0.083</izz>       <!-- for a box: izz = 0.083 * mass * (x*x + y*y) -->
        </inertia>
      </inertial>
      <collision name="collision">
        <geometry>
          <box>
            <size>1 1 1</size>
          </box>
        </geometry>
      </collision>
      <visual name="visual">
        <geometry>
          <box>
            <size>1 1 1</size>
          </box>
        </geometry>
      </visual>
    </link>
  </model>
</sdf>
然後保存即可。


機器人模型

1 設置模型目錄

~/.gazebo/models$ mkdir -p ~/.gazebo/models/my_robot
~/.gazebo/models$ gedit ~/.gazebo/models/my_robot/model.config
<?xml version="1.0"?>
<model>
  <name>My Robot</name>
  <version>1.0</version>
  <sdf version='1.4'>model.sdf</sdf>

  <author>
   <name>My Name</name>
   <email>me@my.email</email>
  </author>

  <description>
    My awesome robot.
  </description>
</model>


機器人模型sdf:

~/.gazebo/models$ gedit ~/.gazebo/models/my_robot/model.sdf
加入如下內容:

<?xml version='1.0'?>
<sdf version='1.4'>
  <model name="my_robot">
  <static>false</static>
          <link name='chassis'>
            <pose>0 0 .1 0 0 0</pose>
            <collision name='collision'>
              <geometry>
                <box>
                  <size>.4 .2 .1</size>
                </box>
              </geometry>
            </collision>

            <visual name='visual'>
              <geometry>
                <box>
                  <size>.4 .2 .1</size>
                </box>
              </geometry>
            </visual>

          <collision name='caster_collision'>
            <pose>-0.15 0 -0.05 0 0 0</pose>
            <geometry>
                <sphere>
                <radius>.05</radius>
              </sphere>
            </geometry>

            <surface>
              <friction>
                <ode>
                  <mu>0</mu>
                  <mu2>0</mu2>
                  <slip1>1.0</slip1>
                  <slip2>1.0</slip2>
                </ode>
              </friction>
            </surface>
          </collision>

          <visual name='caster_visual'>
            <pose>-0.15 0 -0.05 0 0 0</pose>
            <geometry>
              <sphere>
                <radius>.05</radius>
              </sphere>
            </geometry>
          </visual>
          </link>

      <link name="left_wheel">
        <pose>0.1 0.13 0.1 0 1.5707 1.5707</pose>
        <collision name="collision">
          <geometry>
            <cylinder>
              <radius>.1</radius>
              <length>.05</length>
            </cylinder>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <cylinder>
              <radius>.1</radius>
              <length>.05</length>
            </cylinder>
          </geometry>
        </visual>
      </link>

      <link name="right_wheel">
        <pose>0.1 -0.13 0.1 0 1.5707 1.5707</pose>
        <collision name="collision">
          <geometry>
            <cylinder>
              <radius>.1</radius>
              <length>.05</length>
            </cylinder>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <cylinder>
              <radius>.1</radius>
              <length>.05</length>
            </cylinder>
          </geometry>
        </visual>
      </link>

      <joint type="revolute" name="left_wheel_hinge">
        <pose>0 0 -0.03 0 0 0</pose>
        <child>left_wheel</child>
        <parent>chassis</parent>
        <axis>
          <xyz>0 1 0</xyz>
        </axis>
      </joint>

      <joint type="revolute" name="right_wheel_hinge">
        <pose>0 0 0.03 0 0 0</pose>
        <child>right_wheel</child>
        <parent>chassis</parent>
        <axis>
          <xyz>0 1 0</xyz>
        </axis>
      </joint>

  </model>
</sdf>

這樣就構建了一個簡單的兩輪差動的移動機器人模型。使用Force工具,可以使其在仿真中運動。



~/.gazebo/models$ gedit ~/.gazebo/models/my_robot/model.sdf
修改其中如下部分:

            <visual name='visual'>
              <geometry>
                <mesh>
                  <uri>model://pioneer2dx/meshes/chassis.dae</uri>
                  <scale>0.9 0.5 0.5</scale>
                </mesh>
              </geometry>
            </visual>
效果如下圖所示:



添加傳感器

    <include>
      <uri>model://hokuyo</uri>
      <pose>0.2 0 0.2 0 0 0</pose>
    </include>
    <joint name="hokuyo_joint" type="revolute">
      <child>hokuyo::link</child>
      <parent>chassis</parent>
      <axis>
        <xyz>0 0 1</xyz>
        <limit>
          <upper>0</upper>
          <lower>0</lower>
        </limit>
      </axis>
    </joint>


當然也可以參考官方教程在機器人上添加其他對象。具體參考附件。



附件-官网教程汇总-构建机器人模型-Build a Robot

Model structure and requirements

Overview

Gazebo is able to dynamically load models into simulation either programmatically or through the GUI. Models exist on your computer, after they have been downloaded or created by you. This tutorial describes Gazebo's model directory structure, and the necessary files within a model directory.

Models in Gazebo define a physical entity with dynamic, kinematic, andvisual properties. In addition, a model may have one or more plugins, whichaffect the model's behavior. A model can represent anything from a simpleshape to a complex robot; even the ground is a model.

Gazebo relies on a database to store and maintain models available for usewithin simulation. The model database is a community-supported resource, soplease upload and maintain models that you create and use.

The Model Database Repository

The model database is a bitbucket repository found here.

You can clone the repository using:

    hg clone https://bitbucket.org/osrf/gazebo_models

Model Database Structure

A model database must abide by a specific directory and file structure. Theroot of a model database contains one directory for each model, and adatabase.config file with information about the model database. Each modeldirectory also has a model.config file that contains meta data about themodel. A model directory also contains the SDF for the model and any materials,meshes, and plugins.

The structure is as follows (in this example the database has only one model called model_1):

  • Database
    • database.config : Meta data about the database. This is now populated automatically from CMakeLists.txt
    • model_1 : A directory for model_1
      • model.config : Meta-data about model_1
      • model.sdf : SDF description of the model
      • model.sdf.erb : Ruby embedded SDF model description
      • meshes : A directory for all COLLADA and STL files
      • materials : A directory which should only contain the textures and scripts subdirectories
        • textures : A directory for image files (jpg, png, etc).
        • scripts : A directory for OGRE material scripts
      • plugins: A directory for plugin source and header files

Plugins Directory

This is an optional directory that contains all of the plugins for the model.

Meshes Directory

This is an optional directory that contains all of the COLLADA and/or STL files for the model.

Material Directory

This is an optional directory that contains all of the textures, images, and OGRE scripts for the model. Texture images must be placed in the textures subdirectory, and OGRE script files in the scripts directory.

Database Config

This is the database.config file in the root of the model database. This file contains license information for the models, a name for the database, and a list of all the valid models.

Note: The database.config file is only required for online repositories. A directory full of models on your local computer does not need a database.config file.

The format of this database.config is:

<?xml version='1.0'?>
<database>
  <name>name_of_this_database</name>
  <license>Creative Commons Attribution 3.0 Unported</license>
  <models>
    <uri>file://model_directory</uri>
  </models>
</database>
  • <name>

The name of the database. This is used by the GUI and other tools.

  • <license>

The license for the models within the database. We highly recommend theCreative Commons Attribution 3.0 Unported license.

  • <models>

A listing of all the model URIs within the database.

  • <uri>

    The URI for a model, this should be file://model_directory_name

Model Config

Each model must have a model.config file in the model's root directory that contains meta information about the model.

The format of this model.config is:

<?xml version="1.0"?>

<model>
  <name>My Model Name</name>
  <version>1.0</version>
  <sdf version='1.5'>model.sdf</sdf>

  <author>
    <name>My name</name>
    <email>name@email.address</email>
  </author>

  <description>
    A description of the model
  </description>
</model>
  • <name> required

Name of the model.

  • <version> required

Version of this model.

Note: This is not the version of sdf that the model uses. That informationis kept in the model.sdf file.

  • <sdf> required

The name of a SDF or URDF file that describes this model. The version attribute indicates what SDF version the file uses, and is not required for URDFs. Multiple <sdf> elements may be used in order to support multiple SDF versions.

  • <author> required

    • <name> required

    Name of the model author.* <email> required

    Email address of the author.

  • <description> required

Description of the model should include:

  • What the model is (e.g., robot, table, cup)
  • What the plugins do (functionality of the model)
  • <depend> optional

All the dependencies for this model. This is typically other models.

  • <model> optional

    • <uri> required

      URI of the model dependency.

    • <version> required

      Version of the model.

Model SDF

Each model requires a model.sdf file that contains the Simulator Description Format of the model. You can find more information on the SDF website.

Model SDF.ERB

Standard SDF file which can contain ruby code embedded. This option is used toprogramatically generate SDF files using Embedded Ruby codetemplates. Please note that the ruby conversion should be done manually (erbmodel.sdf.erb > model.sdf) and the final model.sdf file must be uploadedtogether with the model.sdf.erb (this one only for reference).

Examples of sdf.erb files are available in thegazebo_models repository(some of them use the deprecated suffix .rsdf). An easy ERB file is theflocking.world.erbwhich uses a simple loop.

以上是关于gazebo小车模型(附带仿真环境)的主要内容,如果未能解决你的问题,请参考以下文章

使用键盘控制gazebo小车模型运动

手把手开始ROS仿真小车仿真环境及小车搭建

为啥在gazebo中运动的小车在rviz中不运动

ROS学习笔记-导入并打开搭建好的仿真环境

ROS学习笔记之——gazebo仿真

Gazebo与ros_control:让模型动起来