ROS入門(四)——Gazebo的基本使用


ROS入門(四)——Gazebo的基本使用
  iwehdio的博客園:https://www.cnblogs.com/iwehdio/

參考教程:
gazebo入門教程(一) 安裝,UI介紹:https://blog.csdn.net/weixin_41045354/article/details/84881498
gazebo入門教程(二)建立簡單模型:https://blog.csdn.net/weixin_41045354/article/details/103668162

1、界面概述

  • 卸載 ros-melodic 版本安裝的 Gazebo9,安裝 Gazebo11。

    $ sudo apt-get remove gazebo9 gazebo9-common gazebo9-plugin-base libgazebo9:amd64 libgazebo9-dev:amd64 ros-melodic-gazebo-*                   
    
    $ sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
    $ wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
    $ sudo apt-get update
    $ sudo apt-get install gazebo11
    $ sudo apt-get install libgazebo11-dev
    
  • 啟動:

    • 命令行:roslaunch gazebo_ros empty_world.launch
    • 全局命令:Alt + F2,鍵入 gazebo 后回車。
  • 軟件視圖:

    • 場景:展示仿真模型。
    • 左面板:
      • WORLD:“世界”選項卡,顯示當前在場景中的模型,並允許你查看和修改模型參數,例如它們的姿勢。你還可以通過展開“GUI”選項並調整相機姿勢來更改攝像機視角。
      • INSERT:“插入”選項卡,向模擬添加新對象(模型)。要查看模型列表,您可能需要單擊箭頭以展開文件夾。在要插入的模型上單擊(和釋放),然后在場景中再次單擊以添加它。
      • LAYER:“圖層”選項卡可組織和顯示模擬中可用的不同可視化組(如果有)。圖層可以包含一個或多個模型。打開或關閉圖層將顯示或隱藏該圖層中的模型。這是一個可選功能,因此在大多數情況下此選項卡將為空。
    • 右面板:默認情況下Gazeb界面隱藏右側面板。單擊並拖動欄以將其打開。右側面板可用於與所選模型(joint)的移動部件進行交互。如果未在場景中選擇任何模型,則面板不會顯示任何信息。
    • 上部工具欄:是Gazebo的主工具欄,它包含一些最常用的與模擬器交互的選項,例如:選擇,移動,旋轉和縮放對象等按鈕; 創造一些簡單的形狀(如立方體,球體,圓柱體); 復制/粘貼模型選項。
      • 選擇模式(select mode):在場景中導航。
      • 平移模式(translate mode):選擇要移動的模型。
      • 旋轉模式(rotate mode):選擇要旋轉的模型。
      • 縮放模式(scale mode):選擇要縮放的模型。
      • 撤消/重做(undo/redo):撤消/重做場景中的操作。
      • 簡單形狀(simple shape):將簡單形狀插入場景中。
      • 燈光(lights):為場景添加燈光。
      • 復制/粘貼(copy/paste):在場景中復制/粘貼模型。
      • Align:將模型彼此對齊。
      • Snap:將一個模型與另一個模型對齊。
      • 更改視圖(change view):從各個角度查看場景。
    • 底部工具欄:顯示有關模擬的數據,如模擬時間及其與實際時間的關系。
      • “模擬時間”是指模擬運行時模擬器中時間流逝的速度。模擬時間可以比實時更慢或更快,具體取決於運行模擬所需的計算量。
      • “實時”是指模擬器運行時在現實生活中經過的實際時間。模擬時間和實時之間的關系稱為“實時因子”(RTF)。它是模擬時間與實時的比率。RTF衡量模擬運行與實時相比的速度或速率。
      • Gazebo的世界狀況每迭代一次,計算一次。你可以在底部工具欄的右側看到迭代次數。每次迭代都會將模擬推進固定的秒數,稱為步長。默認情況下,步長為1 ms。您可以按暫停按鈕暫停模擬,並使用步驟按鈕逐步執行幾個步驟。
    • 菜單欄:更具體的功能。
    • 鼠標操作:
      • shift + 左鍵:旋轉視角。
      • 左鍵:平移時間。
      • 滾輪:縮放大小。

2、創建一個簡單的機器人

  • 進入模型編輯器,在頂部菜單欄中單擊Edit,然后選擇Model Editor。或者,使用熱鍵Ctrl + M。

    • 左側面板和頂部工具欄僅包含用於編輯和創建模型零件的小部件。
    • 上方的工具欄包含用於編輯模型的工具。包括用於與場景中的對象進行交互的工具。可用的工具包括選擇,平移,縮放,旋轉,撤消和重做,復制和粘貼,對齊,捕捉,視圖調整以及聯合創建。
    • 左面板有兩個用於編輯模型的標簽。
      • Insert 插入標簽:用於添加關節和模型約束的工具。
        • 您可以將新零件(鏈接和模型)添加到模型編輯器。共分為三個部分。
        • 簡單形狀:這些是可以插入以在模型中形成鏈接的基本幾何形狀。
        • 自定義形狀:該Add按鈕允許您從模型的鏈接中導入自定義網格。目前,它支持COLLADA(.dae),3D Systems(.stl),Wavefront(.obj)和W3C SVG(.svg)文件。
        • 模型數據庫:具有模型列表。可以按照與簡單形狀相同的方式將它們插入到“模型編輯器”中。插入后,它們稱為嵌套模型
      • Model “模型”選項卡:允許編輯模型屬性和內容。
        • 可以設置要構建的模型的名稱和基本參數。它顯示了模型中的鏈接,關節,模型約束和插件的列表。可以使用Link Inspector修改參數。
        • 可以使用下邊的這些方法打開它。雙擊列表中的項目 /
          雙擊場景中的項目 / 右鍵單擊列表中的項目,然后選擇 Open Link Inspector / 右鍵單擊場景中的項目,然后選擇 Open Link Inspector。
  • 創建車輛:

    1. 底盤。

      • 在左側面板的“insert”選項卡中,在“box”圖標上單擊一次,將光標移至“場景”中的任何位置,然后再次單擊以釋放框。

      • 接下來,調整盒子的尺寸。我們可以通過選擇頂部工具欄上的“縮放”(第四個)工具來做到這一點。在“場景”中選擇該框,並且該框上方應顯示RGB標記。紅色標記代表X軸,綠色代表Y,藍色代表Z。

      • 將底盤降低到更靠近地面的位置。雙擊底盤模型以調出檢查器鏈接檢查器(link inspector)。向下滾動到 link 選項卡的底部以找到 Pose 參數,並將其更改Z為0.4m,然后在框外單擊。單擊OK以保存更改並關閉檢查器。

      • link 選項卡有兩個Pose,一定要注意設置的是下方的Pose。

    2. 前輪。

      • 從左側面板上的 insert 選項卡插入圓柱體。

      • 使用Link Inspector沿X軸旋轉它。雙擊圓柱體,滾動到底部的 Pose 部分,然后更改Roll為1.5707弧度(90度),然后在框外單擊。暫時不要關閉檢查器。

      • 接下來,通過提供確切的尺寸來調整輪子的尺寸。轉到 visual 視覺選項卡以查看此鏈接中的視覺列表。向下滾動到Geometry部分,然后將其更改 Radius 為0.3m和 Length 為0.25m。

      • 現在,在較大的圓柱體內可以看到較小的圓柱。因為我們僅更改了視覺幾何體,而沒有更改碰撞。visual 是鏈接的圖形表示,不影響物理模擬。切換到 collision 選項。設置Radius:0.3m和Length:0.25m 單擊OK以保存更改並關閉檢查器。

      • 通過復制粘貼創建另一個前輪。選中剛剛創建的前輪,在上方工具欄中點擊復制(右起第六個),再點擊粘貼(右起第五個),在場景中單擊插入副本。

      • 現在,通過沿X軸正方向(場景中的紅色標記)對齊底盤,確保車輛能夠正確行駛。在下一步中添加車輪時,請確保它們位於沿X軸正方向延伸的車輛末端。

      • 底盤和車輪目前是自由移動的車身。為了限制它們的運動,我們將在每個車輪和底盤之間添加關節。單擊頂部工具欄上的 Joint 圖標(右起第一個)以彈出 Create Joint 對話框。

      • Create Joint 對話框包含通常為關節指定的關節屬性。在配置任何屬性之前,系統會提示您選擇關節的父級和子級鏈接。將鼠標移到“場景”中的底盤上以使其突出顯示,然后單擊以將其設置為關節的父級。

        • 將鼠標移至左前輪;一條線現在應該從機箱的原點延伸到鼠標的末端。單擊輪子將其設置為關節的子代。創建一個新的關節。默認情況下,它是旋轉關節(Revolute),恰好是我們想要的 Joint Types 。
      • 接下來,我們需要配置輪子的旋轉軸。在 Create Joint 對話框中,找到 Joint axis 並將其更改為Z(0,0,1)。注意輪子各個軸上的顏色顯示。您應該看到一個黃色的環現在出現在關節圖的藍色箭頭上方,表示其為旋轉軸 。

      • 為了使車輪與底盤對齊,我們將在“ Joint Creation”對話框的部分中使用不同的對齊選項Align links。首先,我們將在X軸上對齊,因此單擊 X Align Max 選項以查看對齊結果。圓柱體應突出顯示以指示其姿勢已更改。

      • 在我們的示例中,我們要使輪子與底盤平齊。要使車輪更靠近,請單擊Y Align Max選項。但是,這還不是我們想要的。單擊Y對齊選項旁邊的Reverse選項,以將輪子的最小值(最大值的反方向)與底盤的最大值對齊。最后點擊按Create。

        • 注意,此 Reverse 選項適用於子鏈接,因為下面的下拉列表中顯示的默認對齊方式配置為 Child to Parent。如果設置了 Parent to Child 配置,則 Reverse 選項將應用於父鏈接
      • 要將輪子放置在地面上方,請雙擊輪子以打開鏈接檢查器(link inspector)。我們可以使用Pose對話框底部的部分來移動輪子。假設輪子的半徑為0.3m,請繼續並將Z位置更改為0.3m以放置在地面上,然后按OK。

      • 將另一個前輪做同樣的操作,注意使用 Y Align Min 選項將右輪對准底盤的另一側。

    3. 腳輪。

      • 單擊左側面板上的“球形”按鈕,然后將其插入場景。
      • 通過提供與前輪相同的確切尺寸來調整球體的大小。visual 選項卡Geometry部分並將其更改Radius為0.2m。確保對“collision”選項卡中的碰撞尺寸也執行相同的操作。
      • 要在腳輪和底盤之間創建關節,請單擊頂部工具欄上的Joint圖標,以顯示Joint Creation對話框。將鼠標移至場景,然后選擇底盤作為父鏈接,並選擇球作為子鏈接。
      • 腳輪在所有方向滾動,並且沒有特定的旋轉軸。在涼亭中,這是使用球形接頭模擬的。因此,在Joint types選項中,選擇Ball(球連接)。
      • 接下來,對准腳輪,使其與底盤居中,並位於后端。在Align links部分中,選擇Y Align Center,選擇在Y軸上居中的選項,然后選擇X Align Min(最小對齊),使腳輪移動到車輪右后方的選項。按下Create按鈕以完成關節創建過程。
      • 打開link inspector並將Z位置設置為0.2m。
    4. 添加傳感器。

      • 選擇Insert選項卡以查看此部分中可用的模型列表(Model Database)。在列表中找到“深度相機” (Depth Camera),然后單擊它以開始下載模型。

      • 看起來像一個小立方體。將鼠標移到場景上,然后單擊汽車前面的空白處以插入深度攝像頭。移動深度攝像頭,使其位於車輛前部底盤的頂部,並大致位於Y軸的中心。

      • 將深度相機固定到機箱上。單擊頂部工具欄中的“關節”(joint)圖標以打開“關節創建” (Joint Creation )對話框。將鼠標移至場景,然后選擇機箱作為父鏈接,選擇深度攝像頭作為子鏈接。選擇Fixed選項(即固定連接)。

    5. 添加插件。

      • 在Model Plugins選項下面,單擊Add按鈕,彈出一個“模型插件檢查器”。

      • 插件名為 smallcar_follower,使用的插件為libFollowerPlugin.so。

    6. 保存模型,退出模型編輯器。

      • 要測試插件是否正常工作,請在汽車前面插入一個盒子,然后觀察汽車向其緩慢移動。

3、模型文件

  • model.config:

    <?xml version="1.0" ?>
    <model>
        <name>demo1</name>
        <version>1.0</version>
        <sdf version="1.7">model.sdf</sdf>
        <author>
            <name></name>
            <email></email>
        </author>
        <description></description>
    </model>
    
  • model.sdf:

    <?xml version='1.0'?>
    <sdf version='1.7'>
      <model name='demo1'>
        <link name='link_0'>
          <inertial>
            <mass>0.46147</mass>
            <inertia>
              <ixx>0.0245058</ixx>
              <ixy>0</ixy>
              <ixz>0</ixz>
              <iyy>0.155549</iyy>
              <iyz>0</iyz>
              <izz>0.172317</izz>
            </inertia>
            <pose>0 0 0 0 -0 0</pose>
          </inertial>
          <pose>-0.313793 -0.004174 0.046741 0 -0 0</pose>
          <gravity>1</gravity>
          <self_collide>0</self_collide>
          <kinematic>0</kinematic>
          <enable_wind>0</enable_wind>
          <visual name='visual'>
            <pose>0 0 0 0 -0 0</pose>
            <geometry>
              <box>
                <size>1.98602 0.732553 0.317192</size>
              </box>
            </geometry>
            <material>
              <lighting>1</lighting>
              <script>
                <uri>file://media/materials/scripts/gazebo.material</uri>
                <name>Gazebo/Grey</name>
              </script>
              <shader type='pixel'>
                <normal_map>__default__</normal_map>
              </shader>
              <ambient>0.3 0.3 0.3 1</ambient>
              <diffuse>0.7 0.7 0.7 1</diffuse>
              <specular>0.01 0.01 0.01 1</specular>
              <emissive>0 0 0 1</emissive>
            </material>
            <transparency>0</transparency>
            <cast_shadows>1</cast_shadows>
          </visual>
          <collision name='collision'>
            <laser_retro>0</laser_retro>
            <max_contacts>10</max_contacts>
            <pose>0 0 0 0 -0 0</pose>
            <geometry>
              <box>
                <size>1.98602 0.732553 0.317192</size>
              </box>
            </geometry>
            <surface>
              <friction>
                <ode>
                  <mu>1</mu>
                  <mu2>1</mu2>
                  <fdir1>0 0 0</fdir1>
                  <slip1>0</slip1>
                  <slip2>0</slip2>
                </ode>
                <torsional>
                  <coefficient>1</coefficient>
                  <patch_radius>0</patch_radius>
                  <surface_radius>0</surface_radius>
                  <use_patch_radius>1</use_patch_radius>
                  <ode>
                    <slip>0</slip>
                  </ode>
                </torsional>
              </friction>
              <bounce>
                <restitution_coefficient>0</restitution_coefficient>
                <threshold>1e+06</threshold>
              </bounce>
              <contact>
                <collide_without_contact>0</collide_without_contact>
                <collide_without_contact_bitmask>1</collide_without_contact_bitmask>
                <collide_bitmask>1</collide_bitmask>
                <ode>
                  <soft_cfm>0</soft_cfm>
                  <soft_erp>0.2</soft_erp>
                  <kp>1e+13</kp>
                  <kd>1</kd>
                  <max_vel>0.01</max_vel>
                  <min_depth>0</min_depth>
                </ode>
                <bullet>
                  <split_impulse>1</split_impulse>
                  <split_impulse_penetration_threshold>-0.01</split_impulse_penetration_threshold>
                  <soft_cfm>0</soft_cfm>
                  <soft_erp>0.2</soft_erp>
                  <kp>1e+13</kp>
                  <kd>1</kd>
                </bullet>
              </contact>
            </surface>
          </collision>
        </link>
        <link name='link_1'>
          <inertial>
            <mass>1</mass>
            <inertia>
              <ixx>0.145833</ixx>
              <ixy>0</ixy>
              <ixz>0</ixz>
              <iyy>0.145833</iyy>
              <iyz>0</iyz>
              <izz>0.125</izz>
            </inertia>
            <pose>0 0 0 0 -0 0</pose>
          </inertial>
          <pose>0.379214 0.502131 -0.053259 1.5707 -0 0</pose>
          <gravity>1</gravity>
          <self_collide>0</self_collide>
          <kinematic>0</kinematic>
          <enable_wind>0</enable_wind>
          <visual name='visual'>
            <pose>0 0 0 0 -0 0</pose>
            <geometry>
              <cylinder>
                <radius>0.3</radius>
                <length>0.25</length>
              </cylinder>
            </geometry>
            <material>
              <lighting>1</lighting>
              <script>
                <uri>file://media/materials/scripts/gazebo.material</uri>
                <name>Gazebo/Grey</name>
              </script>
              <shader type='pixel'>
                <normal_map>__default__</normal_map>
              </shader>
              <ambient>0.3 0.3 0.3 1</ambient>
              <diffuse>0.7 0.7 0.7 1</diffuse>
              <specular>0.01 0.01 0.01 1</specular>
              <emissive>0 0 0 1</emissive>
            </material>
            <transparency>0</transparency>
            <cast_shadows>1</cast_shadows>
          </visual>
          <collision name='collision'>
            <laser_retro>0</laser_retro>
            <max_contacts>10</max_contacts>
            <pose>0 0 0 0 -0 0</pose>
            <geometry>
              <cylinder>
                <radius>0.3</radius>
                <length>0.25</length>
              </cylinder>
            </geometry>
            <surface>
              <friction>
                <ode>
                  <mu>1</mu>
                  <mu2>1</mu2>
                  <fdir1>0 0 0</fdir1>
                  <slip1>0</slip1>
                  <slip2>0</slip2>
                </ode>
                <torsional>
                  <coefficient>1</coefficient>
                  <patch_radius>0</patch_radius>
                  <surface_radius>0</surface_radius>
                  <use_patch_radius>1</use_patch_radius>
                  <ode>
                    <slip>0</slip>
                  </ode>
                </torsional>
              </friction>
              <bounce>
                <restitution_coefficient>0</restitution_coefficient>
                <threshold>1e+06</threshold>
              </bounce>
              <contact>
                <collide_without_contact>0</collide_without_contact>
                <collide_without_contact_bitmask>1</collide_without_contact_bitmask>
                <collide_bitmask>1</collide_bitmask>
                <ode>
                  <soft_cfm>0</soft_cfm>
                  <soft_erp>0.2</soft_erp>
                  <kp>1e+13</kp>
                  <kd>1</kd>
                  <max_vel>0.01</max_vel>
                  <min_depth>0</min_depth>
                </ode>
                <bullet>
                  <split_impulse>1</split_impulse>
                  <split_impulse_penetration_threshold>-0.01</split_impulse_penetration_threshold>
                  <soft_cfm>0</soft_cfm>
                  <soft_erp>0.2</soft_erp>
                  <kp>1e+13</kp>
                  <kd>1</kd>
                </bullet>
              </contact>
            </surface>
          </collision>
        </link>
        <link name='link_1_clone'>
          <inertial>
            <mass>1</mass>
            <inertia>
              <ixx>0.145833</ixx>
              <ixy>0</ixy>
              <ixz>0</ixz>
              <iyy>0.145833</iyy>
              <iyz>0</iyz>
              <izz>0.125</izz>
            </inertia>
            <pose>0 0 0 0 -0 0</pose>
          </inertial>
          <pose>0.379215 -0.495479 -0.053259 1.5707 -0 0</pose>
          <gravity>1</gravity>
          <self_collide>0</self_collide>
          <kinematic>0</kinematic>
          <enable_wind>0</enable_wind>
          <visual name='visual'>
            <pose>0 0 0 0 -0 0</pose>
            <geometry>
              <cylinder>
                <radius>0.3</radius>
                <length>0.25</length>
              </cylinder>
            </geometry>
            <material>
              <lighting>1</lighting>
              <script>
                <uri>file://media/materials/scripts/gazebo.material</uri>
                <name>Gazebo/Grey</name>
              </script>
              <shader type='pixel'>
                <normal_map>__default__</normal_map>
              </shader>
              <ambient>0.3 0.3 0.3 1</ambient>
              <diffuse>0.7 0.7 0.7 1</diffuse>
              <specular>0.01 0.01 0.01 1</specular>
              <emissive>0 0 0 1</emissive>
            </material>
            <transparency>0</transparency>
            <cast_shadows>1</cast_shadows>
          </visual>
          <collision name='collision'>
            <laser_retro>0</laser_retro>
            <max_contacts>10</max_contacts>
            <pose>0 0 0 0 -0 0</pose>
            <geometry>
              <cylinder>
                <radius>0.3</radius>
                <length>0.25</length>
              </cylinder>
            </geometry>
            <surface>
              <friction>
                <ode>
                  <mu>1</mu>
                  <mu2>1</mu2>
                  <fdir1>0 0 0</fdir1>
                  <slip1>0</slip1>
                  <slip2>0</slip2>
                </ode>
                <torsional>
                  <coefficient>1</coefficient>
                  <patch_radius>0</patch_radius>
                  <surface_radius>0</surface_radius>
                  <use_patch_radius>1</use_patch_radius>
                  <ode>
                    <slip>0</slip>
                  </ode>
                </torsional>
              </friction>
              <bounce>
                <restitution_coefficient>0</restitution_coefficient>
                <threshold>1e+06</threshold>
              </bounce>
              <contact>
                <collide_without_contact>0</collide_without_contact>
                <collide_without_contact_bitmask>1</collide_without_contact_bitmask>
                <collide_bitmask>1</collide_bitmask>
                <ode>
                  <soft_cfm>0</soft_cfm>
                  <soft_erp>0.2</soft_erp>
                  <kp>1e+13</kp>
                  <kd>1</kd>
                  <max_vel>0.01</max_vel>
                  <min_depth>0</min_depth>
                </ode>
                <bullet>
                  <split_impulse>1</split_impulse>
                  <split_impulse_penetration_threshold>-0.01</split_impulse_penetration_threshold>
                  <soft_cfm>0</soft_cfm>
                  <soft_erp>0.2</soft_erp>
                  <kp>1e+13</kp>
                  <kd>1</kd>
                </bullet>
              </contact>
            </surface>
          </collision>
        </link>
        <link name='link_2'>
          <inertial>
            <mass>1</mass>
            <inertia>
              <ixx>0.1</ixx>
              <ixy>0</ixy>
              <ixz>0</ixz>
              <iyy>0.1</iyy>
              <iyz>0</iyz>
              <izz>0.1</izz>
            </inertia>
            <pose>0 0 0 0 -0 0</pose>
          </inertial>
          <pose>-1.1068 -0.004174 -0.153259 0 -0 0</pose>
          <gravity>1</gravity>
          <self_collide>0</self_collide>
          <kinematic>0</kinematic>
          <enable_wind>0</enable_wind>
          <visual name='visual'>
            <pose>0 0 0 0 -0 0</pose>
            <geometry>
              <sphere>
                <radius>0.2</radius>
              </sphere>
            </geometry>
            <material>
              <lighting>1</lighting>
              <script>
                <uri>file://media/materials/scripts/gazebo.material</uri>
                <name>Gazebo/Grey</name>
              </script>
              <shader type='pixel'>
                <normal_map>__default__</normal_map>
              </shader>
              <ambient>0.3 0.3 0.3 1</ambient>
              <diffuse>0.7 0.7 0.7 1</diffuse>
              <specular>0.01 0.01 0.01 1</specular>
              <emissive>0 0 0 1</emissive>
            </material>
            <transparency>0</transparency>
            <cast_shadows>1</cast_shadows>
          </visual>
          <collision name='collision'>
            <laser_retro>0</laser_retro>
            <max_contacts>10</max_contacts>
            <pose>0 0 0 0 -0 0</pose>
            <geometry>
              <sphere>
                <radius>0.2</radius>
              </sphere>
            </geometry>
            <surface>
              <friction>
                <ode>
                  <mu>1</mu>
                  <mu2>1</mu2>
                  <fdir1>0 0 0</fdir1>
                  <slip1>0</slip1>
                  <slip2>0</slip2>
                </ode>
                <torsional>
                  <coefficient>1</coefficient>
                  <patch_radius>0</patch_radius>
                  <surface_radius>0</surface_radius>
                  <use_patch_radius>1</use_patch_radius>
                  <ode>
                    <slip>0</slip>
                  </ode>
                </torsional>
              </friction>
              <bounce>
                <restitution_coefficient>0</restitution_coefficient>
                <threshold>1e+06</threshold>
              </bounce>
              <contact>
                <collide_without_contact>0</collide_without_contact>
                <collide_without_contact_bitmask>1</collide_without_contact_bitmask>
                <collide_bitmask>1</collide_bitmask>
                <ode>
                  <soft_cfm>0</soft_cfm>
                  <soft_erp>0.2</soft_erp>
                  <kp>1e+13</kp>
                  <kd>1</kd>
                  <max_vel>0.01</max_vel>
                  <min_depth>0</min_depth>
                </ode>
                <bullet>
                  <split_impulse>1</split_impulse>
                  <split_impulse_penetration_threshold>-0.01</split_impulse_penetration_threshold>
                  <soft_cfm>0</soft_cfm>
                  <soft_erp>0.2</soft_erp>
                  <kp>1e+13</kp>
                  <kd>1</kd>
                </bullet>
              </contact>
            </surface>
          </collision>
        </link>
        <model name='depth_camera'>
          <link name='link'>
            <pose>0 0 0.05 0 -0 0</pose>
            <inertial>
              <mass>0.1</mass>
              <inertia>
                <ixx>0.000166667</ixx>
                <iyy>0.000166667</iyy>
                <izz>0.000166667</izz>
                <ixy>0</ixy>
                <ixz>0</ixz>
                <iyz>0</iyz>
              </inertia>
              <pose>0 0 0 0 -0 0</pose>
            </inertial>
            <collision name='collision'>
              <geometry>
                <box>
                  <size>0.1 0.1 0.1</size>
                </box>
              </geometry>
              <surface>
                <contact>
                  <ode/>
                </contact>
                <bounce/>
                <friction>
                  <torsional>
                    <ode/>
                  </torsional>
                  <ode/>
                </friction>
              </surface>
              <max_contacts>10</max_contacts>
            </collision>
            <visual name='visual'>
              <geometry>
                <box>
                  <size>0.1 0.1 0.1</size>
                </box>
              </geometry>
            </visual>
            <sensor name='camera' type='depth'>
              <camera>
                <horizontal_fov>1.047</horizontal_fov>
                <image>
                  <width>320</width>
                  <height>240</height>
                </image>
                <clip>
                  <near>0.1</near>
                  <far>100</far>
                </clip>
              </camera>
              <always_on>1</always_on>
              <update_rate>30</update_rate>
              <visualize>1</visualize>
            </sensor>
            <self_collide>0</self_collide>
            <enable_wind>0</enable_wind>
            <kinematic>0</kinematic>
          </link>
          <pose>0.662164 0.001695 0.213037 0 -0 0</pose>
        </model>
        <joint name='link_0_JOINT_0' type='revolute'>
          <parent>link_0</parent>
          <child>link_1</child>
          <pose>0 0 0 0 -0 0</pose>
          <axis>
            <xyz>0 0 1</xyz>
            <limit>
              <lower>-1.79769e+308</lower>
              <upper>1.79769e+308</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.2</erp>
              </limit>
              <suspension>
                <cfm>0</cfm>
                <erp>0.2</erp>
              </suspension>
            </ode>
          </physics>
        </joint>
        <joint name='link_0_JOINT_1' type='revolute'>
          <parent>link_0</parent>
          <child>link_1_clone</child>
          <pose>0 0 0 0 -0 0</pose>
          <axis>
            <xyz>0 0 1</xyz>
            <limit>
              <lower>-1.79769e+308</lower>
              <upper>1.79769e+308</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.2</erp>
              </limit>
              <suspension>
                <cfm>0</cfm>
                <erp>0.2</erp>
              </suspension>
            </ode>
          </physics>
        </joint>
        <joint name='link_0_JOINT_2' type='ball'>
          <parent>link_0</parent>
          <child>link_2</child>
          <pose>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>
        <joint name='link_JOINT_3' type='fixed'>
          <parent>depth_camera::link</parent>
          <child>link_0</child>
          <pose>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='smallcar_follower' filename='libFollowerPlugin.so'/>
      </model>
    </sdf>
    

iwehdio的博客園:https://www.cnblogs.com/iwehdio/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM