<!-- Launches move_base_stage
     
     Expects args
     - resolution (in meters/cell).  Used by map_server.
     - world_file (full path).  Used by stage.
     - fake_localization (true or false).  If false, amcl will be used.

-->

<launch>

  <arg name="resolution"/>
  <arg name="world_file"/>
  <arg name="fake_localization"/>

  <master auto="start"/>
  <param name="/use_sim_time" value="true"/>

  <include file="$(find move_base_stage)/move_base/move_base.xml"/>
  <include file="$(find move_base_stage)/move_base/nav_view.xml"/>

  <!-- Map server depends on resolution arg -->
  <node name="map_server" pkg="map_server" type="map_server" args="$(find 2dnav_stage)/maps/willow-full-$(arg resolution).pgm $(arg resolution)" />

  <!-- Stage depends on world_file arg -->
  <node pkg="stage" type="stageros" name="stageros" args="$(optenv ROS_STAGE_GRAPHICS -g) $(arg world_file)" >
    <param name="base_watchdog_timeout" value="0.2" />
  </node>

  <!-- Either fake_localization or amcl -->
  <group if="$(arg fake_localization)">
    <node name="fake_localization" pkg="fake_localization" type="fake_localization" respawn="false" />
  </group>
  
  <group unless="$(arg fake_localization)">
    <include file="$(find move_base_stage)/config/amcl_node.xml"/>  
  </group>


</launch>
