Skip to content

Population of models

Hancheol Choi edited this page Feb 10, 2018 · 8 revisions

1. Overview

이 지침서는 당신이 SDF <population> tag 을 이용해서 어떻게 모델을 복제를 할수있지를 보여줍니다. 복제는 고유의 모델모음으로 구성이 되어있습니다.

모델복제는 다음의 파라메타를 정합니다.

  1. 모델(예:테이블, 콜라병)
  2. 복제를 원하는 오브젝트수
  3. 오브젝트들이 배열될 형태와 디멘전(예:박스,실린더)
  4. 복제 컨테이너의 위치와 방향
  5. 콘테이너안에 오브젝트의 배포(예: 무작위,GRID)

For reference, check the SDF specification for a complete specification of the tag and its parameters.

Creating an object population

Quick start

  1. 이 지침서를 위해 디렉토리를 생성하는것으로 시작하세요
$ mkdir ~/tutorial_model_population
$ cd ~/tutorial_model_population
  1. 이화일을 현재의 디렉토리에 다운로드 하세요 : can_population.world
$ wget http://bitbucket.org/osrf/gazebo_tutorials/raw/default/model_population/files/can_population.world

파일엔 아래와 같이 기술되어 있습니다.

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">

    <!-- A global light source -->
    <include>
      <uri>model://sun</uri>
    </include>

    <!-- A ground plane -->
    <include>
      <uri>model://ground_plane</uri>
    </include>

    <!-- Testing the automatic population of objects -->
    <population name="can_population1">
      <model name="can1">
        <include>
          <static>true</static>
          <uri>model://coke_can</uri>
        </include>
      </model>
      <pose>0 0 0 0 0 0</pose>
      <box>
        <size>2 2 0.01</size>
      </box>
      <model_count>10</model_count>
      <distribution>
        <type>random</type>
      </distribution>
    </population>

  </world>
</sdf> 
  1. 가제보를 실행합니다.
$ gazebo can_population.world

당신은 소다캔의 복제품을 보게됩니다( 랜덤으로 위치되어 있는) 이 캔들은 BOX 컨테이너 (222 미터)이내에 배열이 됩니다.

The world explained

좀더 가봅시다. 다른 can_population.world 의 요소를 이해합니다.

    <population name="can_population1">
      <model name="can1">
        <include>
          <static>true</static>
          <uri>model://coke_can</uri>
        </include>
      </model>

이 정보에서 우리는 <population> tag.를 이용해서 어떻게 복제품의 spec이 정해지는지 알수있습니다. 모든 복제품은 고유의 이름을 갖고있습니다. 이것은 이름속성으로 특정지어집니다. 복제태그 내에서, 당산은 model tag로 모델을 어떻게 선택하는지 알수있습니다. 각 복제품의 요소는 유일한 이름으로 시물레이션으로 삽입이 됩니다 이름은 _clone_i 라는 이름으로 추가가 됨으로써 생성이 됩니다. i는 복제요소의 순번 입니다.당신은 복제된 모델의 리스트를 볼수있습니다

가장 일반적인 복제 타입은 에니메이션이 않되는 오브젝트로 구성됩니다. 예를들면 나무,바위,빌딩등.

We recommend you use the <population> tag for static models, and exclude mobile entities, such as robots, which often require more precise placement and are fewer in number.

<pose>0 0 0 0 0 0</pose>
<box>
   <size>2 2 0.01</size>
</box>

위의 코드의 블럭은 지역을 특정화합니다, 그 직억은 오브젝트가 위치할 지역입니다. 이번 경우에서는, 모든 오브제그는 3d기초 박스(2 x 2 x 0.01 m, centered at (0, 0, 0) with orientation (0, 0, 0))에 복제되었습니다 As an alternative to , a region is also allowed by specifying its radius and length. (Check out the SDF specification for a full description of the parameters.) The element sets the reference frame of the population's region.

 <model_count>10</model_count>

위에서 당신은 모델의 수를 볼수있습니다 어떤 양수이든 허용이 됩니다. 그러나 너무높은 수는 성능을 저하시킵니다.

      <distribution>
        <type>random</type>
      </distribution>

은 오브젝트가 지역에 어떻게 배치가 되는지 설명합니다.

Distribution types

  1. random : 무작위 위치로 복제됨
  2. uniform : 모델은 2d 패턴으로 위치합니다. 우리는 k-mean을 이용합니다. 지역내에 위치를 최적화 합니다.
  3. grid : 2d grid pattern에 위치합니다. 이 배포는 또한 당신이 rows nomber, col number, 엘리먼트사이 거리를 특정해야 합니다. 이 <model_count> 는 이 배포에서 무시됩니다. 오브젝트의 번호는 시물레이션에 삽입이 됩니다. 이 시물레이션은 행,열의 넘버와 같게됩니다.
  4. Linear -x : 모델은 x축을따라 row로 배치됩니다.
  5. Linear -y : 모델은 y축을따라 row로 배치됩니다.
  6. Linear -z : 모델은 z축을따라 row로 배치됩니다.

좀더 많은 진보된 예제를 당신은 population.world 에서 볼수있습니다. 그리고 물론 당신은 이것을 테스트해볼수 있습니다.

$ gazebo worlds/population.world

Table of Contents




Clone this wiki locally