Skip to content

Commit

Permalink
USD to SDF: Added some world plugins (#901)
Browse files Browse the repository at this point in the history
Signed-off-by: ahcorde <[email protected]>
Co-authored-by: Ashton Larkin <[email protected]>
  • Loading branch information
ahcorde and adlarkin authored Mar 23, 2022
1 parent 27840ca commit e5698ad
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
25 changes: 25 additions & 0 deletions usd/src/usd_parser/USDWorld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "sdf/usd/usd_parser/USDStage.hh"
#include "USDPhysics.hh"

#include "sdf/Plugin.hh"
#include "sdf/World.hh"

namespace sdf
Expand Down Expand Up @@ -88,6 +89,30 @@ namespace usd
continue;
}
}

// Add some plugins to run the Ignition Gazebo simulation
sdf::Plugin physicsPlugin;
physicsPlugin.SetName("ignition::gazebo::systems::Physics");
physicsPlugin.SetFilename("ignition-gazebo-physics-system");
_world.AddPlugin(physicsPlugin);

sdf::Plugin sensorsPlugin;
sensorsPlugin.SetName("ignition::gazebo::systems::Sensors");
sensorsPlugin.SetFilename("ignition-gazebo-sensors-system");
_world.AddPlugin(sensorsPlugin);

sdf::Plugin userCommandsPlugin;
userCommandsPlugin.SetName("ignition::gazebo::systems::UserCommands");
userCommandsPlugin.SetFilename("ignition-gazebo-user-commands-system");
_world.AddPlugin(userCommandsPlugin);

sdf::Plugin sceneBroadcasterPlugin;
sceneBroadcasterPlugin.SetName(
"ignition::gazebo::systems::SceneBroadcaster");
sceneBroadcasterPlugin.SetFilename(
"ignition-gazebo-scene-broadcaster-system");
_world.AddPlugin(sceneBroadcasterPlugin);

return errors;
}
}
Expand Down
14 changes: 14 additions & 0 deletions usd/src/usd_parser/usd2sdf_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,20 @@ TEST(check_cmd, IGN_UTILS_TEST_DISABLED_ON_WIN32(SDF))
EXPECT_DOUBLE_EQ(0.0, world->Gravity()[1]);
EXPECT_DOUBLE_EQ(-0.098, world->Gravity()[2]);

auto plugins = world->Plugins();
EXPECT_EQ(4u, plugins.size());
EXPECT_EQ("ignition::gazebo::systems::Physics", plugins[0].Name());
EXPECT_EQ("ignition-gazebo-physics-system", plugins[0].Filename());

EXPECT_EQ("ignition::gazebo::systems::Sensors", plugins[1].Name());
EXPECT_EQ("ignition-gazebo-sensors-system", plugins[1].Filename());

EXPECT_EQ("ignition::gazebo::systems::UserCommands", plugins[2].Name());
EXPECT_EQ("ignition-gazebo-user-commands-system", plugins[2].Filename());

EXPECT_EQ("ignition::gazebo::systems::SceneBroadcaster", plugins[3].Name());
EXPECT_EQ(
"ignition-gazebo-scene-broadcaster-system", plugins[3].Filename());
// TODO(anyone) Check the remaining contents of outputUsdFilePath
// when the parser is implemented
}
Expand Down

0 comments on commit e5698ad

Please sign in to comment.