Ask Your Question
0

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:

<launch>

<node name="gazebo" pkg="gazebo" type="debug" args="-u $(find turtlebot_gazebo)/worlds/empty.world" 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!

-Alan

UPDATE

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

/camera/camera_info

/camera/depth/points

/camera/image_raw

/camera/image_raw/compressed

/camera/image_raw/compressed/parameter_descriptions

/camera/image_raw/compressed/parameter_updates

/camera/image_raw/compressedDepth

/camera/image_raw/compressedDepth/parameter_descriptions

/camera/image_raw/compressedDepth/parameter_updates

/camera/image_raw/theora

/camera/image_raw/theora/parameter_descriptions

/camera/image_raw/theora/parameter_updates

/clock

/diagnostics

/diagnostics_agg

/diagnostics_toplevel_state

/gazebo/link_states

/gazebo/model_states

/gazebo/parameter_descriptions

/gazebo/parameter_updates

/gazebo/set_link_state

/gazebo/set_model_state

/robot1/depth/camera_info

/robot1/depth/image_raw

/robot1/imu/data

/robot1/initialpose

/robot1/joint_states

/robot1/move_base_simple/goal

/robot1/odom

/robot1/robot_pose_ekf/odom

/robot1/scan

/robot1/set_hfov

/robot1/set_update_rate

/robot1/turtlebot_node/cmd_vel

/robot1/turtlebot_node/joint_states

/robot1/turtlebot_node/odom

/robot1/turtlebot_node/sensor_state

/robot2/depth/camera_info

/robot2/depth/image_raw

/robot2/imu/data

/robot2/joint_states

/robot2/odom

/robot2/robot_pose_ekf/odom

/robot2/scan

/robot2/set_hfov

/robot2/set_update_rate

/robot2/turtlebot_node/cmd_vel

/robot2/turtlebot_node/joint_states

/robot2/turtlebot_node/odom

/robot2/turtlebot_node/sensor_state

/rosout

/rosout_agg

/tf

As you ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

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

prasanna.kumar gravatar image

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

Hi,

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:

   <launch>
  <!-- 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/angen_empty.world" respawn="false" output="screen"/>
  <node name="gazebo_gui" pkg="gazebo" type="gui" />

<param name="robot_description"
    command="$(find xacro)/xacro.py $(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" />
</include>
  </group>

  <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" />
</include>
  </group>

</launch>

fuerte_final_r1.launch:

<launch>

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

  <param name="robot_description" command="$(find xacro)/xacro.py '$(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>

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


  <!-- 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"/>-->
  </node>


  <!-- 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"/>
  </node>

  <!-- 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"/>
  </node>

  <!-- 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 ...
(more)
edit flag offensive delete link more

Comments

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 imageajhamlet ( 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

Stats

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

Seen: 1,290 times

Last updated: May 22 '13