Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is essentially a linking issue. With my library referencing hydcylinder.h, I had to ensure that make compiled hydcylinder.cpp and that my ros_plugin library was linked to that. To do this I had had to change CMakeLists.txt as follows: FROM:

add_library(ros_model_plugin SHARED src/HMMv2motors.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/)

TO: add_library(ros_model_plugin SHARED src/HMMv2motors.cc) add_library(hydcylinder SHARED src/hydcylinder.cpp)

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} hydcylinder )

install (TARGETS ros_model_plugin DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/gazebo_plugins/)
install (TARGETS hydcylinder DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/gazebo_plugins/)

The last install line may not be required. As I had problems between finding the plugin (which would only happen when I was launching gazebo from the gazebo_ros_plugin/build directory) to finding my mesh files (which would only occur when I was in my home directory. To resolve this I added gazebo_ros_plugin/build to my GAZEBO_PLUGIN_PATH and launched gazebo from my home directory.

if it would work within ROS that would be best. Cant wait for the 1.9 to be released.

This is essentially a linking issue. With my library referencing hydcylinder.h, I had to ensure that make compiled hydcylinder.cpp and that my ros_plugin library was linked to that. To do this I had had to change CMakeLists.txt as follows: follows:

FROM:

add_library(ros_model_plugin SHARED src/HMMv2motors.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/)

TO: TO:

add_library(ros_model_plugin SHARED src/HMMv2motors.cc)
 add_library(hydcylinder SHARED src/hydcylinder.cpp)

src/hydcylinder.cpp)

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} hydcylinder )

install (TARGETS ros_model_plugin DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/gazebo_plugins/)
install (TARGETS hydcylinder DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/gazebo_plugins/)

The last install line may not be required. As I had problems between finding the plugin (which would only happen when I was launching gazebo from the gazebo_ros_plugin/build directory) to finding my mesh files (which would only occur when I was in my home directory. To resolve this I added gazebo_ros_plugin/build to my GAZEBO_PLUGIN_PATH and launched gazebo from my home directory.

if it would work within ROS that would be best. Cant wait for the 1.9 to be released.