Skip to content

Commit

Permalink
Replaced AddModelFromFile with AddModels (#326)
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
  • Loading branch information
ahcorde authored Jan 4, 2024
1 parent 5661886 commit b9b20c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions drake_ros_examples/examples/hydroelastic/hydroelastic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ void AddScene(MultibodyPlantd* plant) {

std::filesystem::path fs_path{
parser.package_map().GetPath("drake_ros_examples")};
parser.AddAllModelsFromFile(
(fs_path / "hydroelastic/hydroelastic.sdf").string());
parser.AddModels((fs_path / "hydroelastic/hydroelastic.sdf").string());
}

int do_main() {
Expand Down
6 changes: 4 additions & 2 deletions drake_ros_examples/examples/multirobot/multirobot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ int main(int argc, char** argv) {
// coordinates in the array
std::stringstream model_instance_name;
model_instance_name << model_name << xx << '_' << yy;
auto model_instance =
parser.AddModelFromFile(model_file_path, model_instance_name.str());
parser.SetAutoRenaming(true);
auto model_instance = parser.AddModels(model_file_path)[0];

plant.RenameModelInstance(model_instance, model_instance_name.str());

// Weld the robot to the world so it doesn't fall through the floor
auto& base_frame = plant.GetFrameByName("base", model_instance);
Expand Down

0 comments on commit b9b20c7

Please sign in to comment.