<launch>
  <arg name="gui" default="true" />
  <node name="image_publisher"
        pkg="jsk_perception" type="image_publisher.py">
    <rosparam subst_value="true">
      publish_info: false
      file_name: $(find jsk_recognition_utils)/sample/images/real_world_checkerboard_grid_7x6_size_0.108/rgb_image_raw.jpg
    </rosparam>
  </node>

  <node name="rect_array_publisher"
        pkg="rostopic" type="rostopic"
        output="screen"
        args="pub -r 0.5 -s /rect_array_publisher/output jsk_recognition_msgs/RectArray
              '{header: {stamp: now, frame_id: camera_rgb_optical_frame},
                rects: [{x: 50, y: 50, width: 200, height: 80},
                        {x: 70, y: 100, width: 30, height: 120},
                        {x: 140, y: 150, width: 90, height: 70}]}'"/>

  <node name="rects_to_cpi"
        pkg="jsk_recognition_utils" type="rect_array_to_cluster_point_indices.py"
        output="screen">
    <remap from="~input" to="rect_array_publisher/output"/>
    <rosparam>
      use_info: false
      img_height: 480
      img_width: 640
    </rosparam>
  </node>

  <node name="image_cluster_indices_decomposer"
        pkg="jsk_perception" type="image_cluster_indices_decomposer.py"
        output="screen">
    <remap from="~input" to="image_publisher/output" />
    <remap from="~input/cluster_indices" to="rects_to_cpi/output" />
    <rosparam>
      approximate_sync: true
      queue_size: 100
      slop: 10.0
    </rosparam>
  </node>

  <node name="image_view" pkg="image_view" type="image_view" if="$(arg gui)">
    <remap from="image" to="image_cluster_indices_decomposer/output" />
  </node>

</launch>
