Home | Tutorials | Wiki | Issues
Ask Your Question
0

gazebo standalone ROS plugin crashes

asked 2013-04-24 04:34:04 -0500

peshala gravatar image

updated 2013-04-24 04:45:46 -0500

Hello all,

I am using gazebo 1.7.1 standalone with Ros-Groovy and I want to write a plugin that works with ROS.

Actually, I wanted to recreate the plugin found @ simulator_gazebo/gazebo_plugins/src/gazebo_ros_p3d.cpp and I followed the tutorial at http://gazebosim.org/wiki/Tutorials/1.5/ros_enabled_model_plugin even though it states "This tutorial may not work with Gazebo Quantal and Ros-Groovy"

When my model (with the plugin) is inserted, standalone gazebo crashes with gazebo: symbol lookup error: ../my_gazebo_plugins/lib/libmy_gazebo_ros_p3d.so: undefined symbol: _ZN2tf7resolveERKSsS. (gdb gazebo is not working)

According to the tutorial, I have created rospack.cmake, CMakeLists.txt, and GAZEBO_PLUGIN_PATH is appended. My manifest.xml includes only <depend package="roscpp"/> Also I am still using the rosbuild not catkin.

What am I missing?

Thanks in advance

Peshala

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-04-25 00:01:39 -0500

peshala gravatar image

Here is how I resolved the problem. I am describing the steps for GazeboRosP3D.

  • create your package just like a regular ROS package. I am still using rosbuild by the way.

  • pull the gazebo_ros_p3d.h and gazebo_ros_p3d.cpp from simulator_gazebo/gazebo_plugins and change the .cpp file to include the correct header (e.g. #include <my_gazebo_plugins/gazebo_ros_p3d.h>

  • change your CMakeLists.txt as described by @AndreiHaidu in his answer. Also, add the

    rosbuild_add_library(my_gazebo_ros_p3d src/gazebo_ros_p3d.cpp)

    rosbuild_add_boost_directories()

    rosbuild_link_boost(my_gazebo_ros_p3d thread)

  • change the manifest by adding

    <depend package="tf"> <!-- this is needed for p3d plugin -->

  • in your model.sdf add

    <plugin filename="libmy_gazebo_ros_p3d.so" name="my_gazebo_ros_p3d"> <bodyName>chassis</bodyName> <topicName>/ground_truth_odom</topicName> <alwaysOn>true</alwaysOn> <updateRate>100.0</updateRate> <gaussianNoise>0.0</gaussianNoise> <frameName>map</frameName> <xyzOffset>0 0 0</xyzOffset> <rpyOffset>0 0 0</rpyOffset> </plugin>

  • append the plugin path at /usr/share/gazebo-1.7/setup.sh by modifying

    export GAZEBO_PLUGIN_PATH=/usr/lib/gazebo-1.7/plugins:<your plugin path>/my_gazebo_plugins/lib

  • source the gazebo setup.sh file

Based on the plugin, you may add different packages in the manifest.

edit flag offensive delete link more

Comments

also change DisconnectWorldUpdateStart to DisconnectWorldUpdateBegin in your .cpp file. This is described in https://bitbucket.org/osrf/drcsim/commits/7070d7a926eb930f0b9cd00534f38f2ecc99ced7

peshala gravatar imagepeshala ( 2013-04-25 00:03:30 -0500 )edit
0

answered 2013-04-24 05:37:55 -0500

AndreiHaidu gravatar image

Hi,

A similar error used to appear if you build your plugin against one version of gazebo (for example the binary version that came with ROS) and then you run it on a different version (your case gazebo 1.7.1).

Even though this shouldn't happen if you don't have gazebo added as a dependency in your manifest.xml file.

If you think this could be the case, you should try adding the following lines to the CMakeLists.txt file in your rospackage in order to build against Gazebo 1.7.1.

## link to gazebo libraries 
include (FindPkgConfig)
if (PKG_CONFIG_FOUND)
  pkg_check_modules(GAZEBO gazebo)
endif()
include_directories(${GAZEBO_INCLUDE_DIRS})
link_directories(${GAZEBO_LIBRARY_DIRS})

Cheers, Andrei

edit flag offensive delete link more

Comments

Thank you for your comment. However, I already have this in my CMakeLists.txt

peshala gravatar imagepeshala ( 2013-04-24 05:47:59 -0500 )edit

if you run $ ldd /<path>/mygazeboplugins/lib/libmygazeboros_p3d.so , do you get some libraries that are from the gazebo which came from ROS ?

AndreiHaidu gravatar imageAndreiHaidu ( 2013-04-24 05:58:54 -0500 )edit

no. I do not have any libraries related to gazebo at all. should I get any from gazebo 1.7.1?

peshala gravatar imagepeshala ( 2013-04-24 06:04:14 -0500 )edit

I remembered that once this is how I checked against which libraries it builds against, and I got the gazebo from groovy, but if you don't get anything like that then it is fine.

AndreiHaidu gravatar imageAndreiHaidu ( 2013-04-24 06:30:43 -0500 )edit

Thank you for your reply. Now I did a ldd libgazeborosp3d.so for the original plugin in simulatorgazebo and found out it is depending on shared libraries like libgazebophysics.so.1, libgazebosensors.so.1, libgazebosdf_interface.so.1 and so on. So, I guess I have to make the same thing happen (make my plugin depend on standalone shared libraries) for my plugin. But, how should I do that?

peshala gravatar imagepeshala ( 2013-04-24 06:41:06 -0500 )edit

hmm.. i am not sure, but an easy way to be sure that you don't use libraries from the ROS gazebo would be to uninstall it, and if after the uninstall you get errors with missing libraries you know that was the problem, and then you try to link those against the new gazebo

AndreiHaidu gravatar imageAndreiHaidu ( 2013-04-24 07:21:09 -0500 )edit

you should make sure that the gazebo.pc being used is the one for 1.7.1 (it may be finding the older one first)

SL Remy gravatar imageSL Remy ( 2013-04-24 07:54:51 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-04-24 04:34:04 -0500

Seen: 771 times

Last updated: Apr 25 '13