@@ -1604,6 +1604,7 @@ void CopyBlob(tinyxml2::XMLElement *_src, tinyxml2::XMLElement *_blob_parent)
1604
1604
void InsertSDFExtensionCollision (tinyxml2::XMLElement *_elem,
1605
1605
const std::string &_linkName)
1606
1606
{
1607
+ bool link_found = false ;
1607
1608
// loop through extensions for the whole model
1608
1609
// and see which ones belong to _linkName
1609
1610
// This might be complicated since there's:
@@ -1615,6 +1616,7 @@ void InsertSDFExtensionCollision(tinyxml2::XMLElement *_elem,
1615
1616
{
1616
1617
if (sdfIt->first == _linkName)
1617
1618
{
1619
+ link_found = true ;
1618
1620
// std::cerr << "============================\n";
1619
1621
// std::cerr << "working on g_extensions for link ["
1620
1622
// << sdfIt->first << "]\n";
@@ -1908,12 +1910,19 @@ void InsertSDFExtensionCollision(tinyxml2::XMLElement *_elem,
1908
1910
}
1909
1911
}
1910
1912
}
1913
+ // If we didn't find the link, emit a warning
1914
+ if (!link_found) {
1915
+ sdfwarn << " <collision> tag with reference[" << _linkName << " ] does not exist"
1916
+ << " in the URDF model. Please ensure that the reference attribute"
1917
+ << " matches the name of a link." ;
1918
+ }
1911
1919
}
1912
1920
1913
1921
// //////////////////////////////////////////////////////////////////////////////
1914
1922
void InsertSDFExtensionVisual (tinyxml2::XMLElement *_elem,
1915
1923
const std::string &_linkName)
1916
1924
{
1925
+ bool link_found = false ;
1917
1926
// loop through extensions for the whole model
1918
1927
// and see which ones belong to _linkName
1919
1928
// This might be complicated since there's:
@@ -1925,6 +1934,7 @@ void InsertSDFExtensionVisual(tinyxml2::XMLElement *_elem,
1925
1934
{
1926
1935
if (sdfIt->first == _linkName)
1927
1936
{
1937
+ link_found=true ;
1928
1938
// std::cerr << "============================\n";
1929
1939
// std::cerr << "working on g_extensions for link ["
1930
1940
// << sdfIt->first << "]\n";
@@ -2102,6 +2112,12 @@ void InsertSDFExtensionVisual(tinyxml2::XMLElement *_elem,
2102
2112
}
2103
2113
}
2104
2114
}
2115
+ // If we didn't find the link, emit a warning
2116
+ if (!link_found) {
2117
+ sdfwarn << " <visual> tag with reference[" << _linkName << " ] does not exist"
2118
+ << " in the URDF model. Please ensure that the reference attribute"
2119
+ << " matches the name of a link." ;
2120
+ }
2105
2121
}
2106
2122
2107
2123
// //////////////////////////////////////////////////////////////////////////////
@@ -2168,13 +2184,15 @@ void InsertSDFExtensionLink(tinyxml2::XMLElement *_elem,
2168
2184
void InsertSDFExtensionJoint (tinyxml2::XMLElement *_elem,
2169
2185
const std::string &_jointName)
2170
2186
{
2187
+ bool joint_found = false ;
2171
2188
auto * doc = _elem->GetDocument ();
2172
2189
for (StringSDFExtensionPtrMap::iterator
2173
2190
sdfIt = g_extensions.begin ();
2174
2191
sdfIt != g_extensions.end (); ++sdfIt)
2175
2192
{
2176
2193
if (sdfIt->first == _jointName)
2177
2194
{
2195
+ joint_found = true ;
2178
2196
for (std::vector<SDFExtensionPtr>::iterator
2179
2197
ge = sdfIt->second .begin ();
2180
2198
ge != sdfIt->second .end (); ++ge)
@@ -2309,6 +2327,13 @@ void InsertSDFExtensionJoint(tinyxml2::XMLElement *_elem,
2309
2327
}
2310
2328
}
2311
2329
}
2330
+
2331
+ // If we didn't find the link, emit a warning
2332
+ if (!joint_found) {
2333
+ sdfwarn << " <joint> tag with name[" << _jointName << " ] does not exist"
2334
+ << " in the URDF model. Please ensure that the name attribute"
2335
+ << " matches the name of a joint." ;
2336
+ }
2312
2337
}
2313
2338
2314
2339
// //////////////////////////////////////////////////////////////////////////////
0 commit comments