From 5f4a8f4745b78dacffc0db0642a91e29e2929602 Mon Sep 17 00:00:00 2001 From: Sai Kishor Kothakota Date: Mon, 22 Jan 2024 10:15:39 +0100 Subject: [PATCH] Load the URDF to the resource_manager before parsing it to CM (#262) * Load the URDF to the resource_manager before parsing it to CM constructor (fixes https://github.com/ros-controls/ros2_control/issues/1299) (cherry picked from commit f5baf71c4c7cb3c0a0af52f988c107b356c95ed0) --- gazebo_ros2_control/src/gazebo_ros2_control_plugin.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gazebo_ros2_control/src/gazebo_ros2_control_plugin.cpp b/gazebo_ros2_control/src/gazebo_ros2_control_plugin.cpp index 1642792..82b7ba7 100644 --- a/gazebo_ros2_control/src/gazebo_ros2_control_plugin.cpp +++ b/gazebo_ros2_control/src/gazebo_ros2_control_plugin.cpp @@ -275,6 +275,13 @@ void GazeboRosControlPlugin::Load(gazebo::physics::ModelPtr parent, sdf::Element std::unique_ptr resource_manager_ = std::make_unique(); + try { + resource_manager_->load_urdf(urdf_string, false, false); + } catch (...) { + // This error should be normal as the resource manager is not supposed to load and initialize + // them + RCLCPP_ERROR(impl_->model_nh_->get_logger(), "Error initializing URDF to resource manager!"); + } try { impl_->robot_hw_sim_loader_.reset( new pluginlib::ClassLoader(