<?xml version="1.0" ?>
<!--
　Copyright 2025 Reazon Holdings, Inc.

　Licensed under the Apache License, Version 2.0 (the "License");
　you may not use this file except in compliance with the License.
　You may obtain a copy of the License at

　    http://www.apache.org/licenses/LICENSE-2.0

　Unless required by applicable law or agreed to in writing, software
　distributed under the License is distributed on an "AS IS" BASIS,
　WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
　See the License for the specific language governing permissions and
　limitations under the License.
-->
<sdf version="1.6">
  <world name="shapes">
    <physics type="ode">
      <max_step_size>0.004</max_step_size>
      <real_time_factor>1.0</real_time_factor>
      <real_time_update_rate>250</real_time_update_rate>
    </physics>
    <plugin
      filename="gz-sim-physics-system"
      name="gz::sim::systems::Physics">
    </plugin>
    <plugin
      filename="gz-sim-user-commands-system"
      name="gz::sim::systems::UserCommands">
    </plugin>
    <plugin
      filename="gz-sim-scene-broadcaster-system"
      name="gz::sim::systems::SceneBroadcaster">
    </plugin>
    <plugin
      filename="gz-sim-sensors-system"
      name="gz::sim::systems::Sensors">
      <!-- <render_engine>ogre</render_engine> -->
      <render_engine>ogre2</render_engine>
      <!-- <render_engine>optix</render_engine> -->
    </plugin>
    <plugin
      filename="gz-sim-contact-system"
      name="gz::sim::systems::Contact">
    </plugin>

    <gui fullscreen="0">

      <!-- 3D scene -->
      <plugin filename="MinimalScene" name="3D View">
        <gz-gui>
          <title>3D View</title>
          <property type="bool" key="showTitleBar">false</property>
          <property type="string" key="state">docked</property>
        </gz-gui>

        <engine>ogre2</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>-6 0 6 0 0.5 0</camera_pose>
      </plugin>

      <!-- Plugins that add functionality to the scene -->
      <plugin filename="EntityContextMenuPlugin" name="Entity context menu">
        <gz-gui>
          <property key="state" type="string">floating</property>
          <property key="width" type="double">5</property>
          <property key="height" type="double">5</property>
          <property key="showTitleBar" type="bool">false</property>
        </gz-gui>
      </plugin>
      <plugin filename="GzSceneManager" name="Scene Manager">
        <gz-gui>
          <property key="resizable" type="bool">false</property>
          <property key="width" type="double">5</property>
          <property key="height" type="double">5</property>
          <property key="state" type="string">floating</property>
          <property key="showTitleBar" type="bool">false</property>
        </gz-gui>
      </plugin>
      <plugin filename="InteractiveViewControl" name="Interactive view control">
        <gz-gui>
          <property key="resizable" type="bool">false</property>
          <property key="width" type="double">5</property>
          <property key="height" type="double">5</property>
          <property key="state" type="string">floating</property>
          <property key="showTitleBar" type="bool">false</property>
        </gz-gui>
      </plugin>
      <plugin filename="CameraTracking" name="Camera Tracking">
        <gz-gui>
          <property key="resizable" type="bool">false</property>
          <property key="width" type="double">5</property>
          <property key="height" type="double">5</property>
          <property key="state" type="string">floating</property>
          <property key="showTitleBar" type="bool">false</property>
        </gz-gui>
      </plugin>
      <plugin filename="MarkerManager" name="Marker manager">
        <gz-gui>
          <property key="resizable" type="bool">false</property>
          <property key="width" type="double">5</property>
          <property key="height" type="double">5</property>
          <property key="state" type="string">floating</property>
          <property key="showTitleBar" type="bool">false</property>
        </gz-gui>
      </plugin>
      <plugin filename="SelectEntities" name="Select Entities">
        <gz-gui>
          <anchors target="Select entities">
            <line own="right" target="right"/>
            <line own="top" target="top"/>
          </anchors>
          <property key="resizable" type="bool">false</property>
          <property key="width" type="double">5</property>
          <property key="height" type="double">5</property>
          <property key="state" type="string">floating</property>
          <property key="showTitleBar" type="bool">false</property>
        </gz-gui>
      </plugin>
      <plugin filename="VisualizationCapabilities" name="Visualization Capabilities">
        <gz-gui>
          <property key="resizable" type="bool">false</property>
          <property key="width" type="double">5</property>
          <property key="height" type="double">5</property>
          <property key="state" type="string">floating</property>
          <property key="showTitleBar" type="bool">false</property>
        </gz-gui>
      </plugin>

      <plugin filename="Spawn" name="Spawn Entities">
        <gz-gui>
          <anchors target="Select entities">
            <line own="right" target="right"/>
            <line own="top" target="top"/>
          </anchors>
          <property key="resizable" type="bool">false</property>
          <property key="width" type="double">5</property>
          <property key="height" type="double">5</property>
          <property key="state" type="string">floating</property>
          <property key="showTitleBar" type="bool">false</property>
        </gz-gui>
      </plugin>

      <!-- World control -->
      <plugin filename="WorldControl" name="World control">
        <gz-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="z">1</property>

          <property type="string" key="state">floating</property>
          <anchors target="3D View">
            <line own="left" target="left"/>
            <line own="bottom" target="bottom"/>
          </anchors>
        </gz-gui>

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

      </plugin>

      <!-- World statistics -->
      <plugin filename="WorldStats" name="World stats">
        <gz-gui>
          <title>World stats</title>
          <property type="bool" key="showTitleBar">false</property>
          <property type="bool" key="resizable">false</property>
          <property type="double" key="height">110</property>
          <property type="double" key="width">290</property>
          <property type="double" key="z">1</property>

          <property type="string" key="state">floating</property>
          <anchors target="3D View">
            <line own="right" target="right"/>
            <line own="bottom" target="bottom"/>
          </anchors>
        </gz-gui>

        <sim_time>true</sim_time>
        <real_time>true</real_time>
        <real_time_factor>true</real_time_factor>
        <iterations>true</iterations>
      </plugin>

      <!-- Insert simple shapes -->
      <plugin filename="Shapes" name="Shapes">
        <gz-gui>
          <property key="resizable" type="bool">false</property>
          <property key="x" type="double">0</property>
          <property key="y" type="double">0</property>
          <property key="width" type="double">250</property>
          <property key="height" type="double">50</property>
          <property key="state" type="string">floating</property>
          <property key="showTitleBar" type="bool">false</property>
          <property key="cardBackground" type="string">#666666</property>
        </gz-gui>
      </plugin>

      <!-- Insert lights -->
      <plugin filename="Lights" name="Lights">
        <gz-gui>
          <property key="resizable" type="bool">false</property>
          <property key="x" type="double">250</property>
          <property key="y" type="double">0</property>
          <property key="width" type="double">150</property>
          <property key="height" type="double">50</property>
          <property key="state" type="string">floating</property>
          <property key="showTitleBar" type="bool">false</property>
          <property key="cardBackground" type="string">#666666</property>
        </gz-gui>
      </plugin>

      <!-- Translate / rotate -->
      <plugin filename="TransformControl" name="Transform control">
        <gz-gui>
          <property key="resizable" type="bool">false</property>
          <property key="x" type="double">0</property>
          <property key="y" type="double">50</property>
          <property key="width" type="double">250</property>
          <property key="height" type="double">50</property>
          <property key="state" type="string">floating</property>
          <property key="showTitleBar" type="bool">false</property>
          <property key="cardBackground" type="string">#777777</property>
        </gz-gui>
      </plugin>

      <!-- Inspector -->
      <plugin filename="ComponentInspector" name="Component inspector">
        <gz-gui>
          <property type="string" key="state">docked_collapsed</property>
        </gz-gui>
      </plugin>

      <!-- Entity tree -->
      <plugin filename="EntityTree" name="Entity tree">
        <gz-gui>
          <property type="string" key="state">docked_collapsed</property>
        </gz-gui>
      </plugin>

      <!-- View angle -->
      <plugin filename="ViewAngle" name="View angle">
        <gz-gui>
          <property type="string" key="state">docked_collapsed</property>
        </gz-gui>
      </plugin>

      <!-- Image Display Plugins for visualization -->
      <plugin filename="ImageDisplay" name="Image Display">
        <gz-gui>
        </gz-gui>
        <topic>camera</topic>
      </plugin>

      <plugin name='Grid config' filename='GridConfig'>
          <gz-gui>
            <property type="string" key="state">docked_collapsed</property>
          </gz-gui>
          <insert>
              <!-- total size = length * cell count-->
              <horizontal_cell_count>50</horizontal_cell_count>

              <!-- 0 actually means one plane-->
              <vertical_cell_count>0</vertical_cell_count>

              <!--5m cells-->
              <cell_length>2.0</cell_length>

              <pose>0 0 0  0 0 0</pose>
              <color>1 1 1 0.7</color>
          </insert>
      </plugin>
    </gui>

    <light type="directional" name="sun">
      <cast_shadows>true</cast_shadows>
      <pose>0 0 10 0 0 0</pose>
      <diffuse>0.8 0.8 0.8 1</diffuse>
      <specular>0.2 0.2 0.2 1</specular>
      <attenuation>
        <range>1000</range>
        <constant>0.9</constant>
        <linear>0.01</linear>
        <quadratic>0.001</quadratic>
      </attenuation>
      <direction>-0.5 0.1 -0.9</direction>
    </light>

    <scene>
      <grid>false</grid>
      <ambient>0.4 0.4 0.4 1</ambient>
      <!-- <background>0.7 0.7 0.7 1</background> -->
      <background>0.8 0.8 0.8</background>
      <shadows>true</shadows>
    </scene>

    <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>

    <!-- Cars, all of them have label 40 -->
    <include>
      <name>Car1</name>
      <pose>-2 -2 0 0 0 0</pose>
      <uri>
        https://fuel.gazebosim.org/1.0/OpenRobotics/models/Hatchback blue
      </uri>
      <plugin filename="gz-sim-label-system" name="gz::sim::systems::Label">
        <label>40</label>
      </plugin>
    </include>

    <include>
      <name>Car2</name>
      <pose>-3 -5 0 0 0 0</pose>
      <uri>
        https://fuel.gazebosim.org/1.0/OpenRobotics/models/Pickup
      </uri>
      <plugin filename="gz-sim-label-system" name="gz::sim::systems::Label">
        <label>40</label>
      </plugin>
    </include>

    <include>
      <name>Car3</name>
      <pose>-4 3 0 0 0 -1.57</pose>
      <uri>
        https://fuel.gazebosim.org/1.0/OpenRobotics/models/SUV
      </uri>
      <plugin filename="gz-sim-label-system" name="gz::sim::systems::Label">
        <label>40</label>
      </plugin>
    </include>

    <!-- Tree, all of them have label 30 -->
    <include>
      <name>tree1</name>
      <pose>-2 5 0 0 0 0</pose>
      <uri>
        https://fuel.gazebosim.org/1.0/OpenRobotics/models/Pine Tree
      </uri>
      <plugin filename="gz-sim-label-system" name="gz::sim::systems::Label">
        <label>30</label>
      </plugin>
    </include>

    <include>
      <name>tree2</name>
      <pose>-7 2 0 0 0 0</pose>
      <uri>
        https://fuel.gazebosim.org/1.0/OpenRobotics/models/Pine Tree
      </uri>
      <plugin filename="gz-sim-label-system" name="gz::sim::systems::Label">
        <label>30</label>
      </plugin>
    </include>

    <include>
      <name>tree3</name>
      <pose>-7 -4 0 0 0 0</pose>
      <uri>
        https://fuel.gazebosim.org/1.0/OpenRobotics/models/Pine Tree
      </uri>
      <plugin filename="gz-sim-label-system" name="gz::sim::systems::Label">
        <label>30</label>
      </plugin>
    </include>

    <!-- Home, we didn't annotate (label) it, so it will be considered as background -->
    <include>
      <name>home</name>
      <pose>-15 0 0 0 0 1.57</pose>
      <uri>
        https://fuel.gazebosim.org/1.0/OpenRobotics/models/Collapsed House
      </uri>
    </include>

    <!-- Cones, all with label 20-->
    <include>
      <name>cone1</name>
      <pose>0 1 0 0 0 1.570796</pose>
      <uri>
        https://fuel.gazebosim.org/1.0/OpenRobotics/models/Construction Cone
      </uri>
      <plugin filename="gz-sim-label-system" name="gz::sim::systems::Label">
        <label>20</label>
      </plugin>
    </include>

    <include>
      <name>cone2</name>
      <pose>0 4 0 0 0 1.570796</pose>
      <uri>
        https://fuel.gazebosim.org/1.0/OpenRobotics/models/Construction Cone
      </uri>
      <plugin filename="gz-sim-label-system" name="gz::sim::systems::Label">
        <label>20</label>
      </plugin>
    </include>

    <include>
      <name>cone3</name>
      <pose>2 -2 0 0 0.0 1.57</pose>
      <uri>
        https://fuel.gazebosim.org/1.0/OpenRobotics/models/Construction Cone
      </uri>
      <plugin filename="gz-sim-label-system" name="gz::sim::systems::Label">
        <label>20</label>
      </plugin>
    </include>
  </world>
</sdf>
