Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Render Engine Cmd Line #331

Merged
merged 9 commits into from
Sep 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions include/ignition/gazebo/ServerConfig.hh
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,23 @@ namespace ignition
/// \param[in] _physicsEngine File containing physics engine library.
public: void SetPhysicsEngine(const std::string &_physicsEngine);

/// \brief Render engine plugin library to load.
/// \return File containing render engine library.
public: const std::string &RenderEngineServer() const;

/// \brief Render engine plugin library to load.
/// \return File containing render engine library.
public: const std::string &RenderEngineGui() const;

/// \brief Set the render engine server plugin library.
/// \param[in] _renderEngine File containing render engine library.
public: void SetRenderEngineServer(
const std::string &_renderEngineServer);

/// \brief Set the render engine gui plugin library.
/// \param[in] _renderEngine File containing render engine library.
public: void SetRenderEngineGui(const std::string &_renderEngineGui);

/// \brief Instruct simulation to attach a plugin to a specific
/// entity when simulation starts.
/// \param[in] _info Information about the plugin to load.
Expand Down
44 changes: 44 additions & 0 deletions include/ignition/gazebo/components/RenderEngineGuiPlugin.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef IGNITION_GAZEBO_COMPONENTS_RENDERENGINEGUIPLUGIN_HH_
#define IGNITION_GAZEBO_COMPONENTS_RENDERENGINEGUIPLUGIN_HH_

#include <string>
#include <ignition/gazebo/components/Factory.hh>
#include <ignition/gazebo/components/Component.hh>
#include <ignition/gazebo/components/Serialization.hh>
#include <ignition/gazebo/config.hh>

namespace ignition
{
namespace gazebo
{
// Inline bracket to help doxygen filtering.
inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
namespace components
{
/// \brief Holds the render engine gui shared library.
using RenderEngineGuiPlugin = Component<std::string,
class RenderEngineGuiPluginTag, serializers::StringSerializer>;
IGN_GAZEBO_REGISTER_COMPONENT("ign_gazebo_components.RenderEngineGuiPlugin",
RenderEngineGuiPlugin)
}
}
}
}

#endif
45 changes: 45 additions & 0 deletions include/ignition/gazebo/components/RenderEngineServerPlugin.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef IGNITION_GAZEBO_COMPONENTS_RENDERENGINESERVERPLUGIN_HH_
#define IGNITION_GAZEBO_COMPONENTS_RENDERENGINESERVERPLUGIN_HH_

#include <string>
#include <ignition/gazebo/components/Factory.hh>
#include <ignition/gazebo/components/Component.hh>
#include <ignition/gazebo/components/Serialization.hh>
#include <ignition/gazebo/config.hh>

namespace ignition
{
namespace gazebo
{
// Inline bracket to help doxygen filtering.
inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
namespace components
{
/// \brief Holds the render engine server shared library.
using RenderEngineServerPlugin = Component<std::string,
class RenderEngineServerPluginTag, serializers::StringSerializer>;
IGN_GAZEBO_REGISTER_COMPONENT(
"ign_gazebo_components.RenderEngineServerPlugin",
RenderEngineServerPlugin)
}
}
}
}

#endif
10 changes: 10 additions & 0 deletions src/LevelManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#include "ignition/gazebo/components/PerformerLevels.hh"
#include "ignition/gazebo/components/PhysicsEnginePlugin.hh"
#include "ignition/gazebo/components/Pose.hh"
#include "ignition/gazebo/components/RenderEngineGuiPlugin.hh"
#include "ignition/gazebo/components/RenderEngineServerPlugin.hh"
#include "ignition/gazebo/components/Scene.hh"
#include "ignition/gazebo/components/Wind.hh"
#include "ignition/gazebo/components/World.hh"
Expand Down Expand Up @@ -98,6 +100,14 @@ void LevelManager::ReadLevelPerformerInfo()
components::PhysicsEnginePlugin(
this->runner->serverConfig.PhysicsEngine()));

this->runner->entityCompMgr.CreateComponent(this->worldEntity,
components::RenderEngineServerPlugin(
this->runner->serverConfig.RenderEngineServer()));

this->runner->entityCompMgr.CreateComponent(this->worldEntity,
components::RenderEngineGuiPlugin(
this->runner->serverConfig.RenderEngineGui()));

auto worldElem = this->runner->sdfWorld->Element();

// Create Wind
Expand Down
34 changes: 34 additions & 0 deletions src/ServerConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ class ignition::gazebo::ServerConfigPrivate
logRecordCompressPath(_cfg->logRecordCompressPath),
resourceCache(_cfg->resourceCache),
physicsEngine(_cfg->physicsEngine),
renderEngineServer(_cfg->renderEngineServer),
renderEngineGui(_cfg->renderEngineGui),
plugins(_cfg->plugins),
networkRole(_cfg->networkRole),
networkSecondaries(_cfg->networkSecondaries),
Expand Down Expand Up @@ -268,6 +270,14 @@ class ignition::gazebo::ServerConfigPrivate
/// \brief File containing physics engine plugin. If empty, DART will be used.
public: std::string physicsEngine = "";

/// \brief File containing render engine server plugin. If empty, OGRE2
/// will be used.
public: std::string renderEngineServer = "";

/// \brief File containing render engine gui plugin. If empty, OGRE2
/// will be used.
public: std::string renderEngineGui = "";

/// \brief List of plugins to load.
public: std::list<ServerConfig::PluginInfo> plugins;

Expand Down Expand Up @@ -510,6 +520,30 @@ void ServerConfig::SetPhysicsEngine(const std::string &_physicsEngine)
this->dataPtr->physicsEngine = _physicsEngine;
}

/////////////////////////////////////////////////
const std::string &ServerConfig::RenderEngineServer() const
{
return this->dataPtr->renderEngineServer;
}

/////////////////////////////////////////////////
void ServerConfig::SetRenderEngineServer(const std::string &_renderEngineServer)
{
this->dataPtr->renderEngineServer = _renderEngineServer;
}

/////////////////////////////////////////////////
const std::string &ServerConfig::RenderEngineGui() const
{
return this->dataPtr->renderEngineGui;
}

/////////////////////////////////////////////////
void ServerConfig::SetRenderEngineGui(const std::string &_renderEngineGui)
{
this->dataPtr->renderEngineGui = _renderEngineGui;
}

/////////////////////////////////////////////////
void ServerConfig::AddPlugin(const ServerConfig::PluginInfo &_info)
{
Expand Down
Loading