Sensor messages not working properly in rviz for multiple turtlebots simulated in gazebo
I have spawned 2 turtlebots in gazebo. All the topics seem to be working fine. Even the move base seems to be working when given a goal to accomplish. If i check with a topic echo, all the concerned topics seem to be working fine. But I could not visualize all the topics in rviz. I have a feeling that this has something to do with the tf being broadcasted, as when i try to observe the laser scans and point clouds in rviz I get some errors like these.
Error For pointcloud in riviz Transform [sender=unknown_publisher] For frame [robot1/robot1/camera_depth_optical_frame]: Frame [robot1/robot1/camera_depth_optical_frame] does not exist
Error For laser scan: Transform [sender=unknown_publisher] For frame [camera_depth_frame]: Frame [camera_depth_frame] does not exist
The robot and the camera raw image appears perfect in rviz.
My Launch file for getting the robots in:
<launch>
<arg name="world_file" default="$(env TURTLEBOT_GAZEBO_WORLD_FILE)"/>
<arg name="base" value="$(optenv TURTLEBOT_BASE kobuki)"/> <!-- create, roomba -->
<arg name="battery" value="$(optenv TURTLEBOT_BATTERY /proc/acpi/battery/BAT0)"/> <!-- /proc/acpi/battery/BAT0 -->
<arg name="stacks" value="$(optenv TURTLEBOT_STACKS hexagons)"/> <!-- circles, hexagons -->
<arg name="3d_sensor" value="$(optenv TURTLEBOT_3D_SENSOR kinect)"/> <!-- kinect, asus_xtion_pro -->
<include file="/opt/ros/indigo/share/gazebo_ros/launch/empty_world.launch"> <!-- $(find gazebo_ros) -->
<arg name="use_sim_time" value="true"/>
<arg name="debug" value="false"/>
<arg name="world_name" value="$(arg world_file)"/>
</include>
<group ns="robot1">
<param name="tf_prefix" value="robot1"/>
<include file=".../launch/turtlebot.launch">
<arg name="robot_name" value="robot1"/>
<arg name="init_pose" value="-z 3 -x 3"/>
</include>
<node pkg="tf" type="static_transform_publisher" name="$(anon odom_map_broadcaster)" args="3 0 0 0 0 0 map robot1/odom 100"/>
</group>
<group ns="robot2">
<param name="tf_prefix" value="robot2"/>
<include file=".../turtlebot.launch">
<arg name="robot_name" value="robot2"/>
<arg name="init_pose" value="-z 3 -x -3"/>
</include>
<node pkg="tf" type="static_transform_publisher" name="$(anon odom_map_broadcaster)" args="-3 0 0 0 0 0 map robot2/odom 100"/>
</group>
</launch>
My navigation launch file
<launch>
<param name="/use_sim_time" value="true"/>
<!-- Map server -->
<arg name="map_file" default="$(env TURTLEBOT_GAZEBO_MAP_FILE)"/>
<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" />
<param name="amcl/initial_pose_x" value="3" />
<param name="amcl/initial_pose_y" value="1" />
<include file="..navigation/launch/amcl_0.1.launch" />
</group>
<group ns="robot2">
<param name="tf_prefix" value="robot2" />
<param name="amcl/initial_pose_x" value="-3" />
<param name="amcl/initial_pose_y" value="1" />
<include file="..navigation/launch/amcl_0.1.launch" />
</group>
</launch>
One more thing. The tf tree seems perfect. map is the root node with two branches robot1/odom & robot2/odom and then the rest of the transforms. No unconnected ones