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

        <!-- A simple light -->
        <light name="sun" type="directional">
            <pose>0 0 20 0 0 0</pose>
            <diffuse>0.8 0.8 0.8 1.0</diffuse>
            <specular>0.8 0.8 0.8 1.0</specular>
            <attenuation>
                <range>1000</range>
                <constant>0.9</constant>
                <linear>0.05</linear>
                <quadratic>0.01</quadratic>
            </attenuation>
            <cast_shadows>false</cast_shadows>
        </light>
        <scene>
            <grid>false</grid>
        </scene>
        <plugin filename="ignition-gazebo-physics-system" name="ignition::gazebo::systems::Physics">
        </plugin>
        <plugin filename="ignition-gazebo-sensors-system" name="ignition::gazebo::systems::Sensors">
            <render_engine>ogre2</render_engine>
        </plugin>
        <plugin filename="gz-sim-imu-system" name="gz::sim::systems::Imu">
        </plugin>
        <plugin filename="ignition-gazebo-user-commands-system" name="ignition::gazebo::systems::UserCommands">
        </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="string" key="state">docked</property>
                </ignition-gui>

                <engine>ogre2</engine>
                <scene>scene</scene>
                <ambient_light>0.4 0.4 0.4</ambient_light>
                <background_color>0.5 0.8 0.95</background_color>
                <!--camera_pose>276.46 -130.36 5.27 0 0.43 -1.24</camera_pose-->
                <camera_follow>
                    <target>prius_hybrid</target>
                    <p_gain>0.5</p_gain>
                    <offset>0.5 5 2</offset>
                </camera_follow>
            </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>

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

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

            </plugin>

            <!-- World statistics -->
            <plugin filename="WorldStats" name="World stats">
                <ignition-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>
                </ignition-gui>

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

            <plugin filename="ImageDisplay" name="dis">
                <ignition-gui>
                    <property key="state" type="string">docked</property>
                </ignition-gui>
                <topic>front_camera</topic>
            </plugin>

            <plugin filename="Teleop" name="Teleop">
                <ignition-gui>
                    <property type="string" key="state">docked</property>
                </ignition-gui>
                <topic>/cmd_vel</topic>
            </plugin>
        </gui>

        <model name="carolo_track">
            <static>true</static>
            <link name="link">
                <collision name="collision">
                    <geometry>
                        <plane>
                            <normal>0 0 1</normal>
                            <size>200 200</size>
                        </plane>
                    </geometry>
                    <surface>
                        <friction>
                            <ode>
                                <mu>50</mu>
                            </ode>
                        </friction>
                    </surface>
                </collision>
                <visual name="visual">
                    <cast_shadows>false</cast_shadows>
                    <geometry>
                        <plane>
                            <normal>0 0 1</normal>
                            <size>35 35</size>
                        </plane>
                    </geometry>
                    <material>
                        <pbr>
                            <metal>
                                <albedo_map>file://sherpa/materials/textures/track.png</albedo_map>
                            </metal>
                        </pbr>
                        <ambient>1 1 1 1</ambient>
                        <diffuse>1 1 1 1</diffuse>
                    </material>
                </visual>
                <pose>0 0 0 0 0 0</pose>
                <inertial>
                    <pose>0 0 0 0 0 0</pose>
                    <mass>1</mass>
                    <inertia>
                        <ixx>1</ixx>
                        <ixy>0</ixy>
                        <ixz>0</ixz>
                        <iyy>1</iyy>
                        <iyz>0</iyz>
                        <izz>1</izz>
                    </inertia>
                </inertial>
            </link>
            <pose>0 0 0 0 0 0</pose>
            <self_collide>false</self_collide>
        </model>
    </world>
</sdf>
