ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

‘SensorManager’ is not a member of ‘gazebo::sensors’

asked 2018-08-01 08:24:49 -0500

Cler gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2018-08-01 19:41:37 -0500

stevejp gravatar image

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();

edit flag offensive delete link more

Comments

Yep that was it, I feel stupid. Thanks for the help.

Cler gravatar image Cler  ( 2018-08-01 20:37:58 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-08-01 08:24:49 -0500

Seen: 335 times

Last updated: Aug 01 '18