Skip to content

Commit

Permalink
parsing: Remove implicit frames created for nested models. (#15208)
Browse files Browse the repository at this point in the history
This removes additional implicit model frames created for nested models that were missed in #15099.
  • Loading branch information
azeey authored Jun 22, 2021
1 parent a65666e commit 248db43
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
9 changes: 0 additions & 9 deletions multibody/parsing/detail_sdf_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -811,15 +811,6 @@ std::vector<ModelInstanceIndex> AddModelsFromSpecification(
nested_model, sdf::JoinName(model_name, nested_model.Name()), X_WM,
plant, package_map, root_dir);

DRAKE_DEMAND(!nested_model_instances.empty());
const ModelInstanceIndex nested_model_instance =
nested_model_instances.front();

plant->AddFrame(std::make_unique<FixedOffsetFrame<double>>(
nested_model.Name(),
plant->GetFrameByName("__model__", nested_model_instance),
RigidTransformd::Identity(), model_instance));

added_model_instances.insert(added_model_instances.end(),
nested_model_instances.begin(),
nested_model_instances.end());
Expand Down
10 changes: 1 addition & 9 deletions multibody/parsing/test/detail_sdf_parser_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1486,16 +1486,8 @@ GTEST_TEST(SdfParser, ModelPlacementFrame) {
ASSERT_TRUE(plant->HasModelInstanceNamed("table::mug"));
ModelInstanceIndex model_m = plant->GetModelInstanceByName("table::mug");

ASSERT_TRUE(plant->HasFrameNamed("mug"));
const Frame<double>& frame_M = plant->GetFrameByName("mug");
ASSERT_TRUE(plant->HasFrameNamed("__model__", model_m));
// frame M is equivalent to mug::__model__
EXPECT_TRUE(CompareMatrices(
plant->GetFrameByName("__model__", model_m)
.CalcPoseInWorld(*context)
.GetAsMatrix4(),
plant->GetFrameByName("mug").CalcPoseInWorld(*context).GetAsMatrix4(),
kEps));
const Frame<double>& frame_M = plant->GetFrameByName("__model__", model_m);

ASSERT_TRUE(plant->HasFrameNamed("table_top"));
const Frame<double>& frame_S = plant->GetFrameByName("table_top");
Expand Down

0 comments on commit 248db43

Please sign in to comment.