Ask Your Question
1

How to include two or more models in sdf

asked 2021-04-23 12:30:55 -0500

Zero39 gravatar image

updated 2021-04-24 15:28:35 -0500

jayess gravatar image

Hello everyone, I'm working with PX4 and I'm trying to add two realsense cameras to the iris drone, 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:

  • /camera_front/depth/image
  • /camera_down/depth/image

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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-12-03 02:23:48 -0500

ljaniec gravatar image

Maybe this similar question and its answer on Gazebo forum could help you - "You need to set unique names for each model you include."

It seems that it should be <name>... and then <uri>.. and right after <joint ...>?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-04-23 12:30:55 -0500

Seen: 269 times

Last updated: Dec 03 '21