<?xml version="1.0" ?>
<!--
  Ignition Gazebo sensor demo

  Listen to sensor readings:

    Altimeter: ign topic -e -t /altimeter
    Imu: ign topic -e -t /imu
    Magnetometer: ign topic -e -t /magnetometer
    Air pressure: ign topic -e -t /air_pressure
-->
<sdf version="1.6">
  <world name="sensors">
    <physics name="1ms" type="ignored">
      <max_step_size>0.001</max_step_size>
      <real_time_factor>1.0</real_time_factor>
    </physics>
    <plugin
      filename="ignition-gazebo-physics-system"
      name="ignition::gazebo::systems::Physics">
    </plugin>
    <plugin
      filename="ignition-gazebo-air-pressure-system"
      name="ignition::gazebo::systems::AirPressure">
    </plugin>
    <plugin
      filename="ignition-gazebo-altimeter-system"
      name="ignition::gazebo::systems::Altimeter">
    </plugin>
    <plugin
      filename="ignition-gazebo-imu-system"
      name="ignition::gazebo::systems::Imu">
    </plugin>
    <plugin
      filename="ignition-gazebo-magnetometer-system"
      name="ignition::gazebo::systems::Magnetometer">
    </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>

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

    <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="sensors_box">
      <pose>4 0 3.0 0 0.0 3.14</pose>
      <link name="link">
        <pose>0.05 0.05 0.05 0 0 0</pose>
        <inertial>
          <mass>0.1</mass>
          <inertia>
            <ixx>0.000166667</ixx>
            <iyy>0.000166667</iyy>
            <izz>0.000166667</izz>
          </inertia>
        </inertial>
        <collision name="collision">
          <geometry>
            <box>
              <size>0.1 0.1 0.1</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>0.1 0.1 0.1</size>
            </box>
          </geometry>
        </visual>
        <sensor name="altimeter" type="altimeter">
          <always_on>1</always_on>
          <update_rate>30</update_rate>
          <visualize>true</visualize>
          <topic>altimeter</topic>
          <enable_metrics>true</enable_metrics>
          <altimeter>
            <vertical_position>
              <noise type="gaussian">
                <mean>0.1</mean>
                <stddev>0.2</stddev>
              </noise>
            </vertical_position>
            <vertical_velocity>
              <noise type="gaussian">
                <mean>0.2</mean>
                <stddev>0.1</stddev>
              </noise>
            </vertical_velocity>
          </altimeter>
        </sensor>
        <sensor name="air_pressure" type="air_pressure">
          <always_on>1</always_on>
          <update_rate>30</update_rate>
          <visualize>true</visualize>
          <topic>air_pressure</topic>
          <enable_metrics>true</enable_metrics>
          <air_pressure>
            <reference_altitude>123</reference_altitude>
            <pressure>
              <noise type="gaussian">
                <mean>0.2</mean>
                <stddev>0.1</stddev>
              </noise>
            </pressure>
          </air_pressure>
        </sensor>

        <sensor name="imu" type="imu">
          <always_on>1</always_on>
          <update_rate>100</update_rate>
          <visualize>true</visualize>
          <topic>imu</topic>
          <enable_metrics>true</enable_metrics>
        </sensor>
        <sensor name="magnetometer" type="magnetometer">
          <always_on>1</always_on>
          <update_rate>100</update_rate>
          <visualize>true</visualize>
          <topic>magnetometer</topic>
          <enable_metrics>true</enable_metrics>
          <magnetometer>
            <x>
              <noise type="gaussian">
                <mean>0.0</mean>
                <stddev>0.1</stddev>
              </noise>
            </x>
            <y>
              <noise type="gaussian">
                <mean>0.0</mean>
                <stddev>0.1</stddev>
              </noise>
            </y>
            <z>
              <noise type="gaussian">
                <mean>0.0</mean>
                <stddev>0.1</stddev>
              </noise>
            </z>
          </magnetometer>
        </sensor>
      </link>
    </model>

  </world>
</sdf>
