Gazebo camera topic name not changing

asked 2023-06-18 06:37:33 -0500

tibi gravatar image

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 stereo_camera/right/image and the left one on stereo_camera/left/image. The syntax for settings this up I took from the Gazebo Plugins Page: https://classic.gazebosim.org/tutoria...

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 [sensor_name]/[default_topic], 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 snake_case like image_topic_name (instead of the camelcase imageTopicName) as i've seen some internet examples using that but still nothing worked.

edit retag flag offensive close merge delete