Gazeboで外部モデルロード時の設定

はじめに

gazeboのworldにオブジェクトを追加する際,osrfのモデルレポジトリから引っ張ってきますが,初期ロード時にダウンロードしてキャッシュするため時間がかかります. そこで,予めレポジトリをローカルにcloneしてそこを指定するようにします[1].

手順

1. レポジトリを任意の場所(私は~/workSpace/data/)にクローン

hg clone https://bitbucket.org/osrf/gazebo_models ~/workSpace/data/

2. 環境変数の設定

クローンしてきたレポジトリへのパスを通します.モデル関係の環境変数GAZEBO_MODEL_PATHのようなので[2],自分の使用しているshellに書きます.

export GAZEBO_MODEL_PATH='$HOME/workSpace/data/gazebo_models/'

3.worldファイルの設定

上記パスを優先して読んでくれるようなので,

<sdf version="...">
  <!-- other tags -->
  
  <include>
    <uri>model://wooden_board</uri>
    <name>gas_station</name>
    <pose>5.0 5.0 0 0 0 0</pose>
  </include>
  
  <!-- other tags -->
</sdf>

おわり

参考リンク

  1. Gazebo : Tutorial : Model structure and requirements
  2. https://bitbucket.org/osrf/gzweb/issues/45/creating-local-model-of
;(function(document){ var pres = document.getElementsByTagName("pre") for(var i=pres.length; i--; ){  var el = makeOl(pres[i]) pres[i].appendChild(el) } function makeOl(pre){ if (pre.className.indexOf("gist") !== -1) { return } var ol = document.createElement("ol") , li = document.createElement("li") , df = document.createDocumentFragment() , br = pre.innerHTML.match(/\n/g) || 0 ol.className = "preLine" ol.setAttribute("role", "presentation") // no lang, no line-number if( pre.className && ! /lang-./.test(pre.className) ){ br.length += 1 } for(var i=br.length; i--; ){ var li2 = li.cloneNode(true) df.appendChild(li2) } ol.appendChild(df) return ol } })(document)