Ask Your Question
0

Why I can subscribe /map

asked 2018-08-16 23:30:21 -0600

Pujie gravatar image

updated 2018-08-17 00:55:43 -0600

I tried to launch multiple turtlebot3 navigation. But when I launch the file, I find I didn't subscribe to the /map. I don't know why.

image description

Here is my launch file.

<launch>
    <param name="/use_sim_time" value="true"/>
    <arg name="map_file" default="$(find turtlebot3_navigation)/maps/map.yaml"/>
    <arg name="open_rviz" default="true"/>


    <!-- Run the map server -->
    <node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" >
        <param name="frame_id" value="/map" />
    </node>

    <group ns="robot1">
        <param name="tf_prefix" value="robot1_tf" />
        <param name="amcl/initial_pose_x" value="1" />
        <param name="amcl/initial_pose_y" value="1" />
        <include file="$(find turtlebot3_navigation)/launch/new_move_base.launch" />
    </group>

    <group ns="robot2">
        <param name="tf_prefix" value="robot2_tf" />
        <param name="amcl/initial_pose_x" value="-1" />
        <param name="amcl/initial_pose_y" value="1" />
        <include file="$(find turtlebot3_navigation)/launch/new_move_base.launch" />
    </group>

    <!--node pkg="rviz" type="rviz" name="rviz" args="-d $(find your_pkg)/config/multi.vcg"
          output="screen" -->
    <node pkg="rviz" type="rviz" name="rviz" required="true"
          args="-d $(find turtlebot3_navigation)/rviz/turtlebot3_navigation.rviz"/>
</launch>

new_move_base.launch

<launch>
    <!--- Run AMCL -->
    <include file="$(find turtlebot3_navigation)/launch/amcl.launch" />

    <!-- Define your move_base node -->
    <node pkg="move_base" type="move_base" respawn="false" name="new_move_base" output="screen">
        <param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" />
        <rosparam file="$(find turtlebot3_navigation)/param/costmap_common_params_burger.yaml" command="load" ns="global_costmap" />
        <rosparam file="$(find turtlebot3_navigation)/param/costmap_common_params_burger.yaml" command="load" ns="local_costmap" />
        <rosparam file="$(find turtlebot3_navigation)/param/local_costmap_params.yaml" command="load" />
        <rosparam file="$(find turtlebot3_navigation)/param/global_costmap_params.yaml" command="load" />
        <rosparam file="$(find turtlebot3_navigation)/param/move_base_params.yaml" command="load" />
        <rosparam file="$(find turtlebot3_navigation)/param/dwa_local_planner_params_burger.yaml" command="load" />

        <remap from="map" to="/map" />
    </node>
</launch>

I think maybe I made mistakes in <remap from="map" to="/map"/>. I don't know why I can't subscribe to /map.

Btw, I add the 1 turtlebot3 launch file below.

<launch>
  <!-- Arguments -->
  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
  <arg name="map_file" default="$(find turtlebot3_navigation)/maps/map.yaml"/>
  <arg name="open_rviz" default="true"/>

  <!-- Turtlebot3 -->
  <include file="$(find turtlebot3_bringup)/launch/turtlebot3_remote.launch">
    <arg name="model" value="$(arg model)" />
  </include>

  <!-- Map server -->
  <node pkg="map_server" name="map_server" type="map_server" args="$(arg map_file)"/>

  <!-- AMCL -->
  <include file="$(find turtlebot3_navigation)/launch/amcl.launch"/>

  <!-- move_base -->
  <include file="$(find turtlebot3_navigation)/launch/move_base.launch">
    <arg name="model" value="$(arg model)" />
  </include>

  <!-- rviz -->
  <group if="$(arg open_rviz)"> 
    <node pkg="rviz" type="rviz" name="rviz" required="true"
          args="-d $(find turtlebot3_navigation)/rviz/turtlebot3_navigation.rviz"/>
  </group>

move_base.launch

<launch>
  <!-- Arguments -->
  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
  <arg name="cmd_vel_topic" default="/cmd_vel" />
  <arg name="odom_topic" default="odom" />

  <!-- move_base -->
  <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
    <param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" />
    <rosparam file="$(find turtlebot3_navigation)/param/costmap_common_params_$(arg model).yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find turtlebot3_navigation)/param/costmap_common_params_$(arg model).yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find turtlebot3_navigation)/param/local_costmap_params.yaml" command="load" />
    <rosparam file="$(find turtlebot3_navigation)/param/global_costmap_params.yaml" command="load" />
    <rosparam file="$(find turtlebot3_navigation)/param/move_base_params.yaml" command="load" />
    <rosparam file="$(find turtlebot3_navigation)/param/dwa_local_planner_params_$(arg model).yaml" command="load" />
    <remap ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-08-17 00:11:52 -0600

ahendrix gravatar image

If you unclick the Hide buttons for "Dead Sinks" and "Leaf Topics" in rqt_graph, you'll probably see that amcl and move_base are subscribing to /robot1/map and /robot2/map topics on their respective robots. You probably need to remap the map topics for both nodes to the /map topic.

edit flag offensive delete link more

Comments

Thank you very much! I tried to do so, but I really don't find the /robot2/map, /robot1/map. I recompile my question.Could you please have a look?

Pujie gravatar imagePujie ( 2018-08-17 00:55:38 -0600 )edit

Ah; I'd forgotten that by default, AMCL (and probably move_base) retrieves the map through the static_map service according to the wiki page: http://wiki.ros.org/amcl .

ahendrix gravatar imageahendrix ( 2018-08-18 13:54:42 -0600 )edit

Got it. Thank you!

Pujie gravatar imagePujie ( 2018-08-20 17:42:45 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-08-16 23:30:21 -0600

Seen: 252 times

Last updated: Aug 17 '18