gazebo camera topic wont show in rostopic list

asked 2021-10-12 14:06:01 -0500

IslamFA gravatar image

updated 2022-03-03 09:42:06 -0500

lucasw gravatar image

Hello, I am currently trying to deploy object detection in gazebo world but when I try to subscribe to the camera topic from gazebo I cant see it in rostopic list. here is what i do: 1) ros launch my gazebo world. 2) spawn my camera sdf file with the ros camera plugin included.

I can see the camera topic under gazebo.msgs.ImageStamped but I cant see the topic in rostopics or RVIZ.

I would appreciate any help as this issue have been bothering me for two days.

world launch File:

  <arg name="debug" value="false"/>
  <arg name="gui" value="true"/>
  <arg name="paused" value="true"/>
  <arg name="world" value="/home/islam/catkin_ws/src/environment/world/"/>

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(arg world)"/>
    <arg name="debug" value="$(arg debug)"/>
    <arg name="gui" value="$(arg gui)"/>
    <arg name="paused" value="$(arg paused)"/>
    <arg name="use_sim_time" value="true"/>
    <arg name ="verbose" value ="true" />


Spawn camera:

<?xml version="1.0" encoding="UTF-8"?>
    <include file="$(find environment)/launch/spawn_sdf.launch">
        <arg name="camera_name" value="cam" />
        <arg name="x" value="0.0" />
        <arg name="y" value="0.0" />
        <arg name="z" value="0.0" />
        <arg name="roll" value="0"/>
        <arg name="pitch" value="0"/>
        <arg name="yaw" value="0.0" />
        <arg name="sdf_camera_file" value="$(find environment)/world/camera/model.sdf" />

Camera model.sdf:

<?xml version='1.0'?>
 <sdf version='1.6'>

  <model name='camera'>

    <pose frame=''>0 0 10 0 1.54 0</pose>
    <link name='link'>
      <visual name='visual'>
            <size>0.1 0.1 0.1</size>

      <!--Gazebo Camera Plugin-->
      <gazebo reference="camera">
        <sensor type="camera" name="camera">
          <camera name="yolo_camera">
              <!-- Noise is sampled independently per pixel on each frame.
                  That pixel's noise value is added to each of its color
                  channels, which at that point lie in the range [0,1]. -->
          <plugin name="camera_controller" filename="">

edit retag flag offensive close merge delete


Try changing <gazebo reference="camera"> to <gazebo reference="camera_link"> and <frameName>camera</frameName> to <frameName>camera_link</frameName>. I don't see anything else.

osilva gravatar image osilva  ( 2021-10-13 07:50:45 -0500 )edit

I figured out what was wrong. it was gazebo as usual. I was working on a fresh install of ros melodic and it had gazebo 9.0 and it was not great. when I upgraded to gazebo 9.9 the issues got solved. also, changed camera to camera_link before that. thank you for your reply.

IslamFA gravatar image IslamFA  ( 2021-10-13 08:09:32 -0500 )edit

Great to hear it's solved. It would be good you document your answer so others benefit in the future. You may answer your own question. Cheers.

osilva gravatar image osilva  ( 2021-10-13 08:53:17 -0500 )edit