<launch>

  <arg name="gui" default="true" />
  <arg name="gpu" default="-1" />
  <arg name="INPUT_IMAGE" default="/camera/rgb/image_rect_color" />

  <include file="$(find jsk_perception)/sample/include/play_rosbag_people.xml" />

  <node name="people_pose_estimation_2d"
        pkg="jsk_perception" type="people_pose_estimation_2d.py"
        output="screen">
    <remap from="~input" to="$(arg INPUT_IMAGE)" />
    <rosparam subst_value="true">
      gpu: $(arg gpu)
      model_file: $(find jsk_perception)/trained_data/pose_estimation_2d_chainermodel.pkl
      with_depth: false
      scales: [0.38]
      stride: 8
    </rosparam>
  </node>

  <node name="human_mesh_recovery"
        pkg="jsk_perception" type="human_mesh_recovery.py"
        output="screen">
    <remap from="~input" to="$(arg INPUT_IMAGE)" />
    <remap from="~input/pose" to="people_pose_estimation_2d/pose" />
    <rosparam subst_value="true">
      gpu: $(arg gpu)
      with_people_pose: true
      smpl_model_file: $(find jsk_perception)/trained_data/hmr_smpl.npz
      encoder_model_file: $(find jsk_perception)/trained_data/hmr_encoder_fc3_model.npz
      resnet_v2_50_model_file : $(find jsk_perception)/trained_data/hmr_resnet_v2_50_model.npz
    </rosparam>
  </node>

  <node name="people_poses_to_poses"
        pkg="jsk_recognition_msgs" type="people_pose_array_to_pose_array.py">
    <remap from="~input" to="human_mesh_recovery/output/pose" />
  </node>

  <group if="$(arg gui)" >
    <node name="rviz"
          pkg="rviz" type="rviz"
          args="-d $(find jsk_perception)/sample/config/human_mesh_recovery.rviz">
    </node>
  </group>

</launch>
