<?xml version="1.0" ?>
<sdf version="1.3">
  <world name="default">
    <scene>
      <background>0 0 0 0</background>
      <ambient>1 1 1 1</ambient>
    </scene>

    <!-- unrotated objects for ground truth -->
    <model name="cam_x_rot_test_unrotated_objects_1">
      <pose>1 10 1 0 0 0</pose>
      <static>1</static>
      <link name="cam_x_rot_test_1_link_1">
        <pose>0 0 0 0 0 0</pose>
        <visual name="cam_x_rot_test_1_vis">
          <geometry>
            <box>
              <size>0.3 0.2 0.4</size>
            </box>
          </geometry>
          <material>
            <script>
              <name>Gazebo/Red</name>
              <uri>__default__</uri>
            </script>
          </material>
        </visual>
      </link>
      <link name="cam_x_rot_test_1_link_2">
        <pose>0 1 0 0 0 0</pose>
        <visual name="cam_x_rot_test_1_vis">
          <geometry>
            <box>
              <size>0.3 0.2 0.4</size>
            </box>
          </geometry>
          <material>
            <script>
              <name>Gazebo/Green</name>
              <uri>__default__</uri>
            </script>
          </material>
        </visual>
      </link>
    </model>
    <!-- unrotated cameras for red block ground truth -->
    <model name="cam_x_rot_test_unrotated_cameras_1">
      <static>1</static>
      <pose>0 10 1 0 0 0</pose>
      <link name="cam_x_rot_test_2_link">
        <visual name="cam_x_rot_test_1_vis">
          <pose>0 0 0 0 0 0</pose>
          <geometry>
            <box>
              <size>0.01 0.2 0.4</size>
            </box>
          </geometry>
        </visual>
        <sensor name="multicamera_sensor_unrotated" type="multicamera">
          <always_on>1</always_on>
          <update_rate>15</update_rate>
          <pose>0 0 0 0 0 0</pose>
          <camera name="left">
            <!-- should be in front of green block -->
            <pose>0 1.0 0 0 0 0</pose>
            <horizontal_fov>1.3962634</horizontal_fov>
            <image>
              <width>1024</width>
              <height>544</height>
              <format>R8G8B8</format>
            </image>
            <clip>
              <near>0.02</near>
              <far>100</far>
            </clip>
          </camera>
          <camera name="right">
            <!-- should be in front of red block -->
            <pose>0 0 0 0 0 0</pose>
            <horizontal_fov>1.3962634</horizontal_fov>
            <image>
              <width>1024</width>
              <height>544</height>
              <format>R8G8B8</format>
            </image>
            <clip>
              <near>0.02</near>
              <far>100</far>
            </clip>
          </camera>
        </sensor>
      </link>
    </model>
    <!-- Unrotated but translated cameras for ground truth.
         Both cameras should see the green block.
         Use this camera for green block ground truth in testing.
    -->
    <model name="cam_x_rot_test_translated_camera_1">
      <static>1</static>
      <pose>0 11 1 0 0 0</pose>
      <link name="cam_x_rot_test_2_link">
        <visual name="cam_x_rot_test_1_vis">
          <pose>0 0 0 0 0 0</pose>
          <geometry>
            <box>
              <size>0.01 0.2 0.4</size>
            </box>
          </geometry>
        </visual>
        <sensor name="camera_sensor_translated" type="camera">
          <update_rate>15</update_rate>
          <pose>0 0 0 0 0 0</pose>
          <camera name="single_camera">
            <pose>0 0 0 0 0 0</pose>
            <horizontal_fov>1.3962634</horizontal_fov>
            <image>
              <width>1024</width>
              <height>544</height>
              <format>R8G8B8</format>
            </image>
            <clip>
              <near>0.02</near>
              <far>100</far>
            </clip>
          </camera>
        </sensor>
      </link>
    </model>

    <!-- set of rotated objects for testing camera sensor -->
    <model name="cam_x_rot_test_rotated_objects_1">
      <pose>0 0 1 1.2 1.3 1.4</pose>
      <static>1</static>
      <link name="cam_x_rot_test_1_link_1">
        <pose>1 0 0 0 0 0</pose>
        <visual name="cam_x_rot_test_1_vis">
          <geometry>
            <box>
              <size>0.3 0.2 0.4</size>
            </box>
          </geometry>
          <material>
            <script>
              <name>Gazebo/Red</name>
              <uri>__default__</uri>
            </script>
          </material>
        </visual>
      </link>
      <link name="cam_x_rot_test_1_link_2">
        <pose>1 1 0 0 0 0</pose>
        <visual name="cam_x_rot_test_1_vis">
          <geometry>
            <box>
              <size>0.3 0.2 0.4</size>
            </box>
          </geometry>
          <material>
            <script>
              <name>Gazebo/Green</name>
              <uri>__default__</uri>
            </script>
          </material>
        </visual>
      </link>
    </model>
    <!-- test rotation inside sensor tags -->
    <model name="cam_x_rot_test_rotated_cameras_1">
      <static>1</static>
      <pose>0 0 1 1.2 1.3 1.4</pose>
      <link name="cam_x_rot_test_2_link">
        <visual name="cam_x_rot_test_1_vis">
          <pose>0 0 0 0 0 0</pose>
          <geometry>
            <box>
              <size>0.01 0.2 0.4</size>
            </box>
          </geometry>
        </visual>
        <sensor name="multicamera_sensor_rotated1" type="multicamera">
          <update_rate>15</update_rate>
          <pose>0 0 0 0 0 0</pose>
          <camera name="left">
            <pose>0 1.0 0 0 0 0</pose>
            <horizontal_fov>1.3962634</horizontal_fov>
            <image>
              <width>1024</width>
              <height>544</height>
              <format>R8G8B8</format>
            </image>
            <clip>
              <near>0.02</near>
              <far>100</far>
            </clip>
          </camera>
          <camera name="right">
            <pose>0 0 0 0 0 0</pose>
            <horizontal_fov>1.3962634</horizontal_fov>
            <image>
              <width>1024</width>
              <height>544</height>
              <format>R8G8B8</format>
            </image>
            <clip>
              <near>0.02</near>
              <far>100</far>
            </clip>
          </camera>
        </sensor>
      </link>
    </model>
    <!-- test rotation inside camera tags -->
    <model name="cam_x_rot_test_rotated_cameras_2">
      <static>1</static>
      <pose>0 0 1 0 0 0</pose>
      <link name="cam_x_rot_test_2_link">
        <visual name="cam_x_rot_test_1_vis">
          <pose>0 0 0 1.2 1.3 1.4</pose>
          <geometry>
            <box>
              <size>0.01 0.2 0.4</size>
            </box>
          </geometry>
        </visual>
        <sensor name="multicamera_sensor_rotated2" type="multicamera">
          <update_rate>15</update_rate>
          <camera name="left">
            <!-- offset left cameras to put it in front of the green block -->
            <!-- the position offset is obtained by
                 ignition::math::Quaterniond a(1.2, 1.3, 1.4);
                 a.RotateVector(ignition::math::Vector3d(0, 1, 0)); -->
            <pose>-0.204442 0.946596 0.249319 1.2 1.3 1.4</pose>
            <horizontal_fov>1.3962634</horizontal_fov>
            <image>
              <width>1024</width>
              <height>544</height>
              <format>R8G8B8</format>
            </image>
            <clip>
              <near>0.02</near>
              <far>100</far>
            </clip>
          </camera>
          <camera name="right">
            <pose>0 0 0 1.2 1.3 1.4</pose>
            <horizontal_fov>1.3962634</horizontal_fov>
            <image>
              <width>1024</width>
              <height>544</height>
              <format>R8G8B8</format>
            </image>
            <clip>
              <near>0.02</near>
              <far>100</far>
            </clip>
          </camera>
        </sensor>
      </link>
    </model>
  </world>
</sdf>
