Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Passing parameters to included SDF

For example I have a bunch of identical cameras in a world. The model of a camera includes the gazebo_ros_camera plugin with parameters such as topic name etc. Obviously every camera should publish to the topic with unique name. So, is it possible to pass such parameters from within <include> tag? If not, are there any workarounds? Duplicating the camera model with modified parameters is not a nice option.

Something similar to <arg> tag in ROS' launch files would suffice, but I was unable to find anything like this in SDF specification.

Thanks,

Boris

Passing parameters to included SDF

For example I have a bunch of identical cameras in a world. The model of a camera includes the gazebo_ros_camera plugin with parameters such as topic name etc. Obviously every camera should publish to the topic with unique name. So, is it possible to pass such parameters from within <include> tag? If not, are there any workarounds? Duplicating the camera model with modified parameters is not a nice option.

Something similar to <arg> tag in ROS' launch files would suffice, but I was unable to find anything like this in SDF specification.

EDIT:

Let's say I have a Gazebo model of camera:

<sdf version="1.3">
  <model name="camera">
    <link name="link">
      ...
      <sensor name="camera" type="camera">
        ...
        <plugin name="camera_plugin" filename="libgazebo_ros_camera.so">
          ...
          <!-- PROBLEMS ARE HERE -->
          <imageTopicName>image_raw</imageTopicName>
          <cameraName>camera</cameraName>
          ...
          <frameName>camera_frame</frameName>
          ...
        </plugin>
      </sensor>
    </link>
  </model>
</sdf>

Now, if I include several of these to a world:

<sdf version="1.3">
  <world name="cameras_world">
    ...
    <include>
      <uri>model://camera</uri>
      <name>camera_1</name>
      <pose>1 0 1 0 0 0</pose>
    </include>

    <include>
      <uri>model://camera</uri>
      <name>camera_2</name>
      <pose>2 0 1 0 0 0</pose>
    </include>

    <include>
      <uri>model://camera</uri>
      <name>camera_3</name>
      <pose>3 0 1 0 0 0</pose>
    </include>
</sdf>

All three cameras will publish to exactly same ROS topic: /camera/image_raw as well as with exactly same frame ID: camera_frame. Because there is no way on SDF level to pass down custom parameters to included models.

So I need a workaround for this and looking for your kind suggestions.

I hope now my question is clear :-)

Thanks,

Boris