System plugin loading issue since gazebo-current 2.2.2-1~precise

Create issue
Issue #1076 closed
Andreas Bihlmaier created an issue

Since I upgraded Gazebo today, my System Plugins do not work anymore:

gzclient: /usr/include/boost/smart_ptr/shared_ptr.hpp:418: T* boost::shared_ptr<T>::operator->() const [with T = gazebo::rendering::Scene]: Assertion `px != 0' failed.

Stemming from:

  void
  GazeboMISGuiPlugin::Init()
  {
    std::cout << "------------------- GazeboMISGuiPlugin -------------------" << std::endl;
    rendering::ScenePtr scene = rendering::RenderEngine::Instance()->GetScene();
    Ogre::SceneManager* sceneManager = scene->GetManager();
    // ...
  }

Because GetScene() returns a NULL Pointer.

A similar issues exists for another System Plugin:

Error [PhysicsIface.cc:61] no worlds
Error [PhysicsIface.cc:75] Unable to find world by name in physics::get_world[]
Exception [PhysicsIface.cc:77] Unable to find world by name in physics::get_world(world_name)

coming from:

  void
  GazeboMISServerPlugin::Init()
  {
    std::cout << "------------------- GazeboMISServerPlugin -------------------" << std::endl;
    physics::WorldPtr world = physics::get_world();
    // ...
  }

Both plugins inherit from gazebo::SystemPlugin and are registered through GZ_REGISTER_SYSTEM_PLUGIN().

Both plugins work fine with previous package gazebo-current 2.2.1-1~precise.

My model plugins still work.

Comments (12)

  1. Jose Luis Rivero

    Thanks for the report Andreas. Is your code at any public repository so I can give it a try?

    @scpeters these errors remembers me the ones that we saw in the OsX port, right?

  2. Andreas Bihlmaier reporter

    A simplified version of the plugin (only removed unrelated code), can be found as catkin package gazebo_mis.

    Here is the relevant part of my .launch file:

      <!-- start gazebo server-->
      <node name="gazebo" pkg="gazebo_ros" type="$(arg script_type)" respawn="false" output="screen"
          args="$(arg command_arg1) $(arg command_arg2) -s libGazeboMISServerPlugin.so $(arg world_name)" />
    
      <!-- start gazebo client -->
      <group if="$(arg gui)">
        <node name="gazebo_gui" pkg="gazebo_ros" type="gzclient" respawn="false" output="screen"
            args="-g libGazeboMISGuiPlugin.so" />
      </group>
    
  3. Jose Luis Rivero

    Andreas, I'm unable to reproduce the error. Could you please upload to the repo a launch file that trigger the failure?

    Thanks.

  4. Andreas Bihlmaier reporter

    A stripped down launch files that causes the error can be found here. Also the same launch file without plugins (labor_common-no_plugins.launch) which does not cause any problems.

  5. Andreas Bihlmaier reporter

    Thanks for the hint.

    Your suggestion works for the server plugin (I register the event in Load() [Init() does not work, I guess because the world is already created at that point in time] and do my initialization in the callback). However, it does not work for the gui plugin because there is no such signal (which kind of makes sense, since the world is created before the gui). As a kind of workaround I use gui::Events::ConnectModelUpdate(), do my initialization on first callback and disconnect the signal.

    On my part the bug can be closed with the conclusion: Use event::Events::ConnectWorldCreated() for system plugin and do the gui::Events::ConnectModelUpdate() trick for gui plugins.

  6. Log in to comment