2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MuJoCoで地形をカスタマイズする方法!

Last updated at Posted at 2020-01-23

MuJoCoで地形をカスタマイズしたい!

強化学習でシミュレーション環境といえばMuJoCoですが,やってるうちに地形をいじりたいな〜と思ってリファレンスを軽く読んだので残しておきます.

gray scale画像から読み込む

MuJoCoのリファレンスによると,gray scale画像から地形情報を読み込めるらしいです.
やってみました.

image.png
これが
image.png
こうなります!

やり方

  1. gray scale 画像を作る(terrain4.png)
  1. xmlファイルをいじる
    assetの部分.主にhfieldの部分.
ant.xml
<asset>
    <texture builtin="gradient" height="100" rgb1="1 1 1" rgb2="0 0 0" type="skybox" width="100"/>
    <texture builtin="flat" height="1278" mark="cross" markrgb="1 1 1" name="texgeom" random="0.01" rgb1="0.8 0.6 0.4" rgb2="0.8 0.6 0.4" type="cube" width="127"/>
    <texture builtin="checker" height="100" name="texplane" rgb1="0.2 0.4 0.6" rgb2="0.8 0.8 0.8" type="2d" width="100"/>
    <material name="MatPlane" reflectance="0.5" shininess="1" specular="1" texrepeat="60 60" texture="texplane"/>
    <material name="geom" texture="texgeom" texuniform="true"/>
    <hfield name="mytilted" file="terrain4.png" nrow="0" ncol="0" size="50 50 3 0.1" />
</asset>

worldbodyの部分

ant.xml
<geom conaffinity="1" condim="3" hfield="mytilted" material="MatPlane" name="floor" pos="0 0 0" rgba="0.8 0.9 0.8 1" type="hfield"/>

3.完成
IMG_3573.JPG

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?