GAZEBO_PLUGIN_PATH 设置方法

http://answers.gazebosim.org/question/13391/how-to-set-gazebo_plugin_path-correctly-and-add-the-plugin-into-gazebo_ros/

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.

link

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 gravatar imagewyxf007 ( )

add a comment

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值