Can not visualize Gazibo depth camera pointcloud output in rviz

asked 2017-08-17 10:26:21 -0500

YJK gravatar image

I connected a kinect(Depth) camera to Labro example in Gazibo simulation environment. Output of the depth image and camera image can be visualize via rqt_gui, however when I try to visualize PointCloud, Depth camera output through rviz it gives following error.

Transform [sender=unknown_publisher]
For frame [kinect_depth_optical_frame]: Frame [kinect_depth_optical_frame] does not exist

I'm trying to get PointCloud data from depth camera and feed it to Octomap Server, then to generate a 3D map.

Following is the modified Labrob code. <robot name="labrob" xmlns:xacro="http://www.ros.org/wiki/xacro">

  <!-- Included URDF/XACRO Files -->
  <xacro:include filename="$(find labrob_description)/urdf/materials.urdf.xacro" />
  <xacro:include filename="$(find labrob_description)/urdf/wheel.urdf.xacro" />
  <xacro:include filename="$(find labrob_description)/urdf/kinect_camera.urdf.xacro" />

  <!-- PROPERTY LIST -->
  <!--All units in m-kg-s-radians unit system -->
  <property name="M_PI" value="3.1415926535897931" />

  <!-- Main Body-base -->
  <property name="base_x_size" value="1.0" /> 
  <property name="base_y_size" value="0.5" /> 
  <property name="base_z_size" value="0.25" />
  <property name="base_mass" value="35" /> <!-- in kg-->

  <!--Camera-->
  <property name="camera_link" value="0.05" /> <!-- Size of square 'camera' box -->

  <!--Inertial macros for the box and cylinder. Units are kg*m^2-->
  <macro name="box_inertia" params="m x y z">
    <inertia  ixx="${m*(y*y+z*z)/12}" ixy = "0" ixz = "0"
              iyy="${m*(x*x+z*z)/12}" iyz = "0"
              izz="${m*(x*x+z*z)/12}" /> 
  </macro>

  <!-- BASE-FOOTPRINT -->
  <!-- base_footprint is a fictitious link(frame) that is on the ground right below base_link origin -->
  <link name="base_footprint">
    <inertial>
      <mass value="0.0001" />
      <origin xyz="0 0 0" />
      <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
          iyy="0.0001" iyz="0.0" 
          izz="0.0001" />
    </inertial>
    <visual>
        <origin xyz="0 0 0" rpy="0 0 0" />
        <geometry>
            <box size="0.001 0.001 0.001" />
        </geometry>
    </visual>
  </link>

  <gazebo reference="base_footprint">
    <turnGravityOff>false</turnGravityOff>
  </gazebo>

  <joint name="base_footprint_joint" type="fixed">
  <origin xyz="0 0 ${wheel_radius - base_z_origin_to_wheel_origin}" rpy="0 0 0" />
    <parent link="base_footprint"/>
    <child link="base_link" />
  </joint>

  <!-- BASE-LINK -->
  <!--Actual body/chassis of the robot-->
  <link name="base_link">
    <inertial>
      <mass value="${base_mass}" />
      <origin xyz="0 0 0" />
      <!--The 3x3 rotational inertia matrix. -->
      <box_inertia  m="${base_mass}" x="${base_x_size}" y="${base_y_size}" z="${base_z_size}"/> 
    </inertial>    
    <visual>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <box size="1 0.5 0.25"/>
      </geometry>
      <material name="Yellow" />
    </visual>  
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0 " />
      <geometry>
        <box size="1 0.5 0.25"/>
      </geometry>
    </collision>     
  </link>
  <gazebo reference="base_link">
    <material>Gazebo/Yellow</material>
    <turnGravityOff>false</turnGravityOff>
  </gazebo>

  <!-- WHEELs -->
  <wheel fb="front" lr="right" parent="base_link" translateX="1" translateY="-1" flipY="-1"/>
  <wheel fb="front" lr="left" parent="base_link" translateX="1" translateY="1" flipY="-1"/>
  <wheel fb="back" lr="right" parent="base_link" translateX="-1" translateY="-1" flipY="-1"/>
  <wheel fb="back" lr="left" parent="base_link" translateX="-1" translateY="1" flipY="-1"/>

  <gazebo>
    <plugin name="skid_steer_drive_controller" filename="libgazebo_ros_skid_steer_drive.so">
      <alwaysOn>true</alwaysOn>
      <updateRate>100.0</updateRate>
      <leftFrontJoint>front_left_wheel_joint</leftFrontJoint>
      <rightFrontJoint>front_right_wheel_joint</rightFrontJoint>
      <leftRearJoint>back_left_wheel_joint</leftRearJoint>
      <rightRearJoint>back_right_wheel_joint</rightRearJoint>
      <wheelSeparation>${base_y_size}</wheelSeparation>
      <wheelDiameter>${2*wheel_radius}</wheelDiameter ...
(more)
edit retag flag offensive close merge delete