<launch>
  <arg name="local_planner"          default="dwb"             doc="Local planner can be either dwa, dwb, eband, base, teb or pose" />
  <arg name="map_file" default="" doc="Path to a map .yaml file (required)." />
  <arg name="empty_file" default="" doc="Path to a map .yaml file (required)." />

  <arg name="virtual_walls_map_file" default="$(arg map_file)" doc="Path to a virtual walls map .yaml file (optional)." />
  <arg name="with_virtual_walls" default="true" />

  <arg name="preferred_zones_map_file" default="$(arg empty_file)" doc="Path to a preferred zones .yaml file (optional)." />
  <arg name="with_preferred_zones" default="true" />

  <arg name="unpreferred_zones_map_file" default="$(arg empty_file)" doc="Path to a unpreferred zones .yaml file (optional)." />
  <arg name="with_unpreferred_zones" default="true" />

  <arg name="critical_zones_map_file" default="$(arg empty_file)" doc="Path to a critical zones .yaml file (optional)." />
  <arg name="with_critical_zones" default="true" />

  <arg name="direction_zones_map_file" default="$(arg empty_file)" doc="Path to a direction zones .yaml file (optional)." />
  <arg name="with_direction_zones" default="true" />

  <arg name="prefix" default="" />
  <arg name="namespace" default="$(arg prefix)" doc="Namespace to push all topics into."/>

  <group if="$(eval namespace != '')" ns="$(arg namespace)">
    <include file="$(find mir_navigation)/launch/start_maps.launch">
      <arg name="map_file" value="$(arg map_file)" />
      <arg name="empty_file" value="$(arg empty_file)" />
      <arg name="virtual_walls_map_file" value="$(arg virtual_walls_map_file)" />
      <arg name="with_virtual_walls" value="$(arg with_virtual_walls)" />
      <!-- Đang thử nghiệm -->
      <arg name="preferred_zones_map_file" default="$(arg preferred_zones_map_file)" doc="Path to a preferred zones .yaml file (optional)." />
      <arg name="with_preferred_zones" default="$(arg with_preferred_zones)" />

      <arg name="unpreferred_zones_map_file" default="$(arg unpreferred_zones_map_file)" doc="Path to a unpreferred zones .yaml file (optional)." />
      <arg name="with_unpreferred_zones" default="$(arg with_unpreferred_zones)" />   

      <arg name="critical_zones_map_file" default="$(arg critical_zones_map_file)" doc="Path to a critical zones .yaml file (optional)." />
      <arg name="with_critical_zones" default="$(arg with_critical_zones)" />        

      <arg name="direction_zones_map_file" default="$(arg direction_zones_map_file)" doc="Path to a direction zones .yaml file (optional)." />
      <arg name="with_direction_zones" default="$(arg with_direction_zones)" />        
    </include>

    <include file="$(find mir_navigation)/launch/move_base.xml">
      <arg name="local_planner" value="$(arg local_planner)"/>
      <arg name="with_virtual_walls" value="$(arg with_virtual_walls)" />
      <!-- Đang thử nghiệm -->
      <arg name="with_preferred_zones" default="$(arg with_preferred_zones)" />
      <arg name="with_unpreferred_zones" default="$(arg with_unpreferred_zones)" />   
      <arg name="with_critical_zones" default="$(arg with_critical_zones)" /> 
      <arg name="with_direction_zones" default="$(arg with_direction_zones)" /> 
      <arg name="prefix" value="$(arg prefix)" />
    </include>
  </group>

  <!-- Duplicate of the above in case namespace is empty. This is necessary to
       avoid the "<group> tag has an empty 'ns' attribute" parsing error. -->
  <group unless="$(eval namespace != '')">
    <include file="$(find mir_navigation)/launch/start_maps.launch">
      <arg name="map_file" value="$(arg map_file)" />
      <arg name="empty_file" value="$(arg empty_file)" />
      <arg name="virtual_walls_map_file" value="$(arg virtual_walls_map_file)" />
      <arg name="with_virtual_walls" value="$(arg with_virtual_walls)" />
      <!-- Đang thử nghiệm -->
      <arg name="preferred_zones_map_file" default="$(arg preferred_zones_map_file)" doc="Path to a preferred zones .yaml file (optional)." />
      <arg name="with_preferred_zones" default="$(arg with_preferred_zones)" />

      <arg name="unpreferred_zones_map_file" default="$(arg unpreferred_zones_map_file)" doc="Path to a unpreferred zones .yaml file (optional)." />
      <arg name="with_unpreferred_zones" default="$(arg with_unpreferred_zones)" />  

      <arg name="critical_zones_map_file" default="$(arg critical_zones_map_file)" doc="Path to a critical zones .yaml file (optional)." />
      <arg name="with_critical_zones" default="$(arg with_critical_zones)" />  

      <arg name="direction_zones_map_file" default="$(arg direction_zones_map_file)" doc="Path to a direction zones .yaml file (optional)." />
      <arg name="with_direction_zones" default="$(arg with_direction_zones)" />      
    </include>

    <include file="$(find mir_navigation)/launch/move_base.xml">
      <arg name="local_planner" value="$(arg local_planner)"/>
      <arg name="with_virtual_walls" value="$(arg with_virtual_walls)" />
      <!-- Đang thử nghiệm -->
      <arg name="with_preferred_zones" default="$(arg with_preferred_zones)" />
      <arg name="with_unpreferred_zones" default="$(arg with_unpreferred_zones)" />  
      <arg name="with_critical_zones" default="$(arg with_critical_zones)" />  
      <arg name="with_direction_zones" default="$(arg with_direction_zones)" /> 
      <arg name="prefix" value="$(arg prefix)" />
    </include>
  </group>
</launch>
