<launch>
  <arg name="gui" default="true"/>

  <include file="$(find jsk_perception)/sample/sample_image_publisher.launch">
    <arg name="gui" value="false"/>
  </include>

  <node name="rect_array_publisher"
        pkg="rostopic" type="rostopic"
        args="pub -r 10 -s /rect_array_publisher/output jsk_recognition_msgs/RectArray
              '{header: {stamp: now},
                rects: [{x: 600, y: 400, width: 500, height: 200},
                        {x: 400, y: 300, width: 600, height: 400},
                        {x: 800, y: 100, width: 200, height: 800},
                        {x: 700, y: 500, width: 800, height: 500},
                        ]}'"/>

  <node name="binpack_rect_array"
        pkg="jsk_perception" type="binpack_rect_array.py">
    <remap from="~input" to="raw_image_rgb/image_color"/>
    <remap from="~input/rect_array" to="rect_array_publisher/output"/>
    <rosparam>
      approximate_sync: true
    </rosparam>
  </node>

  <group if="$(arg gui)">
    <node name="draw_rects"
          pkg="nodelet" type="nodelet"
          args="standalone jsk_perception/DrawRects">
      <remap from="~input" to="raw_image_rgb/image_color"/>
      <remap from="~input/rects" to="rect_array_publisher/output"/>
      <rosparam>
        approximate_sync: true
        rect_boldness: 15
      </rosparam>
    </node>

    <node name="tile_image"
          pkg="jsk_perception" type="tile_image.py">
      <rosparam>
        input_topics:
          - draw_rects/output
          - binpack_rect_array/output
        no_sync: true
      </rosparam>
    </node>

    <node name="image_view"
          pkg="image_view" type="image_view">
      <remap from="image" to="tile_image/output"/>
    </node>
  </group>
</launch>
