Robotics StackExchange | Archived questions

Gazebo camera topic name not changing

Hello,

I'm trying to set up a gazebo simulation for my ROS package where I have a robot that is supposed to have a stereo camera and then do VSLAM with it.

The issue I have right now however is that I cannot change the name of the topics the gazebo cameras are publishing on. Here is my urdf:

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

        <sensor name="left_camera" type="camera">
            <pose>0 0 0 0 0 0 </pose>
            <visualize>true</visualize>
            <update_rate>30</update_rate>
            <camera>
                <horizontal_fov>1.089</horizontal_fov>
                <image>
                    <format>R8G8B8</format>
                    <width>640</width>
                    <height>480</height>
                </image>
                <clip>
                    <near>0.05</near>
                    <far>8.0</far>                    
                </clip>
            </camera>
            <plugin name="left_camera_controller" filename="libgazebo_ros_camera.so">
                <frameName>left_camera_link_optical</frameName>
                <cameraName>stereo_camera/left</cameraName>
                <imageTopicName>image</imageTopicName>
                <cameraInfoTopicName>camera_info</cameraInfoTopicName>
            </plugin>
        </sensor>
    </gazebo>

    <gazebo reference="right_camera_link">
        <material>Gazebo/Blue</material>

        <sensor name="right_camera" type="camera">
            <pose>0 0 0 0 0 0 </pose>
            <visualize>true</visualize>
            <update_rate>30</update_rate>
            <camera>
                <horizontal_fov>1.089</horizontal_fov>
                <image>
                    <format>R8G8B8</format>
                    <width>640</width>
                    <height>480</height>
                </image>
                <clip>
                    <near>0.05</near>
                    <far>8.0</far>                    
                </clip>
            </camera>
            <plugin name="right_camera_controller" filename="libgazebo_ros_camera.so">
                <frameName>right_camera_link_optical</frameName>
                <cameraName>stereo_camera/right</cameraName>
                <imageTopicName>image</imageTopicName>
                <cameraInfoTopicName>camera_info</cameraInfoTopicName>
            </plugin>
        </sensor>
    </gazebo>

Here I set the left camera to publish it's images on stereocamera/right/image and the left one on stereocamera/left/image. The syntax for settings this up I took from the Gazebo Plugins Page: https://classic.gazebosim.org/tutorials?tut=ros_gzplugins#Camera

However when I run the simulation, these are topics I'm gettings:

/left_camera/camera_info
/left_camera/image_raw
/left_camera/image_raw/compressed
/left_camera/image_raw/compressedDepth
/left_camera/image_raw/theora
/right_camera/camera_info
/right_camera/image_raw
/right_camera/image_raw/compressed
/right_camera/image_raw/compressedDepth
/right_camera/image_raw/theora

(other irrelevant topics removed for visiblity)

Basically each camera is publishing on [sensorname]/[defaulttopic], which is not what I want.

I am using ROS2 Humble with Gazebo 11.10.2. Did I write anything wrong? Is that gazebo plugins page deprecated and should I be looking at a newer one?

I also tried using snakecase like imagetopic_name (instead of the camelcase imageTopicName) as i've seen some internet examples using that but still nothing worked.

Asked by tibi on 2023-06-18 06:37:33 UTC

Comments

Answers