ros-simulation / gazebo_ros_pkgs

Wrappers, tools and additional API's for using ROS with Gazebo
http://wiki.ros.org/gazebo_ros_pkgs
754 stars 770 forks source link

guide libgazebo_ros_depth_camera #1343

Open boris-gu opened 2 years ago

boris-gu commented 2 years ago

Hello. Where can I find out what tags I can use for plugin libgazebo_ros_depth_camera in .sdf file? And the second question is: how can I rotate points in rviz so that the depth is not on the z-axis? I have seen tips for where the .urdf file is used, but there is no such file in my model. Is it possible to somehow fix points orientation in the .sdf file?

Снимок экрана от 2021-12-29 14-25-36 Part of my code:

    <sensor name="depth" type="depth">
        <pose>0 -0.03 0.004 0 0 0</pose>
        <camera name="__default__">
          <horizontal_fov>1.047</horizontal_fov>
          <image>
            <width>640</width>
            <height>480</height>
          </image>
          <clip>
            <near>0.1</near>
            <far>100</far>
          </clip>
          <noise>
            <type>gaussian</type>
            <mean>0.0</mean>
            <stddev>0.007</stddev>
          </noise>
        </camera>
        <!--  -->
        <plugin name="plugin_ros" filename="libgazebo_ros_depth_camera.so">
          <alwaysOn>1</alwaysOn>
          <updateRate>0</updateRate>
          <imageTopicName>image_raw</imageTopicName>
          <pointCloudTopicName>points</pointCloudTopicName>
          <cameraInfoTopicName>camera_info</cameraInfoTopicName>
          <cameraName>realsense</cameraName>
          <frameName>gardener</frameName>
          <pointCloudCutoff>0</pointCloudCutoff>
          <distortionK1>0</distortionK1>
          <distortionK2>0</distortionK2>
          <distortionK3>0</distortionK3>
          <distortionT1>0</distortionT1>
          <distortionT2>0</distortionT2>
        </plugin>
        <!--  -->
        <always_on>1</always_on>
        <update_rate>60</update_rate>
        <visualize>0</visualize>
      </sensor>
vinnnyr commented 2 years ago

Where can I find out what tags I can use for plugin libgazebo_ros_depth_camera in .sdf file?

I think this is the best part in the source to look at this is here: https://github.com/ros-simulation/gazebo_ros_pkgs/blob/231a7219b36b8a6cdd100b59f66a3df2955df787/gazebo_plugins/src/gazebo_ros_depth_camera.cpp#L91

how can I rotate points in rviz so that the depth is not on the z-axis? Yes there are a whole lot of SDF or URDF ways to do this, I think in your snippet you can simply modify the pose tag <pose>0 -0.03 0.004 0 0 0</pose> to add orientation information (X Y Z R P Y)

boris-gu commented 2 years ago

Unfortunately, "pose" tag doesn't help. My camera model is directed forward, but in the view the point cloud is displayed upwards. Apparently this is a plugin bug.

I managed to fix this by adding the following line to .launch file: <node pkg="tf2_ros" type="static_transform_publisher" name="realsense_tf" args="0 0.5 0 0 -1.570796 1.570796 gardener_raw gardener"/>

rbonghi commented 2 years ago

I had the same issue, I can't rotate the depth.

I'm using ros2 foxy