From c1ff68a28eb564d78f390188d411a932e2f6a571 Mon Sep 17 00:00:00 2001 From: wim Date: Thu, 19 Nov 2009 18:12:08 +0000 Subject: [PATCH] Give better error message when no links were found --- urdf/src/model.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/urdf/src/model.cpp b/urdf/src/model.cpp index ee3fa9c..708e074 100644 --- a/urdf/src/model.cpp +++ b/urdf/src/model.cpp @@ -232,6 +232,12 @@ bool Model::initXml(TiXmlElement *robot_xml) return false; } + // make sure tree is not empty + if (parent_link_tree.empty()){ + ROS_ERROR("The robot xml does not contain any valid links. Are you parsing an empty file, or an un-processed xacro file?"); + return false; + } + // find the root link if (!this->initRoot(parent_link_tree)) { @@ -352,7 +358,7 @@ bool Model::initRoot(std::map &parent_link_tree) } if (!this->root_link_) { - ROS_ERROR("No root link found. The robot xml is empty or not a tree."); + ROS_ERROR("No root link found. The robot xml is not a valid tree."); return false; } ROS_DEBUG("Link '%s' is the root link", this->root_link_->name.c_str());