Raspberry Pi Mouse(移行中)

Gazeboで走るRasPiMouse その1

こんにちは。佐藤です。

Raspberry Pi Mouseと書くと思ったより文字数が多いですねー。
実はタイトルだけ前回からRasPiMouseと表記するように変更しました。

さて、前回はGazeboの使い方について紹介しました。
今回もチュートリアルとほぼ同様にしてGazebo上でロボットを呼び出します。
ついにRaspberry Pi Mouseを呼び出すときがやってきました!

Gazebo : Tutorial : Using roslaunch

Gazeboを起動する際のlaunchファイルを置くためのパッケージを作ります。
_descriptionパッケージとは別のパッケージに用意するのが慣例となっているようです。

../catkin_ws/src
    /MYROBOT_description
        package.xml
        CMakeLists.txt
        model.config
        /urdf
            MYROBOT.urdf
        /meshes
            mesh1.dae
            mesh2.dae
            ...
        /materials
        /plugins
        /cad
    /MYROBOT_gazebo
        /launch
            MYROBOT.launch
        /worlds
            MYROBOT.world
        /models
            world_object1.dae
            world_object2.stl
            world_object3.urdf
        /materials
        /plugins

Gazebo : Tutorial : Using roslaunch より引用

実際にいくつかのロボットのモデルについて調べてみたところ、概ねパッケージをいくつかに分割している場合が多いようです。

https://github.com/PR2/pr2_common
https://github.com/yujinrobot/kobuki
https://github.com/demulab/mini_sim
https://github.com/CIR-KIT/fourth_robot_pkg

今回はraspimouse_gazeboというパッケージを作り、所定のディレクトリを作成します。

$ cd ~/catkin_ws/src
$ catkin_create_pkg raspimouse_gazebo
$ mkdir launch worlds

ここでチュートリアルと同じようにガソリンスタンドの環境を用意してみます。今回はhello.worldとtest.launchで保存しました。

<?xml version="1.0" ?>
<sdf version="1.4">
  <world name="default">
    <include>
      <uri>model://ground_plane</uri>
    </include>
    <include>
      <uri>model://sun</uri>
    </include>
    <include>
      <uri>model://gas_station</uri>
      <name>gas_station</name>
      <pose>-2.0 7.0 0 0 0 0</pose>
    </include>
  </world>
</sdf>
<launch>
  <!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find raspimouse_gazebo)/worlds/hello.world"/>
    <!-- more default parameters can be changed here -->
  </include>
</launch>

この環境でGazeboを起動してみます。

$ roslaunch raspimouse_gazebo test.launch 

多くの場合はガゾリンスタンドのモデルデータがないと思います。
起動すると真っ暗でなにも写っていないGazeboのウィンドウが出てきます。

Warning [ModelDatabase.cc:334] Getting models from
Gazebo
Simulation Driven Robotics. Iterate quickly on design concepts and control strategies with Gazebo's rich suite of tools, libraries, and cloud services.
. This may take a few seconds.

このメッセージが出ている間、ダウンロードしています。起動完了するまで数分かかることがあります。

ただのガソリンスタンドが出現しました。

gazebo hello world

では、ここにRaspberry Pi Mouseを呼び出してみたいと思います!そのコマンドがこちら!!

rosrun gazebo_ros spawn_model -file `rospack find raspimouse_description`/robots/raspimouse.urdf -urdf -x 0 -y 0 -z 1 -model raspimouse

実行すると…呼び出せました!
rpimouse hello world

しかし、問題があります。よく見ると、ホイールがありません。
spawn problem

test.launchを起動した方のTerminalで次のようなエラーが出ていました。

[ERROR] [1470394144.109165858, 6.166000000]: inertia element must have ixx,ixy,ixz,iyy,iyz,izz attributes
[ERROR] [1470394144.109234213, 6.166000000]: Could not parse inertial element for Link [base_link]

Raspberry Pi MouseのURDFモデル作成 その2 | RT MicroMouseで慣性行列を定義しました。
RVizで表示するだけの場合は慣性モーメントだけで慣性相乗モーメントは定義しなくても何も問題ありませんでした(未定義の場合は0として扱う)が、Gazeboではきちんと定義する必要があるようです。

今回はその1ということでGazebo上で走らせる手前まで確認を行いました。
次回は慣性モーメントの簡単な算出方法を紹介したあと、コントローラを実装し、走らせてみたいと思います!

参考文献

タイトルとURLをコピーしました