Ask Your Question

Visualizing Kinect data from two Turtlebots in Gazebo

asked 2013-05-21 13:10:59 -0600

ajhamlet gravatar image

updated 2016-10-24 08:35:02 -0600

ngrennan gravatar image

Hello everyone.

I am trying to run two Turtlebots in Gazebo and have one observe the other. I encountered the common error of one of the turtlebots only showing up as wheels, but by using a hack I am able to see both Turtlebots fully by closing the Gazebo GUI and reopening it again with rosrun gazebo gui.

The problem arises when I try to have one robot observe the other using its kinect and RVIZ. I can see the topics /camera/image_raw and /camera/depth/points (no namespace) from the turtlebot that originally fully appeared in gazebo. The other robot, though, appears only as wheels in RVIZ even though it is fully visible in Gazebo!

I figure there is two ways of solving this. 1) Actually remedying the problem of one of the Turtlebots not fully appearing originally in Gazebo instead of using the hack(which I have no idea how to do) 2) Observe the Turtlebot that fully appears from the others Kinect. There are topics /robot1/depth/image_raw and /robot1/depth/camera_info being published (and similarly for robot2) but when I set the topic to /robot1/depth/image_raw RVIZ looks for camerainfo on /robot2/depth/camera_info and vice versa and says no camerainfo received. I get just an image of a horizontal white line.

These probably coincide but I am hoping some of you know better than me. I am using the following launch file to launch the Gazebo world with the 2 turtlebots in it simultaneously:


<node name="gazebo" pkg="gazebo" type="debug" args="-u $(find turtlebot_gazebo)/worlds/" respawn="false" output="screen"/> <node name="gazebo_gui" pkg="gazebo" type="gui"/>

<include file="$(find turtlebot_gazebo)/launch/robot1.launch"/> <include file="$(find turtlebot_gazebo)/launch/robot2.launch"/> </launch>

Where robot1 and robot2.launch are identical files except for the robots and nodes use different namespaces so that I can control the robots separately, and I have successfully written a teleop node to allow me to do this.

So how can I have one Turtlebot observe the other (not just its wheels)? Any ideas would be appreciated.

Thanks for your help!



So here is the list of topics being published or subscribed:






















































As you ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-21 13:56:37 -0600

prasanna.kumar gravatar image

updated 2013-05-21 13:58:22 -0600


The problem you have with respect to rviz is due to malformed tf. When you are using multiple robots, you need to resolve the tf data for each of the robots by adding a "tf_prefix". By doing so all the links of the robot have unique names like robot1_tf/base_link, robot2_tf/odom etc and tf trees can be constructed for both robots and rviz can display both the robots.

To resolve the sensor data of the robots you have to provide a namespace for each robot. In the below shown case the scan topic become /robot1/scan and /robot1/camera/image_raw etc and the rviz is able to display the scan data of both the robots.

I use the following launch file:

  <!-- start gazebo with an empty plane -->
  <param name="/use_sim_time" value="true" />

  <node launch-prefix="optirun" name="gazebo" pkg="gazebo" type="gazebo" args="$(find angen_gazebo)/worlds/" respawn="false" output="screen"/>
  <node name="gazebo_gui" pkg="gazebo" type="gui" />

<param name="robot_description"
    command="$(find xacro)/ $(find turtlebot_description)/urdf/turtlebot.urdf.xacro" />

  <group ns="robot1">
    <param name="tf_prefix" value="robot1" />
    <include file="$(find angen_turtlebot)/launch/fuerte_final_r1.launch" >
      <arg name="init_pose" value="-x 9 -y 5 -z 0.05" />
      <arg name="robot_name"  value="Robot1" />

  <group ns="robot2">
    <param name="tf_prefix" value="robot2" />
    <include file="$(find angen_turtlebot)/launch/fuerte_final_r1.launch" >
      <arg name="init_pose" value="-x 9 -y 4 -z 0.05" />
      <arg name="robot_name"  value="Robot2" />




    <arg name="init_pose"/>
    <arg name="robot_name"/>

  <param name="robot_description" command="$(find xacro)/ '$(find turtlebot_description)/urdf/turtlebot.urdf.xacro'" />

  <node name="spawn_turtlebot_model" pkg="gazebo" type="spawn_model" args="$(arg init_pose) -unpause -urdf -param /robot_description -model $(arg robot_name) -robotNamespace $(arg robot_name)" respawn="false" output="screen"/>

  <node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" >
    <rosparam command="load" file="$(find turtlebot_bringup)/config/diagnostics.yaml" />

  <node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher" output="screen">
    <param name="publish_frequency" type="double" value="30.0" />

  <!-- The odometry estimator -->

  <node pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf">
    <param name="freq" value="30.0"/>
    <param name="sensor_timeout" value="1.0"/>
    <param name="publish_tf" value="true"/>
    <param name="odom_used" value="true"/>
    <param name="imu_used" value="false"/>
    <param name="vo_used" value="false"/>
    <!--<param name="output_frame" value="odom"/>-->

  <!-- throttling -->
  <node pkg="nodelet" type="nodelet" name="pointcloud_throttle" args="load pointcloud_to_laserscan/CloudThrottle openni_manager" respawn="true">
    <param name="max_rate" value="20.0"/>
    <remap from="cloud_in" to="/camera/depth/points"/>
    <remap from="cloud_out" to="cloud_throttled"/>

  <!-- Fake Laser -->
  <node pkg="nodelet" type="nodelet" name="kinect_laser" args="load pointcloud_to_laserscan/CloudToScan openni_manager" respawn="true">
    <param name="output_frame_id" value="/camera_depth_frame"/>
    <!-- heights are in the (optical?) frame of the kinect -->
    <param name="min_height" value="-0.15"/>
    <param name="max_height" value="0.15"/>
    <remap from="cloud" to="/cloud_throttled"/>

  <!-- Fake Laser (narrow one, for localization -->
  <node pkg="nodelet" type="nodelet" name="kinect_laser_narrow" args="load pointcloud_to_laserscan/CloudToScan openni_manager" respawn="true">
    <param name="output_frame_id" value="/camera_depth_frame"/>
    <!-- heights are in the (optical?) frame of the kinect -->
    <param name="min_height" value="-0.025"/>
    <param name="max_height" value="0.025 ...
edit flag offensive delete link more


Thank you for your response. I think I have already mostly figured out the namespace/tf_prefix issue (actually, using an answer to a question you previously asked). Please see the update to my question for more info on the issue I am having.

ajhamlet gravatar image ajhamlet  ( 2013-05-22 11:35:06 -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


Asked: 2013-05-21 13:10:59 -0600

Seen: 1,369 times

Last updated: May 22 '13