ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

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

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

TouchDeeper gravatar image


I have a Kinect gazebo model.


<?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="">
  <!-- Create kinect reference frame -->
  <!-- Add mesh for kinect -->
  <link name="kinect_link">
    <!--            <origin xyz="0 0 0" rpy="0 0 0"/>-->
      <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"/>
      <origin rpy="0 0 1.5707963" xyz="0 0 0"/>
        <mesh filename="package://object_description/meshes/kinect/kinect.dae"/>
        <box size="0.07 0.3 0.09"/>
  <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"/>
  <link name="kinect_frame_optical"/>
  <gazebo >
  <gazebo reference="kinect_link">
    <sensor name="kinect" type="depth">
      <plugin filename="" name="kinect_kinect_controller">

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

1 Answer

Sort by » oldest newest most voted

answered 2020-02-05 13:20:09 -0500


I believe the problem is related to the color format: try changing the value within the <format> element (inside <image>) to B8G8R8.

In your image, it seems that the red and blue channels are switched. I'm also using libgazebo_ros_openni_kinect and if I put the format as you currently have, I end up with the same problem. With B8G8R8, it works fine.

edit flag offensive delete link more

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: 2019-10-15 02:23:41 -0500

Seen: 564 times

Last updated: Oct 15 '19