From 449769e65f7a94675c3cbf86890c51a9ef019e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Thu, 4 Jan 2024 12:24:01 +0100 Subject: [PATCH] Replaced AddModelFromFile with AddModels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro Hernández Cordero --- drake_ros_examples/examples/hydroelastic/hydroelastic.cc | 3 +-- drake_ros_examples/examples/multirobot/multirobot.cc | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drake_ros_examples/examples/hydroelastic/hydroelastic.cc b/drake_ros_examples/examples/hydroelastic/hydroelastic.cc index a6090c5f..144ccace 100644 --- a/drake_ros_examples/examples/hydroelastic/hydroelastic.cc +++ b/drake_ros_examples/examples/hydroelastic/hydroelastic.cc @@ -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() { diff --git a/drake_ros_examples/examples/multirobot/multirobot.cc b/drake_ros_examples/examples/multirobot/multirobot.cc index e95e9e90..e01529dd 100644 --- a/drake_ros_examples/examples/multirobot/multirobot.cc +++ b/drake_ros_examples/examples/multirobot/multirobot.cc @@ -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);