Home | Tutorials | Wiki | Issues
Ask Your Question
0

Light source on Gazebo/Fuerte

asked 2013-07-24 11:18:38 -0500

Modo gravatar image

Hi there,

I have the following issue related to spawning a light in RosGazebo in Fuerte. I have posted a similar question in the ROS forum but I have been adviced to post it here.

I have took a look to the following discussions, but nothing effective so far:

http://answers.ros.org/question/10648... http://answers.gazebosim.org/question... http://answers.ros.org/question/34829...

I want to do the following:

a ROS node, after receiving a message from someone (e.g. a robot), spawns a light(possibly directional) in a location of the environment. This happens during the execution of the simulation so not at the beginning when the environment is spawned.

We have already done it in the Gazebo stand alone version and with ROS Electric but we need to do it in ROS-Fuerte because we have developed a stack that we would like to exploit also with the turtlebot1 simulator.

It is possible to do that through the GUI but we are not able to that programmatically.

Any solution?

Thanks,

M.

edit retag flag offensive close merge delete

Comments

AndreiHaidu gravatar imageAndreiHaidu ( 2013-07-24 12:55:16 -0500 )edit

Thanks Andrei, but I am already involved in that discussion

Modo gravatar imageModo ( 2013-07-24 13:04:39 -0500 )edit

Andrei, I noticed it works doing that from the gui, so there is for sure a way to do that programmatically. Can you point where I can find the source code of the gui? I am looking for that but I can not find it. If I take a look at that it is likely I can find a way to correctly spawn a light

Modo gravatar imageModo ( 2013-07-24 13:18:16 -0500 )edit

in which gazebo version you want to do this? because as I saw you want to try it in 1.0.2, which how nate said is deprecated, if in a greater version then there are two examples in those answers which should work, one with the message the other via a visual plugin

AndreiHaidu gravatar imageAndreiHaidu ( 2013-07-24 14:52:39 -0500 )edit

unfortunately I do not have time to go with others (when/if there will be support for the turtlebot simulator we are already able to do these things with the latest version of gazebo). In the meanwhile I am trying with the solution you suggested, i.e. via plugin.

Modo gravatar imageModo ( 2013-07-24 15:39:17 -0500 )edit

but I have a problem, please take a look below

Modo gravatar imageModo ( 2013-07-24 15:50:47 -0500 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2013-07-24 15:46:35 -0500

Modo gravatar image

updated 2013-07-25 00:47:58 -0500

I have created the following plugin:

#include "gui/Gui.hh"
#include "rendering/rendering.hh"
#include "gazebo.hh"

    namespace gazebo
    {
      class SystemGUI : public SystemPlugin
      {
        private: rendering::UserCameraPtr userCam;
        public: void Load(int /*_argc*/, char ** /*_argv*/)
        {
        }

        private: void Init()
        {
          // Get a pointer to the active user camera
          this->userCam = gui::get_active_camera();
        }

      };
      GZ_REGISTER_SYSTEM_PLUGIN(SystemGUI)
    }

But unfortunately, after compiling it, I get at run time the following problem:

/opt/ros/fuerte/stacks/simulatorgazebo/gazebo/gazebo/bin/gzserver: symbol lookup error: ...../rosworkspace/lightPlugin/lib/liblightPlugin.so: undefined symbol: ZN6gazebo3gui17getactive_cameraEv

Any idea?

The manifest.xml is like this:

<package>
      <description brief="lightPlugin">

         lightPlugin

      </description>
      <author>maurizio</author>
      <license>BSD</license>
      <review status="unreviewed" notes=""/>
      <url>http://ros.org/wiki/lightPlugin</url>
      <depend package="gazebo"/>
     <export>
        <gazebo plugin_path="${prefix}/lib" gazebo_media_path="${prefix}" />
      </export>


    </package>
edit flag offensive delete link more

Comments

Hi, this could happen when you compile against different version of Gazebo and aafterwards you run it in another one. (e.g. when you run make, it builds against the Gazebo version which came with ROS, and afterwards you maybe try to run it against another version from source) If this could be the case, set up the CMakeLists file so that it compiles against the source version of gazebo here an example of the file: http://gazebosim.org/wiki/Tutorials/1.5/plugins/overview

AndreiHaidu gravatar imageAndreiHaidu ( 2013-07-24 16:29:39 -0500 )edit

and from the manifest file comment out the gazebo package, so it doesn't use the one that came with ROS, also setting up library paths: `http://answers.gazebosim.org/question/3476/gazebo-inserting-models-plugin-loading-error-fail/`

AndreiHaidu gravatar imageAndreiHaidu ( 2013-07-24 16:32:58 -0500 )edit
0

answered 2013-07-25 00:47:11 -0500

Modo gravatar image

updated 2013-07-25 00:50:53 -0500

Hi Andrei,

I do not use multiple versions of Gazebo, I just have installed ROS Fuerte version. I have modified the CMakeLists.txt file as you said. Removing the dependency from the manifest.xml doesn't allow the compilation of the plugin. Actually I made the following in order to compile:

  • originally, i.e. even before your suggestions, when trying to compile the plugin (the one copied above ), I got the following error:

/opt/ros/fuerte/stacks/simulatorgazebo/gazebo/gazebo/include/gazebo-1.0.2/gazebo/rendering/ContactVisual.hh:58:16: error: ‘transport’ does not name a type /opt/ros/fuerte/stacks/simulatorgazebo/gazebo/gazebo/include/gazebo-1.0.2/gazebo/rendering/ContactVisual.hh:59:16: error: ‘transport’ does not name a type

  • at this point, in ./gazebo/include/gazebo-1.0.2/gazebo/rendering/Visual.hh I added a line including transport.hh, i.e. /#include "transport/transport.hh"

  • after getting the plugin compiled, I got the error

Please also note that if I put just a printf in my plugin, i.e. without the line this->userCam = gui::getactivecamera(), the plugin works.

Is it possible that the error is related to the include I made? After all this could be related to the famous call to the personal camera... Probably I am missing something..

Thanks

edit flag offensive delete link more

Comments

Hi, you should update the other answers when answering so it's more organized, what I explained with the CMakeLists you should only do in the case you had both Gazebo versions installed, if you only have the one which came with ROS them switch back to the original way with the Manifest. From the error I see you are using Gazebo 1.0.2, which is deprecated, so it's not sure it will work since it is a really old version, you should install from source a newer version. Or via sudo-apt get install

AndreiHaidu gravatar imageAndreiHaidu ( 2013-07-25 01:11:58 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-07-24 11:18:38 -0500

Seen: 1,417 times

Last updated: Jul 25 '13