Robotics StackExchange | Archived questions

How to include two or more models in sdf

Hello everyone, I'm working with PX4 and I'm trying to add two realsense cameras to the iris drone in Gazebo, one pointing forward and one pointing down, but when I include the two models the second camera topics overwrite the first ones. I know this happens because they have the same namespaces but I can't figure out how to distinguish them inside the sdf file in order to have, for example:

The sdf I'm using for the drone is the following:

<sdf version='1.5'>
<model name='iris_realsense'>

<include>
  <uri>model://iris</uri>
</include>

<include>
  <uri>model://r200</uri>
  <name>front_camera</name>
  <pose>0.2 0 0 0 0 0</pose>
</include>

<include>
  <uri>model://r200</uri>
  <name>down_camera</name>
  <pose>0 0 -0.05 0 1.57 0</pose>
</include>

<joint name="fpv_cam_joint" type="fixed">
  <parent>iris::base_link</parent>
  <child>front_camera::link</child>
  <axis>
    <xyz>0 0 1</xyz>
    <limit>
      <upper>0</upper>
      <lower>0</lower>
    </limit>
  </axis>
</joint>

<joint name="fpv_cam_joint2" type="fixed">
  <parent>iris::base_link</parent>
  <child>down_camera::link</child>
  <axis>
    <xyz>0 0 1</xyz>
    <limit>
      <upper>0</upper>
      <lower>0</lower>
    </limit>
  </axis>
</joint>

</model>
</sdf>

and the realsense sdf included is:

<plugin name="r200_controller" filename="libgazebo_ros_camera.so">
   <ros>
      <namespace>custom_ns</namespace>
      <argument>custom_camera/image_raw:=custom_camera/custom_image</argument>
      <argument>custom_camera/image_depth:=custom_camera/custom_image_depth</argument>
      <argument>custom_camera/camera_info:=custom_camera/custom_info_raw</argument>
      <argument>custom_camera/camera_info_depth:=custom_camera/custom_info_depth</argument>
      <argument>custom_camera/points:=custom_camera/custom_points</argument>
    </ros>
    <frameName>r200</frameName>
</plugin>

Thanks for your help!

Asked by Zero39 on 2021-04-28 04:01:50 UTC

Comments

Answers