0
$\begingroup$

Rosanswers logo

Hello, Could someone please provide a hint as to why I might not be able to display an image in rviz?

  • I have added a camera in gazebo and am able to see what the robot is seeing. Secondly a call to rostopic echo /camera/color/image_raw returns data. However rostopic echo /camera/color/camera_info results in:

"WARNING: no messages received and simulated time is active. Is /clock being published?"

  • I am publishing a tf from camera_link_optical to map via the following in my roslaunch file: <node pkg="tf" type="static_transform_publisher" name="camera_link_optical_to_map" args="0.0 0.0 0.0 0.0 0.0 0.0 map camera_link_optical 100"/> but I am unsure if this is correct. This was the solution based on this link here.

  • In rviz I have added a camera, set the "Fixed Frame" to camera_link_optical receive the following message "'n' messages received" but also obtain the warning "No CameraInfo received on [/camera/color/camera_info]. Topic may not exist." I am not sure if this is causing the issue.

  • Essentially it is clear data is being published from rostopic echo as mentioned above and the image is clearly viewable in my gazebo simulation. I am not sure why there is however no image in rviz. I have added a snippet of code from my xacro file which is included by the launchfile below. This is largely based off the blog-post from Articulated Robotics here.

Hopefully I have made the issue clear enough. Thank-you for your help.

<joint name="camera_joint" type="fixed">
        <parent link="base_link"/>
        <child link="camera_link"/>
        <!-- Rotates camera here -->
        <origin xyz="${-base_len/2 - camera_box_dim / 2 - camera_offset} 0 ${vehicle_box_height/2}" rpy="${-pi/2} 0 ${-pi/2}"/>
        <!-- <origin xyz="${-base_len/2 - camera_box_dim / 2 - camera_offset} 0 ${vehicle_box_height/2}" rpy="0 ${pi/2} 0"/> -->
    </joint>


<link name="camera_link">
    <visual>
        <geometry>
            <box size="${camera_box_dim} ${camera_box_dim} ${camera_box_dim}"/>
        </geometry>
        <material name="red"/>
    </visual>
</link>



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

<link name="camera_link_optical"></link>


<!-- <gazebo reference="camera_link">
    <material>Gazebo/Red</material>
</gazebo> -->

<gazebo reference="camera_link">
    <material>Gazebo/Red</material>

    <sensor name="camera" type="camera">
        <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>R8G8B8</format>
                <width>640</width>
                <height>480</height>
            </image>
            <clip>
                <near>0.001</near>
                <far>8</far>
            </clip>
        </camera>
        <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
            <cameraName>camera</cameraName>
            <always_on>true</always_on>
            <imageTopicName>/camera/color/image_raw</imageTopicName>
            <cameraInfoTopicName>camera_info</cameraInfoTopicName>
            <frameName>camera_link_optical</frameName>
            <focalLength>0.0</focalLength>
        </plugin>
    </sensor>
</gazebo>

Originally posted by jdgre1 on ROS Answers with karma: 16 on 2023-04-22

Post score: 0


Original comments

Comment by Davies Ogunsina on 2023-04-22:
Do you have a tf from the base_link to camera link frame ?

Comment by Mike Scheutzow on 2023-04-22:
There are many examples of working gazebo camera configurations on this site e.g. #q210695.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Thanks for your help guys. This was in the end a simple fix: I was not subscribing to the correct topic in Rviz. I needed to subscribe to topic "Image" rather than "Camera" so this was an amateur mistake on my behalf. Cheers


Originally posted by jdgre1 with karma: 16 on 2023-04-23

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.