Gazebo and Rviz ROS depth camera wrong rotation [closed]

asked 2020-10-15 09:11:18 -0500

Dookei gravatar image

updated 2020-10-15 09:12:53 -0500

Hi , I am currently facing an issue that seems to be recurrent to other people but I still didn't manage to find an answer. In Gazebo I have the following camera( I have 6 of them actually, they all have the same porblem) that uses a frame from ROS. The image is displayed correctly( I checked by moving some objects in front) but with Z front as reference and not X as it should.

I also checked this other post but somehow this is not working in my case. gazebo camera frame is inconsistent with rviz + opencv convention

So here is my output: https://postimg.cc/S2CR0qLc

and here is my sdf / Gazebo camera definition

<!-- FRONT CAMERA    0.420767 0.0
0.227750    -->
    <model name="front_camera">
      <pose>0.420767 0.0 0.227750  0.0 0.0 0.0</pose>
      <link name="link">
        <inertial>
          <pose>0.01 0.025 0.025 0 0 0</pose>
          <mass>0.01</mass>
          <inertia>
            <ixx>4.15e-6</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>2.407e-6</iyy>
            <iyz>0</iyz>
            <izz>2.407e-6</izz>
          </inertia>
        </inertial>
        <visual name="visual">
          <pose>0.0 0.0 0.0  0.0 0.0 0.0</pose>
          <geometry>
            <mesh>
              <uri>model://pro_depth_cameras/meshes/D435_v3.stl</uri>
            </mesh>
          </geometry>
          <material>
          <script>
            <name>Gazebo/DarkGrey</name>
            <uri>file://media/materials/scripts/gazebo.material</uri>
          </script>
        </material>
        </visual>
        <sensor name="front_camera" type="depth">
         <pose>0.0 0.0 0.0 0.0 0 0.0</pose>
          <update_rate>50</update_rate>
          <camera>
            <horizontal_fov>1.518436</horizontal_fov>
            <image>
              <format>L8</format>
                <width>424</width>
                <height>240</height>
            </image>
            <clip>
              <near>0.35</near>
              <far>15</far>
            </clip>
          </camera>
          <plugin filename="libgazebo_ros_openni_kinect.so" name="camera_controller">
            <pose>0.0 0.0 0.0 0.0 0.0 0.0 </pose>
            <cameraName>camera_front</cameraName>
            <alwaysOn>true</alwaysOn>
            <updateRate>20</updateRate>
            <pointCloudCutoff>0.2</pointCloudCutoff>
            <pointCloudCutoffMax>20</pointCloudCutoffMax>
            <imageTopicName>rgb/image_raw</imageTopicName>
            <cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName>
            <depthImageTopicName>depth/image_raw</depthImageTopicName>
            <depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName>
            <pointCloudTopicName>depth/points</pointCloudTopicName>
            <frameName>front_camera_link</frameName>
            <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>
          </plugin>
        </sensor>
      </link>
    </model>

    <joint name="front_camera_joint_front" type="revolute">
      <child>front_camera::link</child>
      <parent>pro::base_link</parent>
      <axis>
        <xyz>0 0 0</xyz>
        <limit>
          <upper>0</upper>
          <lower>0</lower>
        </limit>
      </axis>
    </joint>

I would appreciate any guidance ....as this is currently driving me crazy.

Greetings

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by Dookei
close date 2020-10-16 07:48:51.240041

Comments

ended up merging this https://github.com/sachazyto/gazebo_r... solved my issue .

Dookei gravatar image Dookei  ( 2020-10-16 07:48:44 -0500 )edit

Which is not a correct solution, as now your PointClouds violate REP-103 camera frame conventions. See also the answer by William in the Q&A you link: you should setup the TF frame for your optical camera frame correctly.

gvdhoorn gravatar image gvdhoorn  ( 2020-10-16 10:52:47 -0500 )edit

Hi I know is not correct, but the thing is if I try to use pointcloud_to_laser this wont work. Either way this is just for the simulation When using the real cameras this wont be used no longer. I also find it annoying that gazebo uses another convention than ROS. And why is the plugin incorrect ? Is it not suppose to be a bridge between Gazebo and ROS?

Dookei gravatar image Dookei  ( 2020-10-16 11:26:15 -0500 )edit