Gazebo | Ignition | Community
Ask Your Question

Adrien Thibault's profile - activity

2017-03-06 16:40:36 -0600 received badge  Enthusiast
2017-02-28 16:02:00 -0600 asked a question Error Plugin libgazebo_ros_camera.so

Hi, I am trying to implement a basic camera using ROS (Kinetic) and Gazebo (v 7.5).

I need the ROS plugin to publish my frames on a rostopic. I am using the SDF standard and not URDF.

I had trouble finding such a plugin. First I tried to compile it myself from the sources found there using this CMakeLists.txt :

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

project(ros_gazebo_camera)

include_directories(${roscpp_INCLUDE_DIRS})
include_directories(${std_msgs_INCLUDE_DIRS})

link_directories(${roscpp_LIBRARY_DIRS})
link_directories(${std_msgs_LIBRARY_DIRS})

# Find Gazebo
find_package(gazebo REQUIRED)
include_directories(${GAZEBO_INCLUDE_DIRS})
link_directories(${GAZEBO_LIBRARY_DIRS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")

# Build our plugins
add_library(gazebo_ros_camera_utils gazebo_ros_camera_utils.cpp)
add_dependencies(gazebo_ros_camera_utils ${PROJECT_NAME}_gencfg)
target_link_libraries(gazebo_ros_camera_utils ${GAZEBO_LIBRARIES} ${catkin_LIBRARIES} ${Boost_LIBRARIES})

add_library(gazebo_ros_camera gazebo_ros_camera.cpp)
add_dependencies(gazebo_ros_camera ${PROJECT_NAME}_gencfg)
target_link_libraries(gazebo_ros_camera gazebo_ros_camera_utils ${GAZEBO_LIBRARIES} CameraPlugin    ${catkin_LIBRARIES})

It created the shared library, but when using it in this SDF model

<?xml version="1.0"?>
<sdf version="1.5">
<world name="default">
<!-- A global light source -->
    <include>
        <uri>model://sun</uri>
    </include>

    <!-- A ground plane -->
    <include>
        <uri>model://ground_plane</uri>
    </include>

    <!-- A testing model that includes the camera sensor model -->
    <model name="my_camera">
        <include>
            <uri>model://camera</uri>
        </include>

        <!-- Attach the plugin to this model -->
        <plugin name='CameraPlugin' filename='libgazebo_ros_camera.so'/>

    </model>    

</world>

</sdf>

using the command

gazebo --verbose ../camera.world

But after launching successfuly Gazebo I received the error

[Err] [Plugin.hh:165] Failed to load plugin libCameraPlugin.so: /home/adrien/camera_plugin/build/libCameraPlugin.so: undefined symbol: _ZTIN6gazebo12CameraPluginE

From different forums I found it meant that my linkage was not done properly in the CMakeLists.txt. I haven't been able to solve this.

I finally compile gazebo_ros_pkgs. The compilation provides many plugins including the one interesting me : libgazebo_ros_camera.so

But when using this library as the plugin of my camera in my SDF world file I receive the following error after launching Gazebo :

[Err] [Model.cc:1058] Model[my_camera] is attempting to load a plugin, but detected an incorrect plugin type. Plugin filename[libgazebo_ros_camera.so] name[CameraPlugin]

So far I have no idea of what that error means.

I would appreciate any help !

Thanks in advance,

Adrien.