Ask Your Question

Publishing tf from Gazebo camera to Rviz

asked 2018-03-12 02:31:39 -0600

dpakshimpo gravatar image

updated 2018-03-21 08:16:06 -0600


I am using the braccio_arm ( ) and trying to learn and simulate pick and place. I am able to launch the arm independently and work with it. Now, I created a world in Gazebo and would like to publish the PCL data from gazebo to Rviz and then plan to use pick and place. I face 2 issues, 1. I am unable to transform data from camera_link in Gazebo to base_link of robot. Kindly help. I followed the tutorial here and was added camera_link on my gazebo fie and URDF file.

Gazebo world has a kinect at 1.1 m in z and a table with 3 shapes on it. The kinect plugin code:

  <plugin name='camera_link_plugin' filename=''>

My URDF links for the robot:

<robot xmlns:xacro="" 

  <xacro:property name="camera_link" value="0.05" /> <!-- Size of square 'camera' box -->
  <xacro:property name="damping_value" value="241.35"/>
  <xacro:property name="friction_value" value="24.135"/>

<xacro:property name="kinect_box_length" value="0.3556" />
<xacro:property name="kinect_box_width" value="0.1778" />
<xacro:property name="kinect_box_height" value="0.0762" />
<xacro:property name="kinect_box_mass" value="1.274595" />

<xacro:macro name="inertial_matrix_cuboid" params="mass box_length box_width">
                       <mass value="${mass}" />
                       <inertia ixx="${mass/12*(box_length*box_length)}" 
                                ixy = "0" ixz = "0"
                                iyy="${mass/12*(box_width*box_width)}" iyz = "0"
                                izz="${mass/12*(box_length*box_length + box_width*box_width)}" />

<xacro:macro name="transmission_block" params="joint_name idx">
      <transmission name="tran_${idx}">
        <joint name="${joint_name}">
        <actuator name="motor__${idx}">

<link name="base_footprint"/>

<joint name="base_footprint_joint" type="fixed">
    <parent link="base_footprint"/>
    <child link="base_link"/>

    <link name="base_link">
    <cylinder length="0.01" radius=".053" />
      <material name="black"/>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <mass value="2"/>
    <inertia ixx="0.015" ixy="0" ixz="0" iyy="0.00666666666667" iyz="0" izz="0.0216666666667"/>

    <link name="camera_link"> 
    <xacro:inertial_matrix_cuboid mass="${kinect_box_mass}" box_length="${kinect_box_length}" box_width="${kinect_box_width}"/>

  <joint name="camera_joint" type="fixed">
    <origin xyz="0 0 1.1" rpy="0 0 0"/> 
    <parent link="base_link"/>
    <child link="camera_link"/>

  <link name="braccio_base_link">
        <mesh filename="package://braccio_arduino_ros_rviz/stl/braccio_base.stl" scale="0.001 0.001 0.001"/>
      <material name="orange"/>
      <origin rpy="0 ...
edit retag flag offensive close merge delete



I would suggest you to change your link world to base_footprint (just change the names) Gazebo is able to link base_footprint to world(see #q208051). Also, your camera link needs the inertial tag too.

Delb gravatar image Delb  ( 2018-03-15 03:56:18 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-12 03:13:53 -0600

Delb gravatar image

updated 2018-03-12 03:14:53 -0600

gvdhoorn gravatar image

Look at #q283961, you missed the inertial tag which is required by Gazebo.

For your PCL data, have you tried rotating your box in the urdf ?

edit flag offensive delete link more


Thanks for you input Delib, unfortunately, it did not work too.

dpakshimpo gravatar image dpakshimpo  ( 2018-03-12 05:40:50 -0600 )edit

How do I get to 5 points, so that I can upload images?

dpakshimpo gravatar image dpakshimpo  ( 2018-03-12 05:45:45 -0600 )edit

Can you edit your question to show the modifications ? Also I noticed you defined the same origin in the joint tag and link tag which means you won't have your box at the same position as the tf which could be an issue (put origin of link and collision tag to 0 0 0

Delb gravatar image Delb  ( 2018-03-13 06:15:17 -0600 )edit

Hello Delb,

I have modified the URDF/XACRO file to remove the camera link visual element and tired to visualise the PCL data in Rviz, as reported earlier. I tried to write a node to transform the data from camera_link to world, that also did not help.

dpakshimpo gravatar image dpakshimpo  ( 2018-03-15 03:17:37 -0600 )edit

For some reason my comment to the other answer is missing, i updated the xacro file with the inertial tag for camera link (this is based on the actual dimensions of Kinect) the issue is not resolved. My Gazebo has a kinect spawned at same height as mentioned in URDF and that has the plugin code

dpakshimpo gravatar image dpakshimpo  ( 2018-03-16 00:54:23 -0600 )edit

Can you add your launch file too please ? The urdf seems fine though. Do you have this line somewhere ? xmlns:sensor=""

Delb gravatar image Delb  ( 2018-03-16 03:19:49 -0600 )edit

Hello Delb, Thanks for your time again. Edited the qn with launch files for Gazebo and Rviz. I added the above xml tag to my XACRO now.

dpakshimpo gravatar image dpakshimpo  ( 2018-03-18 22:36:04 -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: 2018-03-12 02:31:39 -0600

Seen: 1,079 times

Last updated: Mar 21 '18