0
$\begingroup$

Rosanswers logo

As said in the title I am getting thrown the following error: ‘SensorManager’ is not a member of ‘gazebo::sensors’

I am running ROS Kinetic with Gazebo 7 on Ubuntu 16.04

My GCC version is "gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609"

Other people who have had this problem have a linking problem in the CMakelists file, but I've gone over it a few times and can't spot the problem. Any help would be appreciated.

The function is in a world plugin -

int getNumberOfWalls()
{
    //Get  bumpsensor
    gazebo::sensors::SensorManager mgr = sensors::SensorManager::Instance();

}

Here is my CMakeLists.txt

cmake_minimum_required(VERSION 2.8.7)
project(weaselball_gazebo)
add_compile_options(-std=c++11)

find_package(catkin REQUIRED COMPONENTS 
  roscpp 
  gazebo_ros 
)

find_package(gazebo REQUIRED)
#------------------------------------------------------------------------------
## Dependencies
include( FindPkgConfig )
if( PKG_CONFIG_FOUND )
  pkg_check_modules( GAZEBO REQUIRED gazebo )
endif()
message (${GAZEBO_LIBRARY_DIRS})
link_directories( ${GAZEBO_LIBRARY_DIRS} )
include_directories( ${GAZEBO_INCLUDE_DIRS} )

#if( PKG_CONFIG_FOUND )
#  pkg_check_modules( RAVELIN ravelin )
#endif()
#include_directories( ${RAVELIN_INCLUDE_DIRS} )
#link_directories( ${RAVELIN_LIBRARY_DIRS} )

include (FindPkgConfig)
if (PKG_CONFIG_FOUND)
  pkg_check_modules(GAZEBO gazebo)
  pkg_check_modules(OGRE OGRE)
  pkg_check_modules(OGRE-Terrain OGRE-Terrain)
endif()
link_directories(${GAZEBO_LIBRARY_DIRS} ${OGRE_LIBRARY_DIRS})
include_directories(${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS} ${GAZEBO_INCLUDE_DIRS} ${OGRE_INCLUDE_DIRS} ${OGRE-Terrain_INCLUDE_DIRS})


    #------------------------------------------------------------------------------
    ## Code
    set( LIBS 
      ${GAZEBO_LIBRARIES} 
  ${RAVELIN_LIBRARIES}
  libRavelin.so
) 

set( HDRS 
  include/common.h
  include/math.h
  include/log.h
  include/state.h
  include/virtual_time.h
  include/vicon.h
  include/video.h
  include/movie.h
  include/models.h
  include/weazelball.h
  include/gazebo_log.h
  include/bumpSensor.h
)

set( SRCS
)


add_library(configure SHARED plugins/initConditionHandler.cpp)
target_link_libraries(configure ${GAZEBO_LIBRARIES})

add_library(StateRecorder SHARED plugins/stateRecorder.cpp)
target_link_libraries(StateRecorder ${GAZEBO_LIBRARIES} ${CATKIN_LIBRARIES})


#This plugin is still being developed...
#add_library(bumpSensor SHARED src/bumpSensor.cpp)
#target_link_libraries(bumpSensor ${GAZEBO_LIBRARIES})

#target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${GAZEBO_LIBRARIES})

add_library( simulation-controller SHARED plugins/simulation_controller.cpp ${HDRS} ${SRCS} )
target_link_libraries( simulation-controller ${LIBS} )

catkin_package(
  DEPENDS 
    roscpp 
    gazebo_ros 
)

echoing the GAZEBO_LIBRARY_DIRS gave me:

/usr/lib/x86_64-linux-gnu/gazebo-7/plugins/usr/lib/x86_64-linux-gnu/usr/lib/x86_64-linux-gnu/gazebo-7/plugins/usr/lib/x86_64-linux-gnu

and finally my package.xml -

<?xml version="1.0"?>
<package format="2">
  <name>weaselball_gazebo</name>
  <version>0.0.0</version>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <build_depend>gazebo_ros</build_depend>
  <exec_depend>gazebo_ros</exec_depend>
  <build_export_depend>gazebo</build_export_depend>
  <exec_depend>gazebo</exec_depend>


  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->

  <gazebo_ros plugin_path="${prefix}/lib" gazebo_media_path="${prefix}" />

  </export>
</package>

Once again any help would be appreciated.


Originally posted by Cler on ROS Answers with karma: 1 on 2018-08-01

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Can you verify that you are including <gazebo-7/gazebo/sensors/SensorManager.hh>? Also try changing your line to gazebo::sensors::SensorManager *mgr = gazebo::sensors::SensorManager::Instance();


Originally posted by stevejp with karma: 929 on 2018-08-01

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Cler on 2018-08-01:
Yep that was it, I feel stupid. Thanks for the help.

$\endgroup$

Your Answer

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