Robotics StackExchange | Archived questions

I cannot see realsense topic when I rostopic list

Dear users,

I am a ros beginner and I try to create a robot on gazebo, with many sensors as IMU, cameras, lidar, sonar... I want to create it using urdf (no xacro for the moment).

However, I have an issue with the realsense camera I want to simulate. There are no topics in the rostopic list when I run the simulation.

Here is what I have written in my robot_test.urdf:

<link name='camera_link'>

    <visual>
            <origin xyz='0 0 0' rpy='0 0 0'/>
            <geometry>
                <box size='0.0078 0.130 0.0192'/>
            </geometry>
        </visual>

    <collision>
        <origin xyz='0 0 0' rpy='0 0 0'/>
            <geometry>
                <box size='0.0078 0.130 0.0192'/>
            </geometry>
    </collision>

        <inertial>
            <mass value='0.052' />
            <origin xyz='0 0.320 0.1596' rpy='0 0 0'/>
            <inertia ixx='1e-6' ixy='0' ixz='0' iyy='1e-6' iyz='0' izz='1e-6' />
        </inertial>

    <static>0</static>
        <allow_auto_disable>1</allow_auto_disable>

</link>

<joint name='camera_joint' type='fixed'>
    <origin xyz='0 0.320 0.1596' rpy='0 0 1.57079'/>
    <parent link='base_link'/>
    <child link='camera_link'/>
</joint>


<!-- Virtual links representing the cameras positions and orientations-->
    <link name="camera_color" />
    <link name="camera_depth" />
    <link name="camera_ired1" />
    <link name="camera_ired2" />

<!-- Joints positioning the virtual links with respect to the camera main link-->
<joint name="camera_color_joint" type="fixed">
    <parent link="camera_link" />
    <child link="camera_color" />
    <!-- <origin xyz="0 -0.046 0.004" rpy="0 0 0"/> -->
    <!-- The default position is change since in Rviz the cloud depth axis is Z not X-->
    <origin xyz="0 -0.046 0.004" rpy="${pi/2} ${pi} ${pi/2}"/>
</joint>

<joint name="camera_depth_joint" type="fixed">
    <parent link="camera_link" />
    <child link="camera_depth" />
    <origin xyz="0 -0.03 0.004" rpy="0 0 0"/>
</joint>

<joint name="camera_ired1_joint" type="fixed">
    <parent link="camera_link" />
    <child link="camera_ired1" />
    <origin xyz="0 -0.06 0.004" rpy="0 0 0"/>
</joint>

<joint name="camera_ired2_joint" type="fixed">
    <parent link="camera_link" />
    <child link="camera_ired2" />
    <origin xyz="0 0.01 0.004" rpy="0 0 0"/>
</joint>


  <gazebo>
        <plugin name="realsense_plugin" filename="librealsense_gazebo_plugin.so">
            <prefix>cam</prefix>
            <depthUpdateRate>60.0</depthUpdateRate>
            <colorUpdateRate>60.0</colorUpdateRate>
            <infraredUpdateRate>60.0</infraredUpdateRate>
            <depthTopicName>depth/image_raw</depthTopicName>
            <depthCameraInfoTopicName>depth/camera_info</depthCameraInfoTopicName>
            <colorTopicName>color/image_raw</colorTopicName>
            <colorCameraInfoTopicName>color/camera_info</colorCameraInfoTopicName>
            <infrared1TopicName>infra1/image_raw</infrared1TopicName>
            <infrared1CameraInfoTopicName>infra1/camera_info</infrared1CameraInfoTopicName>
            <infrared2TopicName>infra2/image_raw</infrared2TopicName>
            <infrared2CameraInfoTopicName>infra2/camera_info</infrared2CameraInfoTopicName>
            <colorOpticalframeName>color_optical_frame</colorOpticalframeName>
            <depthOpticalframeName>depth_optical_frame</depthOpticalframeName>
            <infrared1OpticalframeName>infrared1_optical_frame</infrared1OpticalframeName>
            <infrared2OpticalframeName>infrared2_optical_frame</infrared2OpticalframeName>
            <rangeMinDepth>0.2</rangeMinDepth>
            <rangeMaxDepth>10.0</rangeMaxDepth>
            <pointCloud>false</pointCloud>
            <pointCloudTopicName>depth/points</pointCloudTopicName>
            <pointCloudCutoff>0.5</pointCloudCutoff>
        </plugin>
    </gazebo>


<gazebo reference='camera_link'>      

        <sensor name='color' type='camera'>
            <pose>0 -0.046 0.004 0 0 0</pose>
            <camera name='__default__'>
                <horizontal_fov>1.047</horizontal_fov>
                <image>
                        <width>640</width>
                        <height>480</height>
                        <format>RGB_INT8</format>
                </image>
                <clip>
                        <near>0.1</near>
                        <far>100</far>
                </clip>
                <noise>
                        <type>gaussian</type>
                        <mean>0</mean>
                        <stddev>0.007</stddev>
                </noise>
            </camera>
            <always_on>1</always_on>
            <update_rate>60</update_rate>
            <visualize>1</visualize>

        </sensor>

    <sensor name='ired1' type='camera'>

            <pose>0 -0.06 0.004 0 -0 0</pose>
            <camera name='__default__'>
                <horizontal_fov>1.047</horizontal_fov>
                <image>
                    <width>640</width>
                        <height>480</height>
                        <format>L_INT8</format>
                </image>
                <clip>
                        <near>0.1</near>
                        <far>100</far>
                </clip>
                <noise>
                        <type>gaussian</type>
                        <mean>0</mean>
                        <stddev>0.007</stddev>
                </noise>
            </camera>
            <always_on>1</always_on>
            <update_rate>60</update_rate>
            <visualize>0</visualize>

        </sensor>

        <sensor name='ired2' type='camera'>

            <pose frame=''>0 0.01 0.004 0 -0 0</pose>
            <camera name='__default__'>
                <horizontal_fov>1.047</horizontal_fov>
                <image>
                    <width>640</width>
                        <height>480</height>
                        <format>L_INT8</format>
                </image>
                <clip>
                        <near>0.1</near>
                        <far>100</far>
                </clip>
                <noise>
                        <type>gaussian</type>
                        <mean>0</mean>
                        <stddev>0.007</stddev>
                </noise>
            </camera>
            <always_on>1</always_on>
            <update_rate>60</update_rate>
            <visualize>0</visualize>

        </sensor>

        <sensor name='depth' type='depth'>

            <pose frame=''>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</mean>
                        <stddev>0.007</stddev>
                </noise>
            </camera>
            <always_on>1</always_on>
            <update_rate>60</update_rate>
            <visualize>0</visualize>

        </sensor>

    </gazebo>

I don't know wheter I have misunderstood the way I have to write it, so I would be very enjoyed if someone could help me.

I use gazebo9 with ros-melodic on ubuntu 18.04 Thank you very much.

Asked by ros_beginner on 2020-06-03 07:40:40 UTC

Comments

Answers

Hello,

you should include the plugin tag inside the sensor tag. Review this world

Asked by ahcorde on 2020-06-08 02:01:34 UTC

Comments