Publishing tf from Gazebo camera to Rviz
Hello,
I am using the braccio_arm ( https://github.com/grassjelly/ros_bra... ) 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='libgazebo_ros_openni_kinect.so'>
<baseline>0.2</baseline>
<alwaysOn>true</alwaysOn>
<updateRate>0.0</updateRate>
<cameraName>camera_ir</cameraName>
<imageTopicName>/camera/depth/image_raw</imageTopicName>
<cameraInfoTopicName>/camera/depth/camera_info</cameraInfoTopicName>
<depthImageTopicName>/camera/depth/image_raw</depthImageTopicName>
<depthImageInfoTopicName>/camera/depth/camera_info</depthImageInfoTopicName>
<pointCloudTopicName>/camera/depth/points</pointCloudTopicName>
<frameName>camera_link</frameName>
<pointCloudCutoff>0.05</pointCloudCutoff>
<distortionK1>0</distortionK1>
<distortionK2>0</distortionK2>
<distortionK3>0</distortionK3>
<distortionT1>0</distortionT1>
<distortionT2>0</distortionT2>
<CxPrime>0</CxPrime>
<Cx>0</Cx>
<Cy>0</Cy>
<focalLength>0</focalLength>
<hackBaseline>0</hackBaseline>
</plugin>
</sensor>
My URDF links for the robot:
<robot xmlns:xacro="http://www.ros.org/wiki/xacro"
xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
name="braccio">
<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">
<inertial>
<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)}" />
</inertial>
</xacro:macro>
<xacro:macro name="transmission_block" params="joint_name idx">
<transmission name="tran_${idx}">
<type>transmission_interface/SimpleTransmission</type>
<joint name="${joint_name}">
<hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
</joint>
<actuator name="motor__${idx}">
<hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>
</xacro:macro>
<link name="base_footprint"/>
<joint name="base_footprint_joint" type="fixed">
<parent link="base_footprint"/>
<child link="base_link"/>
</joint>
<link name="base_link">
<visual>
<geometry>
<cylinder length="0.01" radius=".053" />
</geometry>
<material name="black"/>
<origin rpy="0 0 0" xyz="0 0 0"/>
</visual>
<inertial>
<mass value="2"/>
<inertia ixx="0.015" ixy="0" ixz="0" iyy="0.00666666666667" iyz="0" izz="0.0216666666667"/>
</inertial>
</link>
<link name="camera_link">
<xacro:inertial_matrix_cuboid mass="${kinect_box_mass}" box_length="${kinect_box_length}" box_width="${kinect_box_width}"/>
</link>
<joint name="camera_joint" type="fixed">
<origin xyz="0 0 1.1" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="camera_link"/>
</joint>
<link name="braccio_base_link">
<visual>
<geometry>
<mesh filename="package://braccio_arduino_ros_rviz/stl/braccio_base.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="orange"/>
<origin rpy="0 ...
I would suggest you to change your link
world
tobase_footprint
(just change the names) Gazebo is able to linkbase_footprint
toworld
(see #q208051). Also, your camera link needs theinertial
tag too.