<?xml version="1.0" ?>
<sdf version="1.6">
  <world name="default">
    <physics name="fast" type="ignored">
      <real_time_factor>0</real_time_factor>
    </physics>

    <plugin
      filename="ignition-gazebo-physics-system"
      name="ignition::gazebo::systems::Physics">
    </plugin>
    <plugin
      filename="ignition-gazebo-scene-broadcaster-system"
      name="ignition::gazebo::systems::SceneBroadcaster">
    </plugin>

    <gui fullscreen="0">

      <!-- 3D scene -->
      <plugin filename="GzScene3D" name="3D View">
        <ignition-gui>
          <title>3D View</title>
          <property type="bool" key="showTitleBar">false</property>
          <property type="bool" key="resizable">false</property>
          <property type="double" key="z">0</property>
          <anchor line="right" target="window" target_line="right"/>
          <anchor line="left" target="window" target_line="left"/>
          <anchor line="top" target="window" target_line="top"/>
          <anchor line="bottom" target="window" target_line="bottom"/>
        </ignition-gui>

        <engine>ogre</engine>
        <scene>scene</scene>
        <ambient_light>0.4 0.4 0.4</ambient_light>
        <background_color>0.8 0.8 0.8</background_color>
        <camera_pose>-1 0 1 0 0.5 0</camera_pose>
      </plugin>

      <!-- World control -->
      <plugin filename="WorldControl" name="World control">
        <ignition-gui>
          <title>World control</title>
          <property type="bool" key="showTitleBar">false</property>
          <property type="bool" key="resizable">false</property>
          <property type="double" key="height">72</property>
          <property type="double" key="width">121</property>
          <property type="double" key="z">1</property>
          <anchor line="left" target="window" target_line="left"/>
          <anchor line="bottom" target="window" target_line="bottom"/>
        </ignition-gui>

        <play_pause>true</play_pause>
        <step>true</step>
        <start_paused>true</start_paused>

      </plugin>
    </gui>
    <model name="ground_plane">
      <static>true</static>
      <link name="link">
        <collision name="collision">
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>100 100</size>
            </plane>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>100 100</size>
            </plane>
          </geometry>
          <material>
            <ambient>0.8 0.8 0.8 1</ambient>
            <diffuse>0.8 0.8 0.8 1</diffuse>
            <specular>0.8 0.8 0.8 1</specular>
          </material>
        </visual>
      </link>
    </model>
    <model name="revolute_demo">
      <pose>0 0 0.005 0 0 0</pose>
      <link name="base_link">
        <pose>0.0 0.0 0.0 0 0 0</pose>
        <inertial>
          <inertia>
            <ixx>2.501</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>2.501</iyy>
            <iyz>0</iyz>
            <izz>5</izz>
          </inertia>
          <mass>120.0</mass>
        </inertial>
        <visual name="base_visual">
          <pose>0.0 0.0 0.0 0 0 0</pose>
          <geometry>
            <box>
              <size>0.5 0.5 0.01</size>
            </box>
          </geometry>
        </visual>
        <collision name="base_collision">
          <pose>0.0 0.0 0.0 0 0 0</pose>
          <geometry>
            <box>
              <size>0.5 0.5 0.01</size>
            </box>
          </geometry>
        </collision>
      </link>
      <link name="link1">
        <pose>0.0 0.0 0.2 0 0 0</pose>
        <inertial>
          <inertia>
            <ixx>0.032</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.032</iyy>
            <iyz>0</iyz>
            <izz>0.00012</izz>
          </inertia>
          <mass>0.6</mass>
        </inertial>
        <visual name="visual1">
          <geometry>
            <cylinder>
              <length>0.4</length>
              <radius>0.02</radius>
            </cylinder>
          </geometry>
          <material>
            <ambient>1 1 1 1</ambient>
            <diffuse>1 1 1 1</diffuse>
            <specular>1 1 1 1</specular>
          </material>
        </visual>
        <collision name="collision">
          <geometry>
            <cylinder>
              <length>0.4</length>
              <radius>0.02</radius>
            </cylinder>
          </geometry>
        </collision>
      </link>
      <joint name="j1" type="fixed">
        <parent>base_link</parent>
        <child>link1</child>
      </joint>
      <link name="link2">
        <!-- rotate by 30 degrees.
        angle_link2 = pi/6
        y = sin(angle_link2) * height_link2/2
        z = height_link1 + cos(angle_link2) * (height_link2/2)
        z = 0.4 + cos(pi/6) * (0.3/2)
        -->
        <pose>0.04 -0.075 0.53 0.5236 0 0</pose>
        <inertial>
          <pose>0.0 0.0 0.0 0 0 0</pose>
          <inertia>
            <ixx>0.032</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>0.032</iyy>
            <iyz>0</iyz>
            <izz>0.00012</izz>
          </inertia>
          <mass>0.6</mass>
        </inertial>
        <visual name="visual">
          <geometry>
            <cylinder>
              <length>0.3</length>
              <radius>0.02</radius>
            </cylinder>
          </geometry>
        </visual>
        <collision name="collision">
          <geometry>
            <cylinder>
              <length>0.3</length>
              <radius>0.02</radius>
            </cylinder>
          </geometry>
        </collision>
      </link>

      <joint name="j2" type="revolute">
        <pose>0 0 -0.15 0 0 0</pose>
        <parent>link1</parent>
        <child>link2</child>
        <axis>
          <xyz>1 0 0</xyz>
        </axis>
      </joint>
    </model>
  </world>
</sdf>
