九州工業大学 CIR-KIT Blog

九工大自律移動ロボット製作プロジェクトCIR-KITの技術系ブログ

No.2-8:ロボットを作ってみよう ! (簡単なグリッパーを作る 編)

gazebo_logo

検証日時

01/30/2015 (Fri)

概要

Gazeboのチュートリアル第二弾「Build a Robot」。
このチュートリアルではロボットを作ったり、修正したりします。また、センサ、アクチュエータを搭載した車輪型ロボットを作り、モデルを描画するなどの実践例も行います。
今回はその「Make a simple gripper」編です。
公式サイトを適当に翻訳しただけですので、あしからず。

レベル

BEGINNER

環境
PC : Lenovo ThinkPad X240
Prosessor : Intel Core i7-4600U (2.10GHz, 4MB, 1600MHz)
RAM : PC3-12800 DDR3L (8GB)
OS : Ubuntu 14.04 LTS 64bit
Kernel : 3.13.0-44-generic
Gazebo : Version 5.0.1
参考

GAZEBO Tutorial-Build a Robot

はじめに

このチュートリアルでは,2つの棒を使ったピンチンググリッパーの作り方を説明します。

モデルディレクトリを作る

このチュートリアルを始めるために、モデルデータベースドキュメントSDFのレファレンスをご覧ください。

モデルを作る

  1. world ファイルのためのディレクトリを作成しましょう。
1
2
mkdir ~/simple_gripper_tutorial
cd ~/simple_gripper_tutorial
  1. まずはシンプルな空のworldから始めます。worldファイルを作成しましょう。
1
gedit ~/simple_gripper_tutorial/gripper.world

以下のSDFファイルgripper.worldをコピペしてください。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?xml version="1.0"?>
  <sdf version="1.4">
    <world name="default">
    <!-- A ground plane -->
    <include>
      <uri>model://ground_plane</uri>
    </include>
    <!-- A global light source -->
    <include>
      <uri>model://sun</uri>
    </include>
    <include>
      <uri>model://my_gripper</uri>
    </include>
    </world>
  </sdf>
  1. ~/.gazebo ディレクトリの中に,model ディレクトリを作成してください。作成したディレクトリには、これから作成するモデルを置いてゆきます。:
1
mkdir -p ~/.gazebo/models/my_gripper
  1. 作成するグリッパの基本的な構造を作りましょう。その最も簡単な方法は静的モデルを作り、リンクを一つ追加することです。静的モデルとは、シミュレーションがスタートしてもリンクが動かないということを意味します。これにより、シミュレータをスタートさせ、ジョイントを追加する前に、モデルを見ながら、リンクの位置を調べることができます。

  2. 以下のように、model.configを作成しましょう。

1
2
3
4
5
6
7
8
9
10
11
12
13
<?xml version="1.0"?>
<model>
  <name>My Gripper</name>
  <version>1.0</version>
  <sdf version='1.4'>simple_gripper.sdf</sdf>
  <author>
    <name>My Name</name>
    <email>me@my.email</email>
  </author>
  <description>
    My awesome robot.
  </description>
</model>
  1. 以下のsimple_gripper.sdfファイルをコピペしてください。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?xml version="1.0"?>
<sdf version="1.4">
    <model name="simple_gripper">
        <link name="riser">
            <pose>-0.15 0.0 0.5 0 0 0</pose>
            <inertial>
                <pose>0 0 -0.5 0 0 0</pose>
                <inertia>
                    <ixx>0.01</ixx>
                    <ixy>0</ixy>
                    <ixz>0</ixz>
                    <iyy>0.01</iyy>
                    <iyz>0</iyz>
                    <izz>0.01</izz>
                </inertia>
                <mass>10.0</mass>
            </inertial>
            <collision name="collision">
                <geometry>
                    <box>
                        <size>0.2 0.2 1.0</size>
                    </box>
                </geometry>
            </collision>
            <visual name="visual">
                <geometry>
                    <box>
                        <size>0.2 0.2 1.0</size>
                    </box>
                </geometry>
                <material>
                    <script>Gazebo/Purple</script>
                </material>
            </visual>
        </link>
        <link name="palm">
            <pose>0.0 0.0 0.05 0 0 0</pose>
            <inertial>
                <inertia>
                    <ixx>0.01</ixx>
                    <ixy>0</ixy>
                    <ixz>0</ixz>
                    <iyy>0.01</iyy>
                    <iyz>0</iyz>
                    <izz>0.01</izz>
                </inertia>
                <mass>0.5</mass>
            </inertial>
            <collision name="collision">
                <geometry>
                    <box>
                        <size>0.1 0.2 0.1</size>
                    </box>
                </geometry>
            </collision>
            <visual name="visual">
                <geometry>
                    <box>
                        <size>0.1 0.2 0.1</size>
                    </box>
                </geometry>
                <material>
                    <script>Gazebo/Red</script>
                </material>
            </visual>
        </link>
        <link name="left_finger">
            <pose>0.1 0.2 0.05 0 0 -0.78539</pose>
            <inertial>
                <inertia>
                    <ixx>0.01</ixx>
                    <ixy>0</ixy>
                    <ixz>0</ixz>
                    <iyy>0.01</iyy>
                    <iyz>0</iyz>
                    <izz>0.01</izz>
                </inertia>
                <mass>0.1</mass>
            </inertial>
            <collision name="collision">
                <geometry>
                    <box>
                        <size>0.1 0.3 0.1</size>
                    </box>
                </geometry>
            </collision>
            <visual name="visual">
                <geometry>
                    <box>
                        <size>0.1 0.3 0.1</size>
                    </box>
                </geometry>
                <material>
                    <script>Gazebo/Blue</script>
                </material>
            </visual>
        </link>
        <link name="left_finger_tip">
            <pose>0.336 0.3 0.05 0 0 1.5707</pose>
            <inertial>
                <inertia>
                    <ixx>0.01</ixx>
                    <ixy>0</ixy>
                    <ixz>0</ixz>
                    <iyy>0.01</iyy>
                    <iyz>0</iyz>
                    <izz>0.01</izz>
                </inertia>
                <mass>0.1</mass>
            </inertial>
            <collision name="collision">
                <geometry>
                    <box>
                        <size>0.1 0.2 0.1</size>
                    </box>
                </geometry>
            </collision>
            <visual name="visual">
                <geometry>
                    <box>
                        <size>0.1 0.2 0.1</size>
                    </box>
                </geometry>
                <material>
                    <script>Gazebo/Blue</script>
                </material>
            </visual>
        </link>
        <link name="right_finger">
            <pose>0.1 -0.2 0.05 0 0 .78539</pose>
            <inertial>
                <inertia>
                    <ixx>0.01</ixx>
                    <ixy>0</ixy>
                    <ixz>0</ixz>
                    <iyy>0.01</iyy>
                    <iyz>0</iyz>
                    <izz>0.01</izz>
                </inertia>
                <mass>0.1</mass>
            </inertial>
            <collision name="collision">
                <geometry>
                    <box>
                        <size>0.1 0.3 0.1</size>
                    </box>
                </geometry>
            </collision>
            <visual name="visual">
                <geometry>
                    <box>
                        <size>0.1 0.3 0.1</size>
                    </box>
                </geometry>
                <material>
                    <script>Gazebo/Green</script>
                </material>
            </visual>
        </link>
        <link name="right_finger_tip">
            <pose>0.336 -0.3 0.05 0 0 1.5707</pose>
            <inertial>
                <inertia>
                    <ixx>0.01</ixx>
                    <ixy>0</ixy>
                    <ixz>0</ixz>
                    <iyy>0.01</iyy>
                    <iyz>0</iyz>
                    <izz>0.01</izz>
                </inertia>
                <mass>0.1</mass>
            </inertial>
            <collision name="collision">
                <geometry>
                    <box>
                        <size>0.1 0.2 0.1</size>
                    </box>
                </geometry>
            </collision>
            <visual name="visual">
                <geometry>
                    <box>
                        <size>0.1 0.2 0.1</size>
                    </box>
                </geometry>
                <material>
                    <script>Gazebo/Green</script>
                </material>
            </visual>
        </link>
        <static>true</static>
    </model>
</sdf>
  1. ここまでで、何が作成できたのかを見るために、worldファイルを実行しましょう。
1
gazebo ~/simple_gripper_tutorial/gripper.world

すると、以下のようになっているはずです。 Simple-gripper-1

  1. 一度でもリンクを作成できたら安心です。simple_gripper.sdfファイルの中の</model>と書いてある前に、以下のコードを追加することで、ジョイントを追加することができます。
1
gedit ~/.gazebo/models/my_gripper/simple_gripper.sdf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
        <joint name="palm_left_finger" type="revolute">
            <pose>0 -0.15 0 0 0 0</pose>
            <child>left_finger</child>
            <parent>palm</parent>
            <axis>
                <limit>
                    <lower>-0.4</lower>
                    <upper>0.4</upper>
                </limit>
                <xyz>0 0 1</xyz>
            </axis>
        </joint>
        <joint name="left_finger_tip" type="revolute">
            <pose>0 0.1 0 0 0 0</pose>
            <child>left_finger_tip</child>
            <parent>left_finger</parent>
            <axis>
                <limit>
                    <lower>-0.4</lower>
                    <upper>0.4</upper>
                </limit>
                <xyz>0 0 1</xyz>
            </axis>
        </joint>
        <joint name="palm_right_finger" type="revolute">
            <pose>0 0.15 0 0 0 0</pose>
            <child>right_finger</child>
            <parent>palm</parent>
            <axis>
                <limit>
                    <lower>-0.4</lower>
                    <upper>0.4</upper>
                </limit>
                <xyz>0 0 1</xyz>
            </axis>
        </joint>
        <joint name="right_finger_tip" type="revolute">
            <pose>0 0.1 0 0 0 0</pose>
            <child>right_finger_tip</child>
            <parent>right_finger</parent>
            <axis>
                <limit>
                    <lower>-0.4</lower>
                    <upper>0.4</upper>
                </limit>
                <xyz>0 0 1</xyz>
            </axis>
        </joint>
        <joint name="palm_riser" type="prismatic">
            <child>palm</child>
            <parent>riser</parent>
            <axis>
                <limit>
                    <lower>0</lower>
                    <upper>0.9</upper>
                </limit>
                <xyz>0 0 1</xyz>
            </axis>
        </joint>

また、モデルをnon-staticにしましょう。:

1
2
3
        ...
        <static>false</static>
        ...
  1. Gazeboをもう一度立ち上げましょう。
1
gazebo ~/simple_gripper_tutorial/gripper.world
  1. モデルの上で右クリックをし、“View->Joints”というのを選択しましょう。新たに作成したジョイントが表示されます。 Simple-gripper-joints

  2. ジョイントコントロールウィジェットを使えば、それぞれのジョイントの力をコントロールすることができます。グリッパーモデルをクリックしてください。次に、GUIの右端にある直立したハンドル(白いポチが3つ付いているところ)を左にドラックしてください。するとウィジェットが表示されます。ウィジェットでは、それぞれのジョイントのリストとそのスライダーを表示しています。Forceタブを選択し、スライダーを使ってそれぞれのジョイントに力を適用し、グリッパが動くことを確認してください。例えば、palm_riserの値を10[N]にセットすると、以下のようになるはずです。:

  1. オプション

  2. 小さい箱もしくは円柱をシミュレータに追加し、グリッパーのところに置いてください。

  3. GUIインターフェースを使って物体を持ち上げてみましょう。

    コツ : 物体への慣性力をなるべく少なくするとうまく行くでしょう。

Next >> グリッパをロボットに取り付ける