From d7d1b324d037fb872099c8708320c955d6142527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=2E=20Denis=20=C5=A0togl?= Date: Wed, 19 Jun 2024 19:55:17 +0200 Subject: [PATCH 1/2] Small improvements to the error output in component parser to make debugging easier. --- hardware_interface/src/component_parser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hardware_interface/src/component_parser.cpp b/hardware_interface/src/component_parser.cpp index ef585c971b..9e1c80a40b 100644 --- a/hardware_interface/src/component_parser.cpp +++ b/hardware_interface/src/component_parser.cpp @@ -797,11 +797,11 @@ std::vector parse_control_resources_from_urdf(const std::string & tinyxml2::XMLDocument doc; if (!doc.Parse(urdf.c_str()) && doc.Error()) { - throw std::runtime_error("invalid URDF passed in to robot parser"); + throw std::runtime_error("invalid URDF passed in to robot parser: " + std::string(doc.ErrorStr())); } if (doc.Error()) { - throw std::runtime_error("invalid URDF passed in to robot parser"); + throw std::runtime_error("invalid URDF passed in to robot parser: " + std::string(doc.ErrorStr())); } // Find robot tag @@ -875,7 +875,7 @@ std::vector parse_control_resources_from_urdf(const std::string & auto urdf_joint = model.getJoint(joint.name); if (!urdf_joint) { - throw std::runtime_error("Joint " + joint.name + " not found in URDF"); + throw std::runtime_error("Joint '" + joint.name + "' not found in URDF"); } if (!urdf_joint->mimic && joint.is_mimic == MimicAttribute::TRUE) { From ed92e7c4cc969cbb27090c3e7f0229e10f241b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=2E=20Denis=20=C5=A0togl?= Date: Wed, 19 Jun 2024 20:10:01 +0200 Subject: [PATCH 2/2] Correct formatting. --- hardware_interface/src/component_parser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hardware_interface/src/component_parser.cpp b/hardware_interface/src/component_parser.cpp index 9e1c80a40b..815b6d7e10 100644 --- a/hardware_interface/src/component_parser.cpp +++ b/hardware_interface/src/component_parser.cpp @@ -797,11 +797,13 @@ std::vector parse_control_resources_from_urdf(const std::string & tinyxml2::XMLDocument doc; if (!doc.Parse(urdf.c_str()) && doc.Error()) { - throw std::runtime_error("invalid URDF passed in to robot parser: " + std::string(doc.ErrorStr())); + throw std::runtime_error( + "invalid URDF passed in to robot parser: " + std::string(doc.ErrorStr())); } if (doc.Error()) { - throw std::runtime_error("invalid URDF passed in to robot parser: " + std::string(doc.ErrorStr())); + throw std::runtime_error( + "invalid URDF passed in to robot parser: " + std::string(doc.ErrorStr())); } // Find robot tag