<launch>
  <arg name="LAUNCH_DYNAMIC_TF_PUBLISHER" default="true" />
  <arg name="default_frame_id" default="odom" />
  <arg name="robot_marker_frame_id" default="robot_marker_root" />
  <arg name="use_default_robot_model_config" default="true" />
  <arg name="robot_model_config" default="$(find jsk_interactive_marker)/config/biped_urdf_model_marker.yaml" />
  <arg name="ROBOT_DESCRIPTION" default="/robot_description" />

  <!-- robot marker using /robot_description -->
  <node pkg="jsk_interactive_marker" type="urdf_model_marker" name="jsk_model_marker_interface" clear_params="true">
    <remap from="/robot_description" to="$(arg ROBOT_DESCRIPTION)" />
    <param name="use_dynamic_tf" value="$(arg LAUNCH_DYNAMIC_TF_PUBLISHER)"/>
    <rosparam param="model_config" subst_value="true" if="$(arg use_default_robot_model_config)">
      - name: "robot"
        frame-id: "$(arg robot_marker_frame_id)"
        robot: false
        mode: "visualization"
        use_robot_description: true
        scale: 1.0
        fixed_link:
          - lleg_end_coords
          - rleg_end_coords
    </rosparam>
    <rosparam command="load" param="model_config" file="$(arg robot_model_config)" unless="$(arg use_default_robot_model_config)"/>
  </node>

  <!-- control marker to move robot marker -->
  <node pkg="jsk_interactive_marker" type="urdf_control_marker" name="urdf_control_marker">
    <param name="use_dynamic_tf" value="$(arg LAUNCH_DYNAMIC_TF_PUBLISHER)"/>
    <param name="move_2d" value="true"/>
    <param name="frame_id" value="$(arg default_frame_id)"/>
    <param name="marker_frame_id" value="$(arg robot_marker_frame_id)"/>
    <param name="fixed_frame_id" value="odom" />
  </node>

  <!-- dynamic tf publisher for urdf marker -->
  <group if="$(arg LAUNCH_DYNAMIC_TF_PUBLISHER)">
    <node pkg="dynamic_tf_publisher" type="tf_publish.py" name="dynamic_tf_publisher_for_urdf_marker">
      <param name="use_cache" type="bool" value="false"/>
    </node>
  </group>
</launch>
