Hi, I am using gazebo to simulate a sonar. Thus I will use hector_sonar_plugin
. While after I install the hector plugins from source and call it in my sdf, errors come.
At first, an error appear asking me to add libhector_sonar_plugin.so
to gazebo_ros package
.
I cannot understand it and thought it cannot find the plugin. Thus,I use
export GAZEBO_PLUGIN_PATH=`pwd`:$GAZEBO_PLUGIN_PATH
to add hector_plugin
folder into path, then more error come:
Error [Plugin.hh:156] Failed to load plugin libRayPlugin.so: libRayPlugin.so: cannot open shared object file: No such file or directory
[FATAL] [1464103865.820981859]: A ROS node for Gazebo has not been initialized, unable to load plugin. Load the Gazebo system plugin 'libgazebo_ros_api_plugin.so' in the gazebo_ros package)
Could someone tell me how to set the GAZEBO_PLUGIN_PATH
correctly (or reset it correctly)? And if I want to use plug-Ins such as hector's, what should I do? (just copy .so to the model folder or ...?)
I am using Indigo full desktop, and thus version should be gazebo2
as already mentioned previously you can see your current GAZEBO_PLUGIN_PATH by the command echo
$GAZEBO_PLUGIN_PATH
. The path should point directly to the folder where the .so file is located (for example the build folder).
the export
GAZEBO_PLUGIN_PATH=´pwd´:$GAZEBO_PLUGIN_PATH
doesn't overwrite the path it just append the current directory(pwd) to the variable. (you can also use $PWD which is handier) Resulting you have a mess after several tries. In addition, export is just temporary and depends on the current terminal. (don't confuse yourself with too many tabs / terminals)
To clean the variable use unset
GAZEBO_PLUGIN_PATH
, then check again the variable: echo
$GAZEBO_PLUGIN_PATH
(no nothing should be returned)
Now you have to navigate in terminal to the folder where the .so file is located (since pwd is the current folder). After using export
GAZEBO_PLUGIN_PATH=$PWD
your variable should be set correctly. (overwrites existing values)
If you want to append your path to the variable use export
GAZEBO_PLUGIN_PATH=$PWD:$GAZEBO_PLUGIN_PATH
.
(Hint: you can also set the path directly for example: export
GAZEBO_PLUGIN_PATH=/home/#USERNAME#/Documents/testplugin/build
)
To have the GAZEBO_PLUGIN_PATH permanent you can include the "export xx=xx" line into your ~/.bashrc
file
Edit/Remark:
The default gazebo plugins are loading since gazebo is sourcing its default environment variables before the start. This is carried out using the file /usr/share/gazebo/setup.sh
or /usr/share/gazebo-X.X/setup.sh
(the X.X is your respective gazebo version)
To be aware of this behavior and be able to see its default values, you can use source
/usr/share/gazebo/setup.sh
Again, to have this permanent in every console instance, add the line to your .bashrc file.
Comments
1
Thank you! I was quite confused why echo GAZEBO_PLUGIN_PATH just return a same name a same name, even if the gazebo default plugin setting still works. But at least I can use your method now.
wyxf007 ( )
add a comment