Skip to content

Commit

Permalink
Consolidate duplicated worlds
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Jan 29, 2024
1 parent 6607c91 commit 537a854
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 1,660 deletions.
15 changes: 8 additions & 7 deletions dartsim/src/SDFFeatures_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
#include <sdf/World.hh>

#include <test/Utils.hh>
#include "dartsim/src/Worlds.hh"
#include <test/common_test/Worlds.hh>
#include "Worlds.hh"

using namespace gz;

Expand Down Expand Up @@ -314,7 +315,7 @@ INSTANTIATE_TEST_SUITE_P(LoadWorld, SDFFeatures_TEST,
// Test that the dartsim plugin loaded all the relevant information correctly.
TEST_P(SDFFeatures_TEST, CheckDartsimData)
{
WorldPtr world = this->LoadWorld(dartsim::worlds::kTestWorld);
WorldPtr world = this->LoadWorld(common_test::worlds::kTestWorld);
ASSERT_NE(nullptr, world);

dart::simulation::WorldPtr dartWorld = world->GetDartsimWorld();
Expand Down Expand Up @@ -422,7 +423,7 @@ TEST_P(SDFFeatures_TEST, CheckDartsimData)
// Test that joint limits are working by running the simulation
TEST_P(SDFFeatures_TEST, CheckJointLimitEnforcement)
{
WorldPtr world = this->LoadWorld(dartsim::worlds::kTestWorld);
WorldPtr world = this->LoadWorld(common_test::worlds::kTestWorld);
ASSERT_NE(nullptr, world);

dart::simulation::WorldPtr dartWorld = world->GetDartsimWorld();
Expand Down Expand Up @@ -581,7 +582,7 @@ TEST_P(SDFFeatures_TEST, WorldIsParentOrChild)
//
TEST_P(SDFFeatures_TEST, WorldWithNestedModel)
{
WorldPtr world = this->LoadWorld(dartsim::worlds::kWorldWithNestedModelSdf);
WorldPtr world = this->LoadWorld(common_test::worlds::kWorldWithNestedModelSdf);
ASSERT_NE(nullptr, world);
EXPECT_EQ(2u, world->GetModelCount());

Expand Down Expand Up @@ -690,7 +691,7 @@ TEST_P(SDFFeatures_TEST, WorldWithNestedModelJointToWorld)
// Test that joint type falls back to fixed if the type is not supported
TEST_P(SDFFeatures_TEST, FallbackToFixedJoint)
{
WorldPtr world = this->LoadWorld(dartsim::worlds::kTestWorld);
WorldPtr world = this->LoadWorld(common_test::worlds::kTestWorld);
ASSERT_NE(nullptr, world);

dart::simulation::WorldPtr dartWorld = world->GetDartsimWorld();
Expand Down Expand Up @@ -964,7 +965,7 @@ TEST_P(SDFFeatures_FrameSemantics, ExplicitWorldFrames)
/////////////////////////////////////////////////
TEST_P(SDFFeatures_TEST, Shapes)
{
WorldPtr world = this->LoadWorld(dartsim::worlds::kShapesSdf);
WorldPtr world = this->LoadWorld(common_test::worlds::kShapesWorld);
ASSERT_NE(nullptr, world);

auto dartWorld = world->GetDartsimWorld();
Expand All @@ -973,7 +974,7 @@ TEST_P(SDFFeatures_TEST, Shapes)
ASSERT_EQ(5u, dartWorld->getNumSkeletons());

int count{0};
for (auto name : {"box", "cylinder", "sphere", "capsule", "ellipsoid"})
for (auto name : {"sphere", "box", "cylinder", "capsule", "ellipsoid"})
{
const auto skeleton = dartWorld->getSkeleton(count++);
ASSERT_NE(nullptr, skeleton);
Expand Down
6 changes: 3 additions & 3 deletions dartsim/src/WorldFeatures_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <sdf/World.hh>

#include "test/Utils.hh"
#include "Worlds.hh"
#include "test/common_test/Worlds.hh"

struct TestFeatureList : gz::physics::FeatureList<
gz::physics::CollisionDetector,
Expand Down Expand Up @@ -83,7 +83,7 @@ TestWorldPtr LoadWorld(
//////////////////////////////////////////////////
TEST_F(WorldFeaturesFixture, CollisionDetector)
{
const auto world = LoadWorld(this->engine, dartsim::worlds::kEmptySdf);
const auto world = LoadWorld(this->engine, common_test::worlds::kEmptySdf);
EXPECT_EQ("ode", world->GetCollisionDetector());

world->SetCollisionDetector("banana");
Expand All @@ -105,7 +105,7 @@ TEST_F(WorldFeaturesFixture, CollisionDetector)
//////////////////////////////////////////////////
TEST_F(WorldFeaturesFixture, Solver)
{
const auto world = LoadWorld(this->engine, dartsim::worlds::kEmptySdf);
const auto world = LoadWorld(this->engine, common_test::worlds::kEmptySdf);

EXPECT_EQ("DantzigBoxedLcpSolver", world->GetSolver());

Expand Down
7 changes: 0 additions & 7 deletions dartsim/src/Worlds.hh
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,10 @@ inline std::string DartsimTestWorld(const std::string &_world)
namespace dartsim::worlds
{
const auto kAddedMassSdf = DartsimTestWorld("added_mass.sdf");
const auto kEmptySdf = DartsimTestWorld("empty.sdf");
const auto kFallingWorld = DartsimTestWorld("falling.world");
const auto kJointAcrossNestedModelsSdf =
DartsimTestWorld("joint_across_nested_models.sdf");
const auto kModelFramesSdf = DartsimTestWorld("model_frames.sdf");
const auto kShapesSdf = DartsimTestWorld("shapes.sdf");
const auto kShapesBitmaskWorld = DartsimTestWorld("shapes_bitmask.sdf");
const auto kTestWorld = DartsimTestWorld("test.world");
const auto kWorldFramesSdf = DartsimTestWorld("world_frames.sdf");
const auto kWorldWithNestedModelSdf =
DartsimTestWorld("world_with_nested_model.sdf");
const auto kWorldWithNestedModelJointToWorldSdf =
DartsimTestWorld("world_with_nested_model_joint_to_world.sdf");
} // namespace dartsim::worlds
Expand Down
5 changes: 0 additions & 5 deletions dartsim/worlds/empty.sdf

This file was deleted.

75 changes: 0 additions & 75 deletions dartsim/worlds/falling.world

This file was deleted.

191 changes: 0 additions & 191 deletions dartsim/worlds/shapes.sdf

This file was deleted.

Loading

0 comments on commit 537a854

Please sign in to comment.