Setting Gui in System plugin and order of loading plugins

asked 2019-09-18 07:31:06 -0600

PeterHer gravatar image

I want to try to set the Gui while running the simulator like this:

namespace gazebo { class SystemGUI : public SystemPlugin {

private: rendering::UserCameraPtr userCam;
private: std::vector<event::ConnectionPtr> connections;

public: SystemGUI() : SystemPlugin() { }

public: virtual ~SystemGUI()
{
  this->connections.clear();
  this->userCam.reset();
}

public: void Load(int /*_argc*/, char ** /*_argv*/)
{
  this->connections.push_back(
      event::Events::ConnectPreRender(
        std::bind(&SystemGUI::Update, this)));
}

private: void Init()
{
}

private: void Update()
{

  if (!this->userCam)
  {
    this->userCam = gui::get_active_camera();

    if (this->userCam != NULL)
    {

      const ignition::math::Angle &yaw = 0;     
      this->userCam->Yaw(yaw);
    }
  }

  rendering::ScenePtr scene = rendering::get_scene();

  if (!scene || !scene->Initialized())
    return;

  if (scene->GetVisual("ground_plane"))
  {
    std::cout << "Has ground plane visual\n";
  }
}

};

GZ_REGISTER_SYSTEM_PLUGIN(SystemGUI) }

but unfortunately the Yaw is not set to 0. Any idea how I can set the Gui while my simulation is running? I run Gazebo like this: gzclient -g libsimulator_system.so

The main goal is to run the whole simulator like: roslaunch simulator_world simulator.launch My world file ends with:

<plugin name="simulator_system" filename="rifsimulator_system.so"/> <plugin name="simulator_world" filename="rifsimulator_world.so"/>

But this way the System plugin will exit prematurely Thanks in advance

edit retag flag offensive close merge delete