Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

Visual plugin crashes before its constructor executes

Last week, my plugins were working. Without having changed anything, this week the visual plugin crashes.

Here's the error:

gzclient: /usr/include/boost/smart_ptr/shared_ptr.hpp:653: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::rendering::Camera; typename boost::detail::sp_member_access<T>::type = gazebo::rendering::Camera*]: Assertion `px != 0' failed.
Aborted (core dumped)

Here are the only files necessary to reproduce the crash:

Visual plugin:

#include <gazebo/gazebo.hh>
#include <gazebo/common/common.hh>
#include <gazebo/rendering/rendering.hh>
#include <stdio.h>

namespace gazebo
{ class SpacenavVisualPlugin : public VisualPlugin
  { public: 

      // Constructor
      SpacenavVisualPlugin() : VisualPlugin()
      { printf( "SpacenavVisualPlugin started\n" ); // DEBUG
      }

      // Destructor
      ~SpacenavVisualPlugin() // : ~VisualPlugin()
      { printf( "SpacenavVisualPlugin stopped\n" ); // DEBUG
      }

      void Load( rendering::VisualPtr _visual, sdf::ElementPtr /*_sdf*/)
      { // === Turn off the SpaceNavigator's default camera control
        rendering::ScenePtr scene = _visual->GetScene();
        rendering::UserCameraPtr cam = scene->GetUserCamera( 0 );
        cam->SetJoyPoseControl( false );
        cam->SetJoyTwistControl( false );
      }
  };

  // Register this plugin with the simulator
  GZ_REGISTER_VISUAL_PLUGIN( SpacenavVisualPlugin )
};

World file:

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">

    <include>
      <uri>model://ground_plane</uri>
    </include>

    <include>
      <uri>model://sun</uri>
    </include>

    <!-- model just to hold plugin that turns off spacenav camera control  -->
    <model name="dummy_model">
      <link name="dummy">
        <collision name="collision">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
          <plugin name="spacenavVisualPlugin" filename="/media/jason/Lexar/Code_samples/gazebo_plugin_tutorial/build/libspacenavVisualPlugin.so"/>
        </visual>
      </link>
    </model>

  </world>
</sdf>

The commands I run are gzserver test.world and, in a separate terminal window, gzclient.

Here is the question where I describe the need for the visual plugin. It seems to be related to this question, i.e., the plugin is somehow running before the rendering engine is initialized, but I don't know of any other way other than the visual plugin.

Visual plugin crashes before its constructor executes

Last week, my plugins were working. Without having changed anything, this week the visual plugin crashes.

Here's the error:

gzclient: /usr/include/boost/smart_ptr/shared_ptr.hpp:653: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::rendering::Camera; typename boost::detail::sp_member_access<T>::type = gazebo::rendering::Camera*]: Assertion `px != 0' failed.
Aborted (core dumped)

Here are the only files necessary to reproduce the crash:

Visual plugin:

#include <gazebo/gazebo.hh>
#include <gazebo/common/common.hh>
#include <gazebo/rendering/rendering.hh>
#include <stdio.h>

namespace gazebo
{ class SpacenavVisualPlugin : public VisualPlugin
  { public: 

      // Constructor
      SpacenavVisualPlugin() : VisualPlugin()
      { printf( "SpacenavVisualPlugin started\n" ); // DEBUG
      }

      // Destructor
      ~SpacenavVisualPlugin() // : ~VisualPlugin()
      { printf( "SpacenavVisualPlugin stopped\n" ); // DEBUG
      }

      void Load( rendering::VisualPtr _visual, sdf::ElementPtr /*_sdf*/)
      { // === Turn off the SpaceNavigator's default camera control
        rendering::ScenePtr scene = _visual->GetScene();
        rendering::UserCameraPtr cam = scene->GetUserCamera( 0 );
        cam->SetJoyPoseControl( false );
        cam->SetJoyTwistControl( false );
      }
  };

  // Register this plugin with the simulator
  GZ_REGISTER_VISUAL_PLUGIN( SpacenavVisualPlugin )
};

World file:

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">

    <include>
      <uri>model://ground_plane</uri>
    </include>

    <include>
      <uri>model://sun</uri>
    </include>

    <!-- model just to hold plugin that turns off spacenav camera control  -->
    <model name="dummy_model">
      <link name="dummy">
        <collision name="collision">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
          <plugin name="spacenavVisualPlugin" filename="/media/jason/Lexar/Code_samples/gazebo_plugin_tutorial/build/libspacenavVisualPlugin.so"/>
filename="/home/jason/libspacenavVisualPlugin.so"/>
        </visual>
      </link>
    </model>

  </world>
</sdf>

The commands I run are gzserver test.world and, in a separate terminal window, gzclient.

Here is the question where I describe the need for the visual plugin. It The problem seems to be related to this question, ; i.e., the plugin is somehow running before the rendering engine is initialized, but I don't know of any other way to turn off the Space Navigator other than the visual plugin.

Visual plugin crashes before its constructor executes

Last week, my plugins were working. Without having changed anything, this week the visual plugin crashes.crashes. Does anyone have any insights into what's going on or how to fix this?

Here's the error:

gzclient: /usr/include/boost/smart_ptr/shared_ptr.hpp:653: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::rendering::Camera; typename boost::detail::sp_member_access<T>::type = gazebo::rendering::Camera*]: Assertion `px != 0' failed.
Aborted (core dumped)

Here are the only files necessary to reproduce the crash:

Visual plugin:

#include <gazebo/gazebo.hh>
#include <gazebo/common/common.hh>
#include <gazebo/rendering/rendering.hh>
#include <stdio.h>

namespace gazebo
{ class SpacenavVisualPlugin : public VisualPlugin
  { public: 

      // Constructor
      SpacenavVisualPlugin() : VisualPlugin()
      { printf( "SpacenavVisualPlugin started\n" ); // DEBUG
      }

      // Destructor
      ~SpacenavVisualPlugin() // : ~VisualPlugin()
      { printf( "SpacenavVisualPlugin stopped\n" ); // DEBUG
      }

      void Load( rendering::VisualPtr _visual, sdf::ElementPtr /*_sdf*/)
      { // === Turn off the SpaceNavigator's default camera control
        rendering::ScenePtr scene = _visual->GetScene();
        rendering::UserCameraPtr cam = scene->GetUserCamera( 0 );
        cam->SetJoyPoseControl( false );
        cam->SetJoyTwistControl( false );
      }
  };

  // Register this plugin with the simulator
  GZ_REGISTER_VISUAL_PLUGIN( SpacenavVisualPlugin )
};

World file:

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">

    <include>
      <uri>model://ground_plane</uri>
    </include>

    <include>
      <uri>model://sun</uri>
    </include>

    <!-- model just to hold plugin that turns off spacenav camera control  -->
    <model name="dummy_model">
      <link name="dummy">
        <collision name="collision">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
          <plugin name="spacenavVisualPlugin" filename="/home/jason/libspacenavVisualPlugin.so"/>
        </visual>
      </link>
    </model>

  </world>
</sdf>

The commands I run are gzserver test.world and, in a separate terminal window, gzclient.

Here is the question where I describe the need for the visual plugin. The problem seems to be related to this question; i.e., the plugin is somehow running before the rendering engine is initialized, but I don't know of any other way to turn off the Space Navigator other than the visual plugin.

Visual plugin crashes before its constructor executes

Last week, my plugins were working. Without having changed anything, this week the visual plugin crashes. Does anyone have any insights into what's going on or how to fix this?this? Does anyone else get the same error on compiling the plugin and using it with the world file below?

Here's the error:

gzclient: /usr/include/boost/smart_ptr/shared_ptr.hpp:653: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::rendering::Camera; typename boost::detail::sp_member_access<T>::type = gazebo::rendering::Camera*]: Assertion `px != 0' failed.
Aborted (core dumped)

Here are the only files necessary to reproduce the crash:

Visual plugin:

#include <gazebo/gazebo.hh>
#include <gazebo/common/common.hh>
#include <gazebo/rendering/rendering.hh>
#include <stdio.h>

namespace gazebo
{ class SpacenavVisualPlugin : public VisualPlugin
  { public: 

      // Constructor
      SpacenavVisualPlugin() : VisualPlugin()
      { printf( "SpacenavVisualPlugin started\n" ); // DEBUG
      }

      // Destructor
      ~SpacenavVisualPlugin() // : ~VisualPlugin()
      { printf( "SpacenavVisualPlugin stopped\n" ); // DEBUG
      }

      void Load( rendering::VisualPtr _visual, sdf::ElementPtr /*_sdf*/)
      { // === Turn off the SpaceNavigator's default camera control
        rendering::ScenePtr scene = _visual->GetScene();
        rendering::UserCameraPtr cam = scene->GetUserCamera( 0 );
        cam->SetJoyPoseControl( false );
        cam->SetJoyTwistControl( false );
      }
  };

  // Register this plugin with the simulator
  GZ_REGISTER_VISUAL_PLUGIN( SpacenavVisualPlugin )
};

World file:

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">

    <include>
      <uri>model://ground_plane</uri>
    </include>

    <include>
      <uri>model://sun</uri>
    </include>

    <!-- model just to hold plugin that turns off spacenav camera control  -->
    <model name="dummy_model">
      <link name="dummy">
        <collision name="collision">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
          <plugin name="spacenavVisualPlugin" filename="/home/jason/libspacenavVisualPlugin.so"/>
        </visual>
      </link>
    </model>

  </world>
</sdf>

The commands I run are gzserver test.world and, in a separate terminal window, gzclient.

Here is the question where I describe the need for the visual plugin. The problem seems to be related to this question; i.e., the plugin is somehow running before the rendering engine is initialized, but I don't know of any other way to turn off the Space Navigator other than the visual plugin.

Visual plugin crashes before its constructor executes

Last week, my plugins were working. Without having changed anything, this week the visual plugin crashes. Does anyone have any insights into what's going on or how to fix this? Does anyone else get the same error on compiling the plugin and using it with the world file below?

Here's the error:

gzclient: /usr/include/boost/smart_ptr/shared_ptr.hpp:653: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::rendering::Camera; typename boost::detail::sp_member_access<T>::type = gazebo::rendering::Camera*]: Assertion `px != 0' failed.
Aborted (core dumped)

Here are the only files necessary to reproduce the crash:

Visual plugin:

#include <gazebo/gazebo.hh>
#include <gazebo/common/common.hh>
#include <gazebo/rendering/rendering.hh>
#include <stdio.h>

namespace gazebo
{ class SpacenavVisualPlugin : public VisualPlugin
  { public: 

      // Constructor
      SpacenavVisualPlugin() : VisualPlugin()
      { printf( "SpacenavVisualPlugin started\n" ); // DEBUG
      }

      // Destructor
      ~SpacenavVisualPlugin() // : ~VisualPlugin()
      { printf( "SpacenavVisualPlugin stopped\n" ); // DEBUG
      }

      void Load( rendering::VisualPtr _visual, sdf::ElementPtr /*_sdf*/)
      { // === Turn off the SpaceNavigator's default camera control
        rendering::ScenePtr scene = _visual->GetScene();
        rendering::UserCameraPtr cam = scene->GetUserCamera( 0 );
        cam->SetJoyPoseControl( false );
        cam->SetJoyTwistControl( false );
      }
  };

  // Register this plugin with the simulator
  GZ_REGISTER_VISUAL_PLUGIN( SpacenavVisualPlugin )
};

World file:

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">

    <include>
      <uri>model://ground_plane</uri>
    </include>

    <include>
      <uri>model://sun</uri>
    </include>

    <!-- model just to hold plugin that turns off spacenav camera control  -->
    <model name="dummy_model">
      <link name="dummy">
        <collision name="collision">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
          <plugin name="spacenavVisualPlugin" filename="/home/jason/libspacenavVisualPlugin.so"/>
        </visual>
      </link>
    </model>

  </world>
</sdf>

The commands I run are gzserver test.world and, in a separate terminal window, gzclient.. The abort back to the prompt happens almost immediately after the second command, just a split second after the gazebo splash screen and the main window are drawn. Then I can quit the first command in its terminal window with CTRL-c.

Here is the question where I describe the need for the visual plugin. The problem seems to be related to this question; i.e., the plugin is somehow running before the rendering engine is initialized, but I don't know of any other way to turn off the Space Navigator other than the visual plugin.

Visual plugin crashes before its constructor executes

Last week, my plugins were working. Without having changed anything, this week the visual plugin crashes. Does anyone have any insights into what's going on or how to fix this? Does anyone else get the same error on compiling the plugin and using it with the world file below?

Here's the error:

gzclient: /usr/include/boost/smart_ptr/shared_ptr.hpp:653: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::rendering::Camera; typename boost::detail::sp_member_access<T>::type = gazebo::rendering::Camera*]: Assertion `px != 0' failed.
Aborted (core dumped)

Here are the only files necessary to reproduce the crash:

Visual plugin:

#include <gazebo/gazebo.hh>
#include <gazebo/common/common.hh>
#include <gazebo/rendering/rendering.hh>
#include <stdio.h>

namespace gazebo
{ class SpacenavVisualPlugin : public VisualPlugin
  { public: 

      // Constructor
      SpacenavVisualPlugin() : VisualPlugin()
      { printf( "SpacenavVisualPlugin started\n" ); // DEBUG
      }

      // Destructor
      ~SpacenavVisualPlugin() // : ~VisualPlugin()
      { printf( "SpacenavVisualPlugin stopped\n" ); // DEBUG
      }

      void Load( rendering::VisualPtr _visual, sdf::ElementPtr /*_sdf*/)
      { // === Turn off the SpaceNavigator's default camera control
        rendering::ScenePtr scene = _visual->GetScene();
        rendering::UserCameraPtr cam = scene->GetUserCamera( 0 );
        cam->SetJoyPoseControl( false );
        cam->SetJoyTwistControl( false );
      }
  };

  // Register this plugin with the simulator
  GZ_REGISTER_VISUAL_PLUGIN( SpacenavVisualPlugin )
};

World file:

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">

    <include>
      <uri>model://ground_plane</uri>
    </include>

    <include>
      <uri>model://sun</uri>
    </include>

    <!-- model just to hold plugin that turns off spacenav camera control  -->
    <model name="dummy_model">
      <link name="dummy">
        <collision name="collision">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
          <plugin name="spacenavVisualPlugin" filename="/home/jason/libspacenavVisualPlugin.so"/>
        </visual>
      </link>
    </model>

  </world>
</sdf>

The commands I run are gzserver test.world and, in a separate terminal window, gzclient. The abort back to the prompt happens almost immediately after the second command, just a split second after the gazebo splash screen and the main window are drawn. Then I can quit the first command in its terminal window with CTRL-c.

Here is the question where I describe the need for the visual plugin. The problem seems to be related to this question; i.e., the plugin is somehow running before the rendering engine is initialized, but I don't know of any other way to turn off the Space Navigator other than the visual plugin.

Visual plugin crashes before its constructor executesModifying GAZEBO_RESOURCE_PATH causes null pointer crash

Last week, my plugins were working. Without having changed anything, this week the visual plugin crashes. Does anyone have any insights into what's going on or how to fix this? Does anyone else get the same error on compiling the plugin and using it with the world file below?


[Edit Sept. 19 '16: I did change something, which I had forgotten about. As alluded to in the edited title of the question, I attempted to add a directory to the GAZEBO_RESOURCE_PATH in .bashrc -- see the issue URL in the comment below. This problem had nothing whatsoever to do with my visual plugin.]


Here's the error:

gzclient: /usr/include/boost/smart_ptr/shared_ptr.hpp:653: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::rendering::Camera; typename boost::detail::sp_member_access<T>::type = gazebo::rendering::Camera*]: Assertion `px != 0' failed.
Aborted (core dumped)

Here are the only files necessary to reproduce the crash:

Visual plugin:

#include <gazebo/gazebo.hh>
#include <gazebo/common/common.hh>
#include <gazebo/rendering/rendering.hh>
#include <stdio.h>

namespace gazebo
{ class SpacenavVisualPlugin : public VisualPlugin
  { public: 

      // Constructor
      SpacenavVisualPlugin() : VisualPlugin()
      { printf( "SpacenavVisualPlugin started\n" ); // DEBUG
      }

      // Destructor
      ~SpacenavVisualPlugin() // : ~VisualPlugin()
      { printf( "SpacenavVisualPlugin stopped\n" ); // DEBUG
      }

      void Load( rendering::VisualPtr _visual, sdf::ElementPtr /*_sdf*/)
      { // === Turn off the SpaceNavigator's default camera control
        rendering::ScenePtr scene = _visual->GetScene();
        rendering::UserCameraPtr cam = scene->GetUserCamera( 0 );
        cam->SetJoyPoseControl( false );
        cam->SetJoyTwistControl( false );
      }
  };

  // Register this plugin with the simulator
  GZ_REGISTER_VISUAL_PLUGIN( SpacenavVisualPlugin )
};

World file:

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">

    <include>
      <uri>model://ground_plane</uri>
    </include>

    <include>
      <uri>model://sun</uri>
    </include>

    <!-- model just to hold plugin that turns off spacenav camera control  -->
    <model name="dummy_model">
      <link name="dummy">
        <collision name="collision">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
          <plugin name="spacenavVisualPlugin" filename="/home/jason/libspacenavVisualPlugin.so"/>
        </visual>
      </link>
    </model>

  </world>
</sdf>

The commands I run are gzserver test.world and, in a separate terminal window, gzclient. The abort back to the prompt happens almost immediately after the second command, just a split second after the gazebo splash screen and the main window are drawn. Then I can quit the first command in its terminal window with CTRL-c.

Here is the question where I describe the need for the visual plugin. The problem seems to be related to this question; i.e., the plugin is somehow running before the rendering engine is initialized, but I don't know of any other way to turn off the Space Navigator other than the visual plugin.