0
$\begingroup$

Gazebo Answers logo

I have been trying to get the kinect sensor to work in gazebo 1.9 with ROS Groovy from the following tutorial, http://gazebosim.org/wiki/Tutorials/1.9/ROS_Motor_and_Sensor_Plugins#Openni_Kinect

But I keep getting the following error.

 Error [Model.cc:761] Model[robot] is attempting to load a plugin, but detected an incorrect 
 plugin type. Plugin filename[libgazebo_ros_openni_kinect.so] name[head_camera_controller]
 gzserver: /usr/include/boost/smart_ptr/shared_ptr.hpp:418: T* boost::shared_ptr<T>::operator->()
 const [with T = gazebo::sensors::Sensor]: Assertion `px != 0' failed.

In my URDF, I have the following listed at the end of the file after gazebo robot joint are referenced.

<gazebo>
  <plugin name="head_camera_controller" filename="libgazebo_ros_openni_kinect.so">
    <baseline>0.2</baseline>
    <alwaysOn>true</alwaysOn>
    <updateRate>1.0</updateRate>
    <cameraName>head_camera_ir</cameraName>
    <imageTopicName>/head_camera/depth/image_raw</imageTopicName>
    <cameraInfoTopicName>/head_camera/depth/camera_info</cameraInfoTopicName>
    <depthImageTopicName>/head_camera/depth/image_raw</depthImageTopicName>
    <depthImageInfoTopicName>/head_camera/depth/camera_info</depthImageInfoTopicName>
    <pointCloudTopicName>/head_camera/depth/points</pointCloudTopicName>
    <frameName>/head_camera</frameName>
    <pointCloudCutoff>0.5</pointCloudCutoff>
    <distortionK1>0.00000001</distortionK1>
    <distortionK2>0.00000001</distortionK2>
    <distortionK3>0.00000001</distortionK3>
    <distortionT1>0.00000001</distortionT1>
    <distortionT2>0.00000001</distortionT2>
    <CxPrime>0</CxPrime>
    <Cx>0</Cx>
    <Cy>0</Cy>
    <focalLength>0</focalLength>
    <hackBaseline>0</hackBaseline>
  </plugin>
</gazebo>

Any ideas as to why I am getting this error?

It seems that I have an issue with gazebo sensor plugins. The joint controller plugins are working fine though...


Originally posted by ncr7 on Gazebo Answers with karma: 38 on 2013-10-12

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

There are different types of plugins, I think there are model-, sensor- and worldplugins.

libgazebo_ros_openni_kinect.so is a sensor plugin, and the way you have coded your URDF it is treated as a model plugin.

Let me show the difference:

<gazebo>
  <plugin>
  ...
  </plugin>
</gazebo>

defines a model plugin. But you need a sensor plugin. Try this:

<gazebo reference="my_sensor_link">
  <sensor>
     <plugin>
      ...
     </plugin>
  <sensor>
</gazebo>

My URDF for kinect cam looks like this:

<!-- SENSOR -->
<gazebo reference="openni_camera_link">
    <sensor type="depth" name="openni_camera_camera">       
        <always_on>1</always_on>
        <visualize>true</visualize>             
        <camera>
            <horizontal_fov>1.047</horizontal_fov>  
            <image>
                <width>640</width>
                <height>480</height>
                <format>R8G8B8</format>
            </image>
            <depth_camera>

            </depth_camera>
            <clip>
                <near>0.1</near>
                <far>100</far>
            </clip>
        </camera>
        <plugin name="camera_controller" filename="libgazebo_ros_openni_kinect.so">
            <alwaysOn>true</alwaysOn>
                <updateRate>10.0</updateRate>
                <cameraName>camera</cameraName>
                <frameName>openni_camera_link</frameName>                   
            <imageTopicName>rgb/image_raw</imageTopicName>
            <depthImageTopicName>depth/image_raw</depthImageTopicName>
            <pointCloudTopicName>depth/points</pointCloudTopicName>
            <cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName>              
            <depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName>            
            <pointCloudCutoff>0.4</pointCloudCutoff>                
                <hackBaseline>0.07</hackBaseline>
                <distortionK1>0.0</distortionK1>
                <distortionK2>0.0</distortionK2>
                <distortionK3>0.0</distortionK3>
                <distortionT1>0.0</distortionT1>
                <distortionT2>0.0</distortionT2>
            <CxPrime>0.0</CxPrime>
            <Cx>0.0</Cx>
            <Cy>0.0</Cy>
            <focalLength>0.0</focalLength>
            </plugin>
    </sensor>
</gazebo>

Originally posted by psei with karma: 166 on 2013-10-14

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by ncr7 on 2013-10-14:
Thanks! that worked. I don't know if you had any issue with how the point cloud is getting displayed. I seem to have the Kinect collecting points along its x-axis but displaying them in rviz along the z-axis. I'm playing with the link joints rotation, but I don't think that will change the difference between the collection and display position.

Comment by psei on 2013-10-15:
If I understand you right, I had exact the same problem and I solved it as following: http://answers.gazebosim.org/question/4266/gazebo-15-libgazebo\_openni\_kinectso-pointcloud/

Comment by MahdiehNejati on 2015-11-12:
Thanks for your great answer! Helped me out a lot!

Comment by desmond13 on 2020-11-29:
I had this problem with a gps_plugin. It seemed that I solved the error by following your solution. However, it is true that I am not having anymore the error but the plugin is not working well anymore.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.