Changing depth camera orientation

asked 2022-03-12 06:14:02 -0500

Satan29 gravatar image

I am using ros melodic on Ubuntu 18.04

I have a depth camera model attached to a drone , but the depth image is such that the camera is facing forward...however, it was mentioned that the depth camera is downward facing...

I have a folder called "models" which contains 2 folders: "drone_with_depth_camera" and "gimbal_small_2d".

The models.sdf file of the drone_with_depth camera looks like this(the part with the depth camera information):

model name="drone_with_depth_camera"

<include>
  <uri>model://iris_base</uri>
</include>
<include>
  <uri>model://gimbal_small_2d</uri>
  <pose>0 -0.01 0.070 1.57 0 1.57</pose>
</include>

And, the models.sdf file of the gimbal_small_2d looks like this(the part with the depth camera info):

<sensor name="depth_camera" type="depth">
        <pose>0 0 0 -1.57 -1.57 0</pose>
        <update_rate>20</update_rate>
        <always_on>1</always_on>
        <visualize>true</visualize>
        <camera>
          <horizontal_fov>1.047198</horizontal_fov>
          <image>
            <width>640</width>
            <height>480</height>
            <format>R8G8B8</format>
          </image>
          <clip>
            <near>0.1</near>
            <far>20</far>
          </clip>
        </camera>
        <plugin name="depth_controller" filename="libgazebo_ros_openni_kinect.so">
          <baseline>0.2</baseline>
          <alwaysOn>true</alwaysOn>
          <updateRate>10.0</updateRate>
          <cameraName>depth_camera</cameraName>
          <imageTopicName>/depth_camera/rgb/image_raw</imageTopicName>
          <cameraInfoTopicName>/depth_cameracamera/color/camera_info</cameraInfoTopicName>
          <depthImageTopicName>/depth_camera/depth/image_raw</depthImageTopicName>
          <depthImageInfoTopicName>/depth_cameracamera/depth/camera_info</depthImageInfoTopicName>
          <pointCloudTopicName>depth/points</pointCloudTopicName>
          <frameName>camera_link_optical</frameName>
          <pointCloudCutoff>0.4</pointCloudCutoff>
          <pointCloudCutoffMax>10.0</pointCloudCutoffMax>
          <distortionK1>0.0</distortionK1>
          <distortionK2>0.0</distortionK2>
          <distortionK3>0.0</distortionK3>
          <distortionT1>0.0</distortionT1>
          <distortionT2>0.0</distortionT2>
          <CxPrime>0</CxPrime>
          <Cx>0</Cx>
          <Cy>0</Cy>
          <focalLength>0.0</focalLength>
          <focalLength>0</focalLength>
          <hackBaseline>0</hackBaseline>
        </plugin>

      </sensor>

In rviz, I have 2 kinds of image topics:

  • /depth camera/depth/image raw
  • /depth camera/rgb/image raw

The rgb image is such that the camera is facing downwards, however the depth image (what I'm interested in) is such that the camera is facing horizontally....

How can I get the depth_image from the perspective of a downward facing camera instead of a forward facing one?

edit retag flag offensive close merge delete

Comments

Well, it seems that it all depends on the position of camera_link_optical frame. Do you have it defined somewhere in your model? If you open up the TF tree in rviz, what does it look like?

Serafadam gravatar image Serafadam  ( 2022-03-12 12:31:39 -0500 )edit

Setting up the kinect device for a robot has been discussed many, many times on this site. If you put the word kinect into the search box at the top of this page, you will get a large number of hits. Please spend some time looking at the questions that have already been answered.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-03-13 09:21:53 -0500 )edit