[Turtlebot3] show multi-robot in one map RVIZ

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

BrusAngel gravatar image

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

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 -0600 )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 -0600 )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 -0600 )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 -0600 )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 -0600 )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 -0600 )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 -0600 )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 -0600 )edit

no global_frame_id, only: base_frame_id, gui_publish_rate, initial_pose_a x & y, odom_alpha1~4, odom_frame_id, odom_model_type, transform_tolerance. and others that belong to amcl algorithm only. The ouput of rosparam get .../base_frame_id yields: base_footprint.

BrusAngel gravatar image BrusAngel  ( 2018-10-24 08:22:49 -0600 )edit

Can you show in your question the full output of rosparam list please ? That's odd because you should definetly have params like /tb3_0/amcl/base_frame_id and /tb3_1/amcl/base_frame_id because of your groups.

Delb gravatar image Delb  ( 2018-10-24 08:33:02 -0600 )edit

I do have the /tb3_n/amcl/base_frame_id, that outputs: base_footprint, but you said: /tb3_n/amcl/global_frame_id... (added the $ rosparam list output)

BrusAngel gravatar image BrusAngel  ( 2018-10-24 08:35:45 -0600 )edit

if I put the whole <include file="$(find turtlebot3_bringup)/launch/turtlebot3_remote.launch"> outside the <group ns="$(arg ns_r0)">, when launching shows: roslaunch file contains multiple nodes named [/robot_state_publisher]. Please check all <node> 'name' attributes to make sure they are uni

BrusAngel gravatar image BrusAngel  ( 2018-10-24 08:44:36 -0600 )edit

Alright leave it as before then. In your amcl launch file you need to add <param name="global_frame_id" value="/map"/> to set the connection with map.

Delb gravatar image Delb  ( 2018-10-24 09:00:39 -0600 )edit

isn't working yet, please check, I've updated the outputs for rviz, tf tree, rostopic list, roswtf and also updated the launch files. any ideas? thanks for the help, really appreciate it

BrusAngel gravatar image BrusAngel  ( 2018-10-24 10:25:13 -0600 )edit

There is still things missing : in your amcl.launch add this too <param name="use_map_topic" value="true/>. Also I think there is an issue with the robot model, do you see the two turtlebot correctly if you set the fix frame to /tb3_0/base_link ?

Delb gravatar image Delb  ( 2018-10-24 12:29:30 -0600 )edit

updated the outputs, yes, it does show the robot, but now $ roswtf shows and error. will it be due to the base_scan not grabbing the name_space conf?

BrusAngel gravatar image BrusAngel  ( 2018-10-25 03:01:16 -0600 )edit

Where does the core comes from ? How do you launch this ? It seems you launch it with another launch file which isn't in the same namespace. Have you seen this tutorial ? Section 16.5 shows how to correclty launch your robots.

Delb gravatar image Delb  ( 2018-10-25 03:21:57 -0600 )edit

I was missing the set_lidar_frame_id:="tb3_1/base_scan" for the launch file at the robot side, but still getting the same error out of $ roswtf, added the turtlebot3_robot.launch

BrusAngel gravatar image BrusAngel  ( 2018-10-25 04:05:54 -0600 )edit

Instead of calling the other launch files separatly add this in the group tags:

<include file="$(find turtlebot3_bringup)/launch/turtlebot3_robot.launch">
   <arg name="model" value="$(arg model)" />
   <arg name="multi_robot_name" value="$(arg ns_r0)" />

</include>
Delb gravatar image Delb  ( 2018-10-25 04:15:48 -0600 )edit

I've updated the files, without success yet, this error got my mind:

ERROR TF multiple authority contention:
     * node [/tb3_0/turtlebot3_core] publishing transform [base_footprint] with parent [odom] already published by node [/tb3_1/turtlebot3_core]

I'm diving into the source file now

BrusAngel gravatar image BrusAngel  ( 2018-10-26 08:26:41 -0600 )edit

thanks for your help, really appreciate, please don't get rid of me yet! haha

BrusAngel gravatar image BrusAngel  ( 2018-10-26 08:27:40 -0600 )edit