Skip to content

Commit

Permalink
update template
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 committed Nov 1, 2023
1 parent 5d1c505 commit d1d7c82
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 59 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
name: Bug report
about: Report a bug
labels: bug

---

<!-- If you're not sure whether your problem is a bug, please ask a question at
http://answers.gazebosim.org instead.-->
https://robotics.stackexchange.com instead.-->

## Environment
* OS Version: <!-- e.g, Ubuntu 20.04 -->
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
name: Feature request
about: Request a new feature
labels: enhancement

---

<!-- If you're not sure on the specifics of the feature or would like a broader
discussion, please consider posting a proposal to
http://community.gazebosim.org/ instead.-->
https://robotics.stackexchange.com instead.-->

## Desired behavior
<!-- Describe the current problem and the feature you want implemented.-->
Expand Down
2 changes: 2 additions & 0 deletions src/Util_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include <gtest/gtest.h>
#include <gz/common/Console.hh>
#include <gz/common/testing/TestPaths.hh>
sfe
#include <sdf/Actor.hh>
#include <sdf/Light.hh>
#include <sdf/Types.hh>
Expand Down
62 changes: 5 additions & 57 deletions src/systems/physics/Physics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ void Physics::Configure(const Entity &_entity,
// 3. Use DART by default
if (pluginLib.empty())
{
pluginLib = "gz-physics-dartsim-plugin";
pluginLib = "gz::physics::dartsim::Plugin";
}

// Deprecated: accept ignition-prefixed engines
Expand Down Expand Up @@ -806,58 +806,10 @@ void Physics::Configure(const Entity &_entity,
"include_entity_names", true).first;
}

// Find engine shared library
// Look in:
// * Paths from environment variable
// * Engines installed with gz-physics
common::SystemPaths systemPaths;
systemPaths.SetPluginPathEnv(this->dataPtr->pluginPathEnv);
systemPaths.AddPluginPaths(gz::physics::getEngineInstallDir());

auto pathToLib = systemPaths.FindSharedLibrary(pluginLib);
if (pathToLib.empty())
{
// Try deprecated environment variable
// TODO(CH3): Deprecated. Remove on tock.
common::SystemPaths systemPathsDep;
systemPathsDep.SetPluginPathEnv(this->dataPtr->pluginPathEnvDeprecated);
pathToLib = systemPathsDep.FindSharedLibrary(pluginLib);

if (pathToLib.empty())
{
gzerr << "Failed to find plugin [" << pluginLib
<< "]. Have you checked the " << this->dataPtr->pluginPathEnv
<< " environment variable?" << std::endl;

return;
}
else
{
gzwarn << "Found plugin [" << pluginLib
<< "] using deprecated environment variable ["
<< this->dataPtr->pluginPathEnvDeprecated << "]. Please use ["
<< this->dataPtr->pluginPathEnv << "] instead." << std::endl;
}
}

// Load engine plugin
plugin::Loader pluginLoader;
auto plugins = pluginLoader.LoadLib(pathToLib);
if (plugins.empty())
{
gzerr << "Unable to load the [" << pathToLib << "] library.\n";
return;
}

auto classNames = pluginLoader.PluginsImplementing<
physics::ForwardStep::Implementation<
physics::FeaturePolicy3d>>();
if (classNames.empty())
{
gzerr << "No physics plugins found in library [" << pathToLib << "]."
<< std::endl;
return;
}
std::vector<std::string> classNames = {pluginLib};

// Get the first plugin that works
for (auto className : classNames)
Expand All @@ -866,8 +818,7 @@ void Physics::Configure(const Entity &_entity,

if (!plugin)
{
gzwarn << "Failed to instantiate [" << className << "] from ["
<< pathToLib << "]" << std::endl;
gzwarn << "Failed to instantiate [" << className << "]" << std::endl;
continue;
}

Expand All @@ -877,8 +828,7 @@ void Physics::Configure(const Entity &_entity,

if (nullptr != this->dataPtr->engine)
{
gzdbg << "Loaded [" << className << "] from library ["
<< pathToLib << "]" << std::endl;
gzdbg << "Loaded [" << className << "]" << std::endl;
break;
}

Expand All @@ -898,9 +848,7 @@ void Physics::Configure(const Entity &_entity,

if (nullptr == this->dataPtr->engine)
{
gzerr << "Failed to load a valid physics engine from [" << pathToLib
<< "]."
<< std::endl;
gzerr << "Failed to load a valid physics engine." << std::endl;
return;
}

Expand Down

0 comments on commit d1d7c82

Please sign in to comment.