Skip to content

Commit

Permalink
Use separate FeatureList for FreeGroup test
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Nov 9, 2023
1 parent 3bce17d commit 33e12fa
Showing 1 changed file with 33 additions and 9 deletions.
42 changes: 33 additions & 9 deletions test/common_test/simulation_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,19 +490,35 @@ TYPED_TEST(SimulationFeaturesShapeFeaturesTest, ShapeFeatures)
}
}

struct FreeGroupFeatures : gz::physics::FeatureList<
gz::physics::FindFreeGroupFeature,
gz::physics::SetFreeGroupWorldPose,
gz::physics::SetFreeGroupWorldVelocity,

gz::physics::GetModelFromWorld,
gz::physics::GetLinkFromModel,

gz::physics::FreeGroupFrameSemantics,
gz::physics::LinkFrameSemantics,

gz::physics::sdf::ConstructSdfWorld,

gz::physics::ForwardStep
> {};

template <class T>
class SimulationFeaturesTestBasic :
class SimulationFeaturesTestFreeGroup :
public SimulationFeaturesTest<T>{};
using SimulationFeaturesTestBasicTypes =
::testing::Types<Features>;
TYPED_TEST_SUITE(SimulationFeaturesTestBasic,
SimulationFeaturesTestBasicTypes);
using SimulationFeaturesTestFreeGroupTypes =
::testing::Types<FreeGroupFeatures>;
TYPED_TEST_SUITE(SimulationFeaturesTestFreeGroup,
SimulationFeaturesTestFreeGroupTypes);

TYPED_TEST(SimulationFeaturesTestBasic, FreeGroup)
TYPED_TEST(SimulationFeaturesTestFreeGroup, FreeGroup)
{
for (const std::string &name : this->pluginNames)
{
auto world = LoadPluginAndWorld<Features>(
auto world = LoadPluginAndWorld<FreeGroupFeatures>(
this->loader,
name,
gz::common::joinPaths(TEST_WORLD_DIR, "shapes.world"));
Expand All @@ -520,7 +536,7 @@ TYPED_TEST(SimulationFeaturesTestBasic, FreeGroup)
auto freeGroupLink = link->FindFreeGroup();
ASSERT_NE(nullptr, freeGroupLink);

StepWorld<Features>(world, true);
StepWorld<FreeGroupFeatures>(world, true);

freeGroup->SetWorldPose(
gz::math::eigen3::convert(
Expand All @@ -535,7 +551,7 @@ TYPED_TEST(SimulationFeaturesTestBasic, FreeGroup)
gz::math::eigen3::convert(frameData.pose));

// Step the world
StepWorld<Features>(world, false);
StepWorld<FreeGroupFeatures>(world, false);
// Check that the first link's velocities are updated
frameData = model->GetLink(0)->FrameDataRelativeToWorld();
EXPECT_TRUE(gz::math::Vector3d(0.1, 0.2, 0.3).Equal(
Expand All @@ -545,6 +561,14 @@ TYPED_TEST(SimulationFeaturesTestBasic, FreeGroup)
}
}

template <class T>
class SimulationFeaturesTestBasic :
public SimulationFeaturesTest<T>{};
using SimulationFeaturesTestBasicTypes =
::testing::Types<Features>;
TYPED_TEST_SUITE(SimulationFeaturesTestBasic,
SimulationFeaturesTestBasicTypes);

TYPED_TEST(SimulationFeaturesTestBasic, ShapeBoundingBox)
{
for (const std::string &name : this->pluginNames)
Expand Down

0 comments on commit 33e12fa

Please sign in to comment.