[Turtlebot3] show multi-robot in one map RVIZ
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 ...
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)
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 enoughThanks 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.
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 thetf_tree
and therostopic list
that would be great.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
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 withrosparam get /tb3_0/amcl/global_frame_id
if it returnsmap
? Same withtb3_1
.For the
robot_state_publisher
it's weird thatroswtf
says that the node died but in the tf_tree thetf
are broadcasted by this node. That might comes from how you launchturtlebot3_remote.launch
.Since the param
multi_robot_name
already settf_prefix
I would put the whole<include file="$(find turtlebot3_bringup)/launch/turtlebot3_remote.launch">
outside the<group ns = "$(arg ns_r1)">
(same fortb3_0
)