Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Stereo Camera Unable to Publish to ROS

So I'm trying to write a plugin that uses both ROS and Gazebo to control a camera that is attached to a robot model in Gazebo. The camera I'm using is the default Stereo Camera from the Gazebo model database with some visual modifications. The issue is that although the image topic shows up in the Topic Selector, there is no corresponding topic in the list brought up by "rostopic list" even when I launch Gazebo and include the model through ROS. Here is the .sdf file for the camera. Note there is no tags for any plugins because that's what I'm trying to write.

<?xml version="1.0" ?>
<sdf version="1.4">
  <model name="stereocamera">
    <link name="head">
      <pose>0.05 0.05 0.15 0 0 0</pose>
      <inertial>
        <mass>0.1</mass>
      </inertial>

      <collision name="collision">
        <geometry>
          <box>
            <size>0.1 0.1 0.05</size>
          </box>
        </geometry>
      </collision>

      <visual name="visual">
        <geometry>
          <box>
            <size>0.1 0.1 0.05</size>
          </box>
        </geometry>
      </visual>

      <sensor name="camera" type="multicamera">
        <always_on>1</always_on>
        <update_rate>30</update_rate>
        <visualize>true</visualize>

        <camera name="left">
          <pose>0 0.2 0 0 0 0</pose>
          <horizontal_fov>1.047</horizontal_fov>
          <image>
            <width>320</width>
            <height>240</height>
          </image>
          <clip>
            <near>0.1</near>
            <far>100</far>
          </clip>
        </camera>

        <camera name="right">
          <pose>0 -0.2 0 0 0 0</pose>
          <horizontal_fov>1.047</horizontal_fov>
          <image>
            <width>320</width>
            <height>240</height>
          </image>
          <clip>
            <near>0.1</near>
            <far>100</far>
          </clip>
        </camera>

      </sensor>
    </link>
    <link name="neck">
      <pose>0.05 0.05 0 0 0 0</pose>
      <inertial>
        <mass>0.1</mass>
      </inertial>
      <collision name="collision">
        <geometry>
          <cylinder>
            <radius>.015</radius>
            <length>.3</length>
          </cylinder>
        </geometry>
      </collision>
      <visual name="visual">
        <geometry>
          <cylinder>
            <radius>.015</radius>
            <length>.3</length>
          </cylinder>
        </geometry>
      </visual>
    </link>
    <link name="left_eye">
      <pose>0.1 0.08 0.15 0 1.5707 0</pose>
      <inertial>
        <mass>0.1</mass>
      </inertial>
      <collision name="collision">
        <geometry>
          <cylinder>
            <radius>.015</radius>
            <length>.0001</length>
          </cylinder>
        </geometry>
      </collision>
      <visual name="visual">
        <geometry>
          <cylinder>
            <radius>.015</radius>
            <length>.0001</length>
          </cylinder>
        </geometry>
        <material>
          <script>
            <uri>file://media/materials/scripts/gazebo.material</uri>
            <name>Gazebo/Black</name>
          </script>
        </material>
      </visual>
    </link>
    <link name="right_eye">
      <pose>0.1 0.02 0.15 0 1.5707 0</pose>
      <inertial>
        <mass>0.1</mass>
      </inertial>
      <collision name="collision">
        <geometry>
          <cylinder>
            <radius>.015</radius>
            <length>.0001</length>
          </cylinder>
        </geometry>
      </collision>
      <visual name="visual">
        <geometry>
          <cylinder>
            <radius>.015</radius>
            <length>.0001</length>
          </cylinder>
        </geometry>
        <material>
          <script>
            <uri>file://media/materials/scripts/gazebo.material</uri>
            <name>Gazebo/Black</name>
          </script>
        </material>
      </visual>
    </link>
    <joint name="neck_joint" type="revolute">
      <child>head</child>
      <parent>neck</parent>
      <axis>
        <xyz>0 0 1</xyz>
        <limit>
          <upper>0</upper>
          <lower>0</lower>
        </limit>
      </axis>
    </joint>
    <joint name="left_eye_joint" type="revolute">
      <child>left_eye</child>
      <parent>head</parent>
      <axis>
        <xyz>1 0 0</xyz>
        <limit>
          <upper>0</upper>
          <lower>0</lower>
        </limit>
      </axis>
    </joint>
    <joint name="right_eye_joint" type="revolute">
      <child>right_eye</child>
      <parent>head</parent>
      <axis>
        <xyz>1 0 0</xyz>
        <limit>
          <upper>0</upper>
          <lower>0</lower>
        </limit>
      </axis>
    </joint>
  </model>
</sdf>

Would I possibly need to write a blank plugin first to make the Gazebo node publish the image topic? Any help is greatly appreciated.

click to hide/show revision 2
Added information regarding model.

Stereo Camera Unable to Publish to ROS

So I'm trying to write a plugin that uses both ROS and Gazebo to control a camera that is attached to a robot model in Gazebo. The camera I'm using is the default Stereo Camera from the Gazebo model database with some visual modifications. The issue is that although the image topic shows up in the Topic Selector, there is no corresponding topic in the list brought up by "rostopic list" even when I launch Gazebo and include the model through ROS. Here is the .sdf file for the camera. Note there is no tags for any plugins because that's what I'm trying to write.

<?xml version="1.0" ?>
<sdf version="1.4">
  <model name="stereocamera">
    <link name="head">
      <pose>0.05 0.05 0.15 0 0 0</pose>
      <inertial>
        <mass>0.1</mass>
      </inertial>

      <collision name="collision">
        <geometry>
          <box>
            <size>0.1 0.1 0.05</size>
          </box>
        </geometry>
      </collision>

      <visual name="visual">
        <geometry>
          <box>
            <size>0.1 0.1 0.05</size>
          </box>
        </geometry>
      </visual>

      <sensor name="camera" type="multicamera">
        <always_on>1</always_on>
        <update_rate>30</update_rate>
        <visualize>true</visualize>

        <camera name="left">
          <pose>0 0.2 0 0 0 0</pose>
          <horizontal_fov>1.047</horizontal_fov>
          <image>
            <width>320</width>
            <height>240</height>
          </image>
          <clip>
            <near>0.1</near>
            <far>100</far>
          </clip>
        </camera>

        <camera name="right">
          <pose>0 -0.2 0 0 0 0</pose>
          <horizontal_fov>1.047</horizontal_fov>
          <image>
            <width>320</width>
            <height>240</height>
          </image>
          <clip>
            <near>0.1</near>
            <far>100</far>
          </clip>
        </camera>

      </sensor>
    </link>
    <link name="neck">
      <pose>0.05 0.05 0 0 0 0</pose>
      <inertial>
        <mass>0.1</mass>
      </inertial>
      <collision name="collision">
        <geometry>
          <cylinder>
            <radius>.015</radius>
            <length>.3</length>
          </cylinder>
        </geometry>
      </collision>
      <visual name="visual">
        <geometry>
          <cylinder>
            <radius>.015</radius>
            <length>.3</length>
          </cylinder>
        </geometry>
      </visual>
    </link>
    <link name="left_eye">
      <pose>0.1 0.08 0.15 0 1.5707 0</pose>
      <inertial>
        <mass>0.1</mass>
      </inertial>
      <collision name="collision">
        <geometry>
          <cylinder>
            <radius>.015</radius>
            <length>.0001</length>
          </cylinder>
        </geometry>
      </collision>
      <visual name="visual">
        <geometry>
          <cylinder>
            <radius>.015</radius>
            <length>.0001</length>
          </cylinder>
        </geometry>
        <material>
          <script>
            <uri>file://media/materials/scripts/gazebo.material</uri>
            <name>Gazebo/Black</name>
          </script>
        </material>
      </visual>
    </link>
    <link name="right_eye">
      <pose>0.1 0.02 0.15 0 1.5707 0</pose>
      <inertial>
        <mass>0.1</mass>
      </inertial>
      <collision name="collision">
        <geometry>
          <cylinder>
            <radius>.015</radius>
            <length>.0001</length>
          </cylinder>
        </geometry>
      </collision>
      <visual name="visual">
        <geometry>
          <cylinder>
            <radius>.015</radius>
            <length>.0001</length>
          </cylinder>
        </geometry>
        <material>
          <script>
            <uri>file://media/materials/scripts/gazebo.material</uri>
            <name>Gazebo/Black</name>
          </script>
        </material>
      </visual>
    </link>
    <joint name="neck_joint" type="revolute">
      <child>head</child>
      <parent>neck</parent>
      <axis>
        <xyz>0 0 1</xyz>
        <limit>
          <upper>0</upper>
          <lower>0</lower>
        </limit>
      </axis>
    </joint>
    <joint name="left_eye_joint" type="revolute">
      <child>left_eye</child>
      <parent>head</parent>
      <axis>
        <xyz>1 0 0</xyz>
        <limit>
          <upper>0</upper>
          <lower>0</lower>
        </limit>
      </axis>
    </joint>
    <joint name="right_eye_joint" type="revolute">
      <child>right_eye</child>
      <parent>head</parent>
      <axis>
        <xyz>1 0 0</xyz>
        <limit>
          <upper>0</upper>
          <lower>0</lower>
        </limit>
      </axis>
    </joint>
  </model>
</sdf>

Also, I only have an SDF model for the camera, no URDF or Xarco files. Would I possibly need to write a blank plugin first to make the Gazebo node publish the image topic? Any help is greatly appreciated.