robotology / gym-ignition

Framework for developing OpenAI Gym robotics environments simulated with Ignition Gazebo

Home Page:https://robotology.github.io/gym-ignition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set the physics engine through the component

diegoferigo opened this issue · comments

The upstream activities to implement new physics engine (bullet) is progressing. We should update the current logic to use the PhysicsEnginePlugin component to set the physics engine:

// 1. Engine from component (from command line / ServerConfig)
auto engineComp =
_ecm.Component<ignition::gazebo::components::PhysicsEnginePlugin>(
_entity);
if (engineComp && !engineComp->Data().empty()) {
pluginLib = engineComp->Data();
}

bool World::setPhysicsEngine(const PhysicsEngine engine)
{
std::string libName;
std::string className;
switch (engine) {
case PhysicsEngine::Dart:
libName = "PhysicsSystem";
className = "scenario::plugins::gazebo::Physics";
break;
}
if (!this->insertWorldPlugin(libName, className)) {
sError << "Failed to insert the physics plugin" << std::endl;
return false;
}
return true;
}

Closed via #338