Camera Plugin doesn't work in Sphinx

Hello there,

I am trying to start Sphinx with a virtual camera placed in the world to see the drone from the side. Here is part of my .world file

 <model name="camera">
    <pose>-0.5 0 0.3 0 0 0</pose>
    <link name="camera_link">
      <inertial>
        <mass>0.1</mass>
      </inertial>
      <collision name="collision">
        <geometry>
          <box>
            <size>0.1 0.1 0.1</size>
          </box>
        </geometry>
      </collision>
      <visual name="visual">
        <geometry>
          <box>
            <size>0.1 0.1 0.1</size>
          </box>
        </geometry>
      </visual>
      <sensor name="camera1" type="camera">
        <camera>
          <horizontal_fov>1.047</horizontal_fov>
          <image>
            <width>800</width>
            <height>600</height>
          </image>
          <clip>
            <near>0.1</near>
            <far>100</far>
          </clip>
        </camera>
        <always_on>1</always_on>
        <update_rate>30</update_rate>
        <visualize>true</visualize>

        <plugin name="camera_controller" filename="libCameraPlugin.so">
            <alwaysOn>true</alwaysOn>
            <updateRate>15.0</updateRate>
            <cameraName>camera1</cameraName>
            <imageTopicName>camera/image_raw</imageTopicName>
            <cameraInfoTopicName>camera/camera_info</cameraInfoTopicName>
            <frameName>camera_link</frameName>
            <hackBaseline>0.07</hackBaseline>
            <distortionK1>0.0</distortionK1>
            <distortionK2>0.0</distortionK2>
            <distortionK3>0.0</distortionK3>
            <distortionT1>0.0</distortionT1>
            <distortionT2>0.0</distortionT2>
        </plugin>

      </sensor>
    </link>
</model>

However, when I try to start Sphinx with this world and Bebop2.drone it says me the following:

[Err] [CameraPlugin.cc:53] CameraPlugin requires a CameraSensor

and then exits with a segmentation fault.

Would be nice if anyone new what to do.
Thanks.

Hello,

You have found an issue with sphinx that will be fixed in the next version. It prevents anyone from using the CameraPlugin. In the meantime, you can simply use the “follow” camera that comes with Sphinx. To activate it, simply right click on your drone and select “Follow”.

Camera parameters can be changed in the GUI item of the client: http://gazebosim.org/tutorials?tut=track_visual&cat=tools_utilities&branch=track_visual#DynamicReconfigure
or you can adapt the <gui> section in your world file. Here is an example:

<gui>
  <camera name="user_camera">
    <pose>-31.4742622375488281 10.6645917892456055 124.7510528564453125 -0.0000000061694163 0.6057507481416582 -0.4140146405913985</pose>
    <track_visual>
      <static>true</static>
      <use_model_frame>true</use_model_frame>
      <xyz>-3 0 1</xyz>
      <inherit_yaw>true</inherit_yaw>
    </track_visual>
  </camera>
</gui>

I guess, I found a solution. Somehow, when I deleted the whole plugin block, the camera started working properly and publishing the image.

Yes, the problem is that the CameraPlugin is not compatible with your sphinx version. Note that if you want to visualize the camera, you can also use the camera model included in sphinx like so:

<include>
  <pose>-0.5 0 0.3 0 0 0</pose>
  <uri>model://camera</uri>
</include>
1 Like