Skip to content
MohitShridhar edited this page Aug 26, 2014 · 17 revisions

Move Base Launch

Once you have finished setting-up the map-database, you can configure your move_base launch file. Use this template as a reference while creating your application-specific move_base.launch file. It's recommended that you namespace all your nodes, even if you are controlling just one robot. You should end up with something similiar to this:

<group ns="robot0">

    <arg name="modelName" value="robot0"/>
    <param name="tf_prefix" value="$(arg modelName)" />

    <!-- Launch elevator manager -->
    <node pkg="multi_map_navigation" type="elevator_manager.py" name="elevator_blast" output="screen"/>
    <!-- Other custom transition servers should be started here  -->

    <!-- Launch map_store with MongoDB contents -->
    <include file="$(find multi_map_navigation)/launch/setup/map_store.launch">
      <arg name="frame_id_ref" value="$(arg modelName)/map"/>
    </include>

    <!-- Move base: -->
    <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
      <remap from="map" to="map_store_map"/>
	  ... move_base config ...
    </node>

	<!-- Multi-Map Navigation -->
    <node pkg="multi_map_navigation" type="multi_map_navigation_manager.py" name="multi_map_navigation" output="screen">
      <param name="definition_file" value="$(find <navigation_stack>)/config/cfg.yaml" />
      <param name="transition_types" value="elevator_blast" />

      <param name="robot_namespace" value="$(arg modelName)"/>
      <param name="base_frame" value="base_link"/>
    </node>

    <!-- AMCL: -->
    <include file="$(find <navigation_stack>)/launch/amcl.launch">
      <arg name="botName" value="$(arg modelName)"/>
    </include>

</group>

Details:

<param name="tf_prefix" value="$(arg modelName)" />

Ensure that all the tf frames are properly namespaced to eliminate transform conflicts.

<node pkg="multi_map_navigation" type="elevator_manager.py" name="elevator_blast" output="screen"/>

This is where you start your actionlib servers to handle various types of transitions (eg: door_blast, elevator_blast etc.) Before a map-swap is executed, this actionlib server will be called by the navigation manager. Here the elevator_manager.py script interacts with a Gazebo elevator model from this package to set target floors. For real elevators, you will need to implement the elevator-interaction inside this script (replace the Gazebo elevator interface).

<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
  <remap from="map" to="map_store_map"/>
  ... move_base config ...
</node>

Note the important remapping of map to map_store_map.

<node pkg="multi_map_navigation" type="multi_map_navigation_manager.py" name="multi_map_navigation" output="screen">
  <param name="definition_file" value="$(find <navigation_stack>)/config/cfg.yaml" />
  <param name="transition_types" value="elevator_blast" />

  <param name="robot_namespace" value="$(arg modelName)"/>
  <param name="base_frame" value="base_link"/>
</node>

The definition_file refers to the configuration file (with wormholes etc.) created during setup. transition_types lists all the actionlib servers available for transition actions.

Rviz Control

As demonstrated in the video, we will be using Rviz as our main control hub for multi-map navigation. But first, you must setup namespace_mux to facilitate the process of switching between multiple robots. See the namespace_mux wiki for more details.

<!-- Setup RVIZ Mux: -->
<node name="namespace_mux" pkg="namespace_mux" type="namespace_mux" output="screen">

    <rosparam param="/namespace_mux/robot_namespace_ref">"robot"</rosparam>
    <rosparam param="/namespace_mux/rviz_namespace">"rviz"</rosparam>

    <rosparam param="/namespace_mux/active_bots">[
      "robot0", "robot1"
      ]</rosparam>

    <rosparam param="/namespace_mux/subscribed_topics">[
      "/map_store_map",
      "/odom", 
      "/laser/merged",
      "/laser/scan_back",
      "/laser/scan_front",
      "/move_base/local_costmap/obstacle_layer_footprint/footprint_stamped",
      "/move_base/TrajectoryPlannerROS/local_plan",
      "/move_base/local_costmap/costmap",
      "/move_base/TrajectoryPlannerROS/global_plan",
      "/wormhole_marker",
      "/waiting_area_marker",
      "/particlecloud"
      ]</rosparam>

    <rosparam param="/namespace_mux/published_topics">[
      "/cmd_vel",
      "/initialpose",
      "/move_base_simple/goal",
      "/clicked_point"
      ]</rosparam>

</node>

<!-- Setup Fake Map-Frame ID -->
<node name="fake_tf_broadcaster" pkg="namespace_mux" type="fake_tf_broadcaster" output="screen">

    <rosparam param="/fake_tf_broadcaster/pub_freq">50</rosparam>
    <rosparam param="/fake_tf_broadcaster/input_curr_frame_ids">["robot0/map", "robot1/map"]</rosparam>
    <rosparam param="/fake_tf_broadcaster/output_fake_frame_ids">["rviz/map"]</rosparam>
    <rosparam param="/fake_tf_broadcaster/output_tf_offset">[0.0, 0.0, 0.0, 0.0, 0.0, 0.0]</rosparam>    

</node>

Now you are ready to navigate across multiple maps:

$ roslaunch <navigation_stack> robots.launch
$ roslaunch <navigation_stack> move_base.launch
$ rosrun rviz rviz

Add the Navigator panel to your window. Follow the demo to learn how to manage flagged locations and set multi-map goals.

Note: The Navigator panel will crash if namespace_mux isn't properly setup.

Clone this wiki locally