The color of gazebo_ros_openni_kinect's pointcloud2 is different with the image

asked 2019-10-15 02:23:41 -0600

TouchDeeper gravatar image

Hello,

I have a Kinect gazebo model.

kinect_gazeob.xml

<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- |    This document was autogenerated by xacro from kinect_gazebo.xacro            | -->
<!-- |    EDITING THIS FILE BY HAND IS NOT RECOMMENDED                                 | -->
<!-- =================================================================================== -->
<robot name="kinect_camera" xmlns:xacro="http://ros.org/wiki/xacro">
  <!-- Create kinect reference frame -->
  <!-- Add mesh for kinect -->
  <link name="kinect_link">
    <!--            <origin xyz="0 0 0" rpy="0 0 0"/>-->
    <inertial>
      <origin rpy="0.0 -0.0 0.0" xyz="0 0 0 "/>
      <mass value="0.1"/>
      <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/>
    </inertial>
    <visual>
      <origin rpy="0 0 1.5707963" xyz="0 0 0"/>
      <geometry>
        <mesh filename="package://object_description/meshes/kinect/kinect.dae"/>
      </geometry>
    </visual>
    <collision>
      <geometry>
        <box size="0.07 0.3 0.09"/>
      </geometry>
    </collision>
  </link>
  <joint name="kinect_optical_joint" type="fixed">
    <origin rpy="-1.5708 0 -1.5708" xyz="0 0 0"/>
    <parent link="kinect_link"/>
    <child link="kinect_frame_optical"/>
  </joint>
  <link name="kinect_frame_optical"/>
  <gazebo >
    <static>true</static>
  </gazebo>
  <gazebo reference="kinect_link">
    <sensor name="kinect" type="depth">
      <always_on>true</always_on>
      <update_rate>20.0</update_rate>
      <camera>
        <horizontal_fov>1.04719753333</horizontal_fov>
        <image>
          <format>R8G8B8</format>
          <width>640</width>
          <height>480</height>
        </image>
        <clip>
          <near>0.05</near>
          <far>8.0</far>
        </clip>
      </camera>
      <plugin filename="libgazebo_ros_openni_kinect.so" name="kinect_kinect_controller">
        <cameraName>kinect</cameraName>
        <alwaysOn>true</alwaysOn>
        <updateRate>10</updateRate>
        <imageTopicName>rgb/image_raw</imageTopicName>
        <depthImageTopicName>depth/image_raw</depthImageTopicName>
        <pointCloudTopicName>depth/points</pointCloudTopicName>
        <cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName>
        <depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName>
        <frameName>kinect_frame_optical</frameName>
        <baseline>0.1</baseline>
        <distortion_k1>0.0</distortion_k1>
        <distortion_k2>0.0</distortion_k2>
        <distortion_k3>0.0</distortion_k3>
        <distortion_t1>0.0</distortion_t1>
        <distortion_t2>0.0</distortion_t2>
        <pointCloudCutoff>0.4</pointCloudCutoff>
      </plugin>
    </sensor>
  </gazebo>
</robot>

I load kinect in gazebo by

rosrun gazebo_ros spawn_model -file `rospack find object_description`/urdf/sensor/kinect_gazebo.xml -urdf -x 0 -y -1 -z 0.8 -R 0 -P 0.5 -Y 1.57 -model kinect

The result I see in rviz is as the image below shows: image description

As you can see, the color of PointCloud2 is different with the image. Coud you please give me some advice? Thanks a lot.

edit retag flag offensive close merge delete