Help us understand the problem. What is going on with this article?

pybulletでloadURDFする

URDFファイルを書きつつ、loadURDFを使う

環境

  • Windows 10 Home
  • Python 3.6.8
  • PyBullet 2.5.5

やったこと

URDFファイルを用意する

コードは以下の通り。
おそらくload出来る最少の記述。
記述が足りないとCannot load URDF file.とエラーが発生する。

test_box01.urdf
<robot name="robot_name">
  <link name="link_name">
    <visual>
      <geometry>
        <box size="3.0 3.0 1.0"/>
      </geometry>
    </visual>
  </link>
</robot>

loadURDFする

import pybullet as p
import time

phisicsClient = p.connect(p.GUI)
p.loadURDF("test_box01.urdf")
time.sleep(10)
p.disconnect()

実行結果は以下の画像。
image.png

2個目のURDFファイルを用意する

1個目と干渉しないように<origin xyz="0.0 0.0 2.0" rpy="0.0 0.0 0.0"/>という記述を追加。

test_sphere01.urdf
<robot name="robot_name">
  <link name="link_name">
    <visual>
      <origin xyz="0.0 0.0 2.0" rpy="0.0 0.0 0.0"/>
      <geometry>
        <sphere radius="1.0"/>
      </geometry>
    </visual>
  </link>
</robot>

再びloadURDFする

先のpythonコードにloadURDFを追加する。

import pybullet as p
import time

phisicsClient = p.connect(p.GUI)
p.loadURDF("test_box01.urdf")
p.loadURDF("test_sphere01.urdf")
time.sleep(10)
p.disconnect()

実行結果は以下の画像。
image.png
特に指定してないけど色分けされる様子。
2つのURDFでrobotとlinkのnameが同じなのは良いのだろうか?

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away