[Turtlebot3] show multi-robot in one map RVIZ

asked 2018-10-23 23:38:57 -0500

BrusAngel gravatar image

updated 2018-11-08 07:39:20 -0500

Hello, I'm working with multiple turtlebot3 (physically), I can successfully bring up and teleop as many as I want (3 until now, theoretically N ) using the namespace configuration. However, after building a map using one of them, if I want to show them on the same map, I haven't been able to make it work in RVIZ.

Have spent a lot of time on this without being able to solve it, so that's the reason I come over here looking up for help. If I need to provide further information please let me know. Thanks.

UPDATE: I've fresh installed both robot and PC, just to avoid a configuration problem...

My launch files:

turtlebot3_remote.launch

<!-- Soli Deo Gloria -->
<launch>
  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
  <arg name="multi_robot_name" default=""/>

  <include file="$(find turtlebot3_bringup)/launch/includes/description.launch.xml">
    <arg name="model" value="$(arg model)" />
  </include>

  <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
    <param name="publish_frequency" type="double" value="50.0" />
    <param name="tf_prefix" value="$(arg multi_robot_name)"/>
  </node>

  <!-- AMCL -->
  <include file="$(find turtlebot3_navigation)/launch/amcl.launch">
    <arg name="scan_topic"      value="/scan"/>
    <arg name="odom_topic"      value="$(arg multi_robot_name)/odom"/>
    <arg name="base_topic"      value="$(arg multi_robot_name)/base_footprint"/>    
    <arg name="initial_pose_x"  value="-2.0"/>
    <arg name="initial_pose_y"  value=" 0.5"/>
    <arg name="initial_pose_z"  value=" 0.0"/>
  </include>
</launch>

Loaded with: $ ROS_NAMESPACE=tb3_0 roslaunch turtlebot3_bringup turtlebot3_remote.launch multi_robot_name:="tb3_0" (Now I'm loading each robot separately)

turtlebot3_navigation.launch

<!-- Soli Deo Gloria -->
<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"/>

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

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

Loaded with: $ roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map20181108.yaml

amcl.launch

<!-- Soli Deo Gloria -->
<launch>
  <!-- Arguments -->
  <arg name="scan_topic"     default="scan"/>
  <arg name="odom_topic"     default="odom"/>
  <arg name="base_topic"     default="base_footprint"/>
  <arg name="initial_pose_x" default="0.0"/>
  <arg name="initial_pose_y" default="0.0"/>
  <arg name="initial_pose_z" default="0.0"/>

  <!-- AMCL -->
  <node pkg="amcl" type="amcl" name="amcl">

    <param name="min_particles"             value="500"/>
    <param name="max_particles"             value="3000"/>
    <param name="kld_err"                   value="0.02"/>
    <param name="update_min_d"              value="0.20"/>
    <param name="update_min_a"              value="0.20"/>
    <param name="resample_interval"         value="1"/>
    <param name="transform_tolerance"       value="0.5"/>
    <param name="recovery_alpha_slow"       value="0.00"/>
    <param name="recovery_alpha_fast"       value="0.00"/>
    <param name="initial_pose_x"            value="$(arg initial_pose_x)"/>
    <param name="initial_pose_y"            value="$(arg initial_pose_y)"/>
    <param name="initial_pose_a"            value="$(arg initial_pose_z)"/>
    <param name="gui_publish_rate"          value="50.0"/>

    <remap from="scan"                      to="$(arg scan_topic)"/>
    <param name="laser_max_range"           value="3.5"/>
    <param name="laser_max_beams"           value="180"/>
    <param name="laser_z_hit"               value="0.5"/>
    <param name="laser_z_short"             value="0.05"/>
    <param name="laser_z_max"               value="0.05"/>
    <param name="laser_z_rand"              value="0.5"/>
    <param name="laser_sigma_hit"           value="0.2"/>
    <param name="laser_lambda_short"        value="0.1"/>
    <param name="laser_likelihood_max_dist" value="2.0 ...
(more)
edit retag flag offensive close merge delete

Comments

Can you detail what is the actual error here ? Is it roslaunch failing to launch all the nodes or is it just the result in rviz not expected ? That could help us a lot to help you. (And the rviz config isn't that relevant, a screenshot of rviz would do)

Delb gravatar image Delb  ( 2018-10-24 03:05:55 -0500 )edit

But with all your group tags it could only be a remapping issue (not the right topics subscribed to). There is also this in your AMCL nodes : <arg name="set_scan" value="$(arg ns_r0)/scan" />, since you are in the group $(arg ns_r0) then <arg name="set_scan" value="scan" /> should be enough

Delb gravatar image Delb  ( 2018-10-24 03:08:34 -0500 )edit

Thanks Delb, made the edit and the fixes to amcl nodes... still same problem.... can't find out why the map frame is not being published. The $ rostopic list shows it.

BrusAngel gravatar image BrusAngel  ( 2018-10-24 06:03:09 -0500 )edit

Thanks for the edit. Do you have only the /map topic or also /tb3_0/map and /tb3_1/map ? If you could also provide the tf_tree and the rostopic list that would be great.

Delb gravatar image Delb  ( 2018-10-24 07:23:55 -0500 )edit

No, I only have (or at least supposed to have) /map frame, if my understanding is correct I'd need /tb3_n/map if I would be working with more than one map at a time?. Added the tf_tree, rostopic list and also the roswtf output, btw... the latter output caught my attention for the last: WARNING

BrusAngel gravatar image BrusAngel  ( 2018-10-24 08:01:43 -0500 )edit

You have to connect map to /tb3_0/odom and also /tb3_1/odom to make things work. Can you check with $rosparam list if there is : /tb3_0/amcl/global_frame_id and then with rosparam get /tb3_0/amcl/global_frame_id if it returns map ? Same with tb3_1.

Delb gravatar image Delb  ( 2018-10-24 08:15:32 -0500 )edit

For the robot_state_publisher it's weird that roswtf says that the node died but in the tf_tree the tf are broadcasted by this node. That might comes from how you launch turtlebot3_remote.launch.

Delb gravatar image Delb  ( 2018-10-24 08:20:12 -0500 )edit

Since the param multi_robot_name already set tf_prefix I would put the whole <include file="$(find turtlebot3_bringup)/launch/turtlebot3_remote.launch"> outside the <group ns = "$(arg ns_r1)"> (same for tb3_0)

Delb gravatar image Delb  ( 2018-10-24 08:22:18 -0500 )edit