<launch>

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

  <param name="/use_sim_time" value="true" />
  <node name="rosbag_play"
    pkg="rosbag" type="play"
    args="$(find jsk_perception)/sample/data/2016-11-11-12-53-06_in_lab.bag --clock --loop" />

  <include file="$(find openni2_launch)/launch/openni2.launch">
    <arg name="load_driver" value="false" />
    <arg name="depth_registration" value="true" />
  </include>
  <arg name="MANAGER" value="/camera/camera_nodelet_manager" />

  <node name="background_subtraction"
        pkg="nodelet" type="nodelet"
        args="load jsk_perception/BackgroundSubstraction $(arg MANAGER)"
        respawn="true">
    <remap from="~image" to="/camera/rgb/image_rect_color" />
  </node>

  <group if="$(arg gui)">
    <node name="image_view_rgb"
          pkg="image_view" type="image_view">
      <remap from="image" to="/camera/rgb/image_rect_color"/>
    </node>
    <node name="image_view_fg"
          pkg="image_view" type="image_view">
      <remap from="image" to="background_subtraction/output"/>
    </node>
  </group>

</launch>
