Publishing multiple Hokuyo lasers sensor reading to a topic by writing and compiling a plugin

asked 2013-07-22 04:01:21 -0500

mozcelikors gravatar image

Hello,

I'm a beginner when it comes to Gazebo. I'm trying to make my own robot by following the 1.5 tutorials. I was able to add 5 hokuyo lasers, by simply including sensor tags, to my Gazebo model. Moreover, I was able to find and manipulate a plugin written for those rays. So now, I have a robot/model.sdf and robot/model.config file and it works all right. However, I don't know how to compile my librobotrayplugin.cc file by manipulating CMakeLists.txt. My Gazebo path is /usr/share/gazebo-1.8/plugins. I found this CMake file but don't know how to manipulate it. In addition, my $GAZEBOINCLUDEDIRS, $GAZEBOLIBRARYDIRS, $CMAKEINSTALLDIRS, (underscored versions) and $GAZEBO_LIBRARIES variables are seem to return NULL value even though I've executed /usr/share/gazebo-1.8/setup.sh. P.S: I'm executing gazebo by the following command, and have my .world file in there.

rosrun gazebo_ros gazebo

Here is my CMakeLists.txt for the sensor plugin that I don't know how to use:

cmake_minimum_required(VERSION 2.8)

include (FindPkgConfig)
if (PKG_CONFIG_FOUND)
  pkg_check_modules(GAZEBO gazebo REQUIRED)
else()
  message(FATAL_ERROR "pkg-config is required; please install it")
endif()

include_directories(${GAZEBO_INCLUDE_DIRS})
include_directories(/home/user/rosplugin/)
link_directories(${GAZEBO_LIBRARY_DIRS})

include(cmake/rospack.cmake)

get_rospack_flags(roscpp)
include_directories(${roscpp_INCLUDE_DIRS})
link_directories(${roscpp_LIBRARY_DIRS})
set(CMAKE_INSTALL_RPATH "${roscpp_LIBRARY_DIRS}")
add_library(ros_model_plugin SHARED ros_model_plugin.cc)
set_target_properties(ros_model_plugin PROPERTIES COMPILE_FLAGS "${roscpp_CFLAGS_OTHER}")
set_target_properties(ros_model_plugin PROPERTIES LINK_FLAGS "${roscpp_LDFLAGS_OTHER}")
target_link_libraries(ros_model_plugin ${roscpp_LIBRARIES})
install (TARGETS ros_model_plugin DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/gazebo_plugins/)

I don't know what to do. Any answer will be much appreciated

edit retag flag offensive close merge delete