ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Depth camera not working in Reiz

asked 2023-08-01 10:07:34 -0500

Icon45 gravatar image

Hi everyone,

I created this camera and attached it on the wrist_3_link of a universal robot. Unfortunately when I launch RViz and try to view the Image I can't select a topic for the image.

What am I doing wrong here?

This is the code for my depth camera:

  <?xml version="1.0"?>
<robot name="camera" xmlns:xacro="http://www.ros.org/wiki/xacro">


    <!--//////////////////////////////VARIABLEN///////////////////////////////////////////-->

    <!--Breiten der einzelnen Quader in m-->
    <xacro:property name="c_b1" value="0.08512"/><!--Halter-->
    <xacro:property name="c_b2" value="0.03194"/><!--Camera-->
    <!--Längen der einzelnen Quader in m-->
    <xacro:property name="c_l1" value="0.05"/><!--Halter-->
    <xacro:property name="c_l2" value="0.1745"/><!--Camera-->
    <!--Hoehen der einzelnen Quader in m-->
    <xacro:property name="c_h1" value="0.005"/><!--Halter-->
    <xacro:property name="c_h2" value="0.02993"/><!--Camera-->
    <!--Massen der einzelnen Quader in kg-->
    <xacro:property name="c_m1" value="0.387"/><!--Halter-->
    <xacro:property name="c_m2" value="0.2"/><!--Camera-->


    <!--///////////////////////////AUFBAU DER KAMERA///////////////////////////////////-->

    <!--link name="basis_link"></link-->

    <!--Brücke zu UR10-->
    <link name="camera_mount_link">

        <visual>
            <origin xyz="0 0 0" rpy="0 0 0"/>
            <geometry>
                <box size="${c_l1} ${c_b1} ${c_h1}"/>
            </geometry>
        </visual>

        <inertial>
            <origin xyz="0 0 0" rpy="0 0 0"/>
            <mass value="${c_m1}"/>
            <inertia ixx="${(c_m1/12)*(c_h1*c_h1+c_l1*c_l1)}" ixy="0.0" ixz="0.0" iyy="${(c_m1/12)*(c_b1*c_b1+c_l1*c_l1)}" iyz="0.0" izz="${(c_m1/12)*(c_b1*c_b1+c_h1*c_h1)}"/>
        </inertial>

        <collision>
            <origin xyz="0 0 0" rpy="0 0 0"/>
            <geometry>
                <box size="${c_l1} ${c_b1} ${c_h1}"/>
            </geometry>
        </collision>

     </link>


    <joint name="camera_mount_joint" type="fixed">
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <parent link="camera_mount_link"/>
        <child link="camera_link"/>
    </joint>

    <!--Kamera-->
    <link name="camera_link">

        <visual>
            <origin xyz="0 ${-c_l1} ${c_h1} " rpy="0 0 0"/>
            <geometry>
                <box size="${c_l2} ${c_b2} ${c_h2}"/>
            </geometry>
        </visual>

        <inertial>
            <origin xyz="0 ${-c_l1} ${c_h1}" rpy="0 0 0"/>
            <mass value="${c_m2}"/>
            <inertia ixx="${(c_m2/12)*(c_h2*c_h2+c_l2*c_l2)}" ixy="0.0" ixz="0.0" iyy="${(c_m2/12)*(c_b2*c_b2+c_l2*c_l2)}" iyz="0.0" izz="${(c_m2/12)*(c_b2*c_b2+c_h2*c_h2)}"/>
        </inertial>

        <collision>
            <origin xyz="0 ${-c_l1} ${c_h1}" rpy="0 0 0"/>
            <geometry>
                <box size="${c_l2} ${c_b2} ${c_h2}"/>
            </geometry>
        </collision>

    </link>

    <joint name="camera_optical_mount_joint" type="fixed">
        <origin xyz="0 0 0" rpy="${-pi/2} 0 ${-pi/2}"/>
        <parent link="camera_link"/>
        <child link="camera_optical_link"/>
    </joint>

    <!--Kamera_optic-->
    <link name="camera_optical_link"></link>

    <!--////////////////////////////////////////Gazebo-Eigenschaften///////////////////////////////////////////-->
    <gazebo reference="camera_mount_link">
        <material>Gazebo/Green</material>
    </gazebo>
    <gazebo reference="camera_link">
        <material>Gazebo/DarkGrey</material>
        <sensor name="camera" type="depth">
            <pose>0 0 0 0 0 0</pose>
            <visualize>true</visualize>
            <update_rate>10</update_rate>
            <camera>
                <horizontal_fov>1.089</horizontal_fov>
                <image>
                    <format>B8R8G8</format>
                    <width>640</width>
                    <height>480</height>
                </image>
                <clip>
                    <near>0.05</near> ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2023-08-01 11:12:41 -0500

Vini71 gravatar image

updated 2023-08-01 11:17:28 -0500

If you are using ROS2 probably is a QoS issue ( Quality of service)

You must open rviz2

1- ros2 run rviz2 rviz2

2- Go to add plugin button and look for image or camera

3- on topic select or type "/camera/image_raw" or "camera/depth"

4 - Below topic options there are QoS settings. Usually is set to "Reliable" and you need to switch to "Best Effort" or the inverse. Doing this change it should work and image appears.

5- If you don't have success, you need to check if camera data is publishing image data

A) ros2 topic list

B) ros2 topic echo /camera/depth

If data is not flowing then you found the issue, open rqt graph and check if your node is Not publishing data to your camera or subscribing and why:

C) ros2 run rqt_graph rqt_ graph

edit flag offensive delete link more

Comments

First of all thank you for your answer! So I've done steps 1 to 5 and also ran A to C. The Topics are simply not available or to put it in better words: don't exist. My problem really is that I don't know why they don't exist, because the code I wrote should work (at least as far as my understanding of goes)

Icon45 gravatar image Icon45  ( 2023-08-02 03:34:29 -0500 )edit

Then it seems a robot state publisher or joint state publisher issue. Do you have these packages installed? Is your TF on rviz2 ok, I mean no transform errors? Just check if your urdf is correct? Go to your urdf folder and do

A) check_urdf robot_name.urdf

I would suggest debug this with ChatGpt, paste your robot model and ask GPT if something is wrong with your plugin definition...

Vini71 gravatar image Vini71  ( 2023-08-02 04:51:51 -0500 )edit

Yeah i have installed these publishers and I’m using them to control my ur10. TF is ok. urdf is ok and ChatGPT doesn’t find any errors.

Icon45 gravatar image Icon45  ( 2023-08-03 01:19:29 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2023-08-01 10:07:34 -0500

Seen: 325 times

Last updated: Aug 01 '23