Here is the travis run: https://travis-ci.com/github/ros-planning/moveit/jobs/381214917
I'm going to work on reproducing this locally and try doing a git bisect of recent merges on dependencies to see if I can find the source. Nothing was merged into master here since this started failing. Any help would be appreciated.
xml
<failure message="unknown file
C++ exception with description "Unable to update the SRDF Model" thrown in the test body." type="">
<![CDATA[unknown file
C++ exception with description "Unable to update the SRDF Model" thrown in the test body.]]>
</failure>
-- run_tests.py: execute commands
/home/tyler/workspace/ws_moveit_noetic/devel/.private/moveit_core/lib/moveit_core/test_aabb --gtest_output=xml:/home/tyler/workspace/ws_moveit_noetic/build/moveit_core/test_results/moveit_core/gtest-test_aabb.xml
[==========] Running 3 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 3 tests from TestAABB
[ RUN ] TestAABB.TestPR2
ros.moveit_core.robot_model: Loading robot model 'pr2'...
ros.moveit_core.robot_model.empty_collision_geometry: Link sensor_mount_link has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry.
ros.moveit_core.robot_model.empty_collision_geometry: Link double_stereo_link has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry.
ros.moveit_core.robot_model: Group state 'tuck_arms' doesn't specify all group joints in group 'arms'. l_shoulder_lift_joint, l_upper_arm_roll_joint, l_elbow_flex_joint, l_forearm_roll_joint, l_wrist_flex_joint, l_wrist_roll_joint, r_shoulder_pan_joint, r_shoulder_lift_joint, r_upper_arm_roll_joint, r_elbow_flex_joint, r_forearm_roll_joint, r_wrist_flex_joint, r_wrist_roll_joint are missing.
[ OK ] TestAABB.TestPR2 (63 ms)
[ RUN ] TestAABB.TestSimple
Error: Could not find the 'robot' element in the xml file
at line 638 in /tmp/binarydeb/ros-noetic-srdfdom-0.6.0/src/model.cpp
unknown file: Failure
C++ exception with description "Unable to update the SRDF Model" thrown in the test body.
[ FAILED ] TestAABB.TestSimple (0 ms)
[ RUN ] TestAABB.TestComplex
Error: Could not find the 'robot' element in the xml file
at line 638 in /tmp/binarydeb/ros-noetic-srdfdom-0.6.0/src/model.cpp
unknown file: Failure
C++ exception with description "Unable to update the SRDF Model" thrown in the test body.
[ FAILED ] TestAABB.TestComplex (0 ms)
[----------] 3 tests from TestAABB (63 ms total)
[----------] Global test environment tear-down
[==========] 3 tests from 1 test suite ran. (63 ms total)
[ PASSED ] 1 test.
[ FAILED ] 2 tests, listed below:
[ FAILED ] TestAABB.TestSimple
[ FAILED ] TestAABB.TestComplex
#0 0x00000000053ec762 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x0000000005e22e7c in srdf::SRDFWriter::updateSRDFModel (this=0xbcabf60, robot_model=...)
at /home/tyler/workspace/ws_moveit_noetic/src/srdfdom/src/srdf_writer.cpp:111
#2 0x0000000004f31ab6 in moveit::core::RobotModelBuilder::build (this=0x1ffeffe7b0)
at /home/tyler/workspace/ws_moveit_noetic/src/moveit/moveit_core/utils/src/robot_model_test_utils.cpp:376
#3 0x000000000013ea73 in TestAABB_TestSimple_Test::TestBody (this=0xb923110)
at /home/tyler/workspace/ws_moveit_noetic/src/moveit/moveit_core/robot_state/test/test_aabb.cpp:291
(gdb) info args
this = 0xbcabf60
robot_model = @0xaee13e0: {links_ = std::map with 2 elements = {
["base_footprint"] = std::shared_ptr<urdf::Link> (use count 2, weak count 1) = {get() = 0xba3d9b0},
["base_link"] = std::shared_ptr<urdf::Link> (use count 2, weak count 0) = {get() = 0xbcac0e0}},
joints_ = std::map with 1 element = {
["base_footprint-base_link-joint"] = std::shared_ptr<urdf::Joint> (use count 3, weak count 0) = {
get() = 0xb992060}}, materials_ = std::map with 0 elements, name_ = "simple",
root_link_ = std::shared_ptr<urdf::Link> (use count 2, weak count 1) = {get() = 0xba3d9b0}}
(gdb) print srdf_string
$1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--This does not replace URDF, and is not an extension of URDF.\n This is a format for representing semantic information about the robot structure.\n A URDF"...
(gdb) print *srdf_model_
$4 = {name_ = "", groups_ = std::vector of length 0, capacity 0,
group_states_ = std::vector of length 0, capacity 0,
virtual_joints_ = std::vector of length 0, capacity 0,
end_effectors_ = std::vector of length 0, capacity 0,
link_sphere_approximations_ = std::vector of length 0, capacity 0,
disabled_collisions_ = std::vector of length 0, capacity 0,
passive_joints_ = std::vector of length 0, capacity 0}
(gdb) print srdf_model_->initString(robot_model, srdf_string)
$5 = false
(gdb) c
My suspicion is that this is caused by the robot model builder's call into libsrdfdom and that somehow we are now hitting this line: https://github.com/ros-planning/srdfdom/blob/6a9c757f0e8b5268c0887ecc396b140de7add775/src/srdf_writer.cpp#L110
I'm going to build with debug symbols to see if I can figure it out. Also, did something change in the srdfdom project from melodic to noetic that might be causing this?
I checked out srdfdom and the problem went away on the melodic-devel branch. That means it probably has something todo with the tinyxml2 library port.
Using gdb I've found that this block of code:
bool srdf::Model::initXml(const urdf::ModelInterface& urdf_model, TiXmlDocument* xml)
{
TiXmlElement* robot_xml = xml ? xml->FirstChildElement("robot") : NULL;
if (!robot_xml)
{
CONSOLE_BRIDGE_logError("Could not find the 'robot' element in the xml file");
return false;
}
...
Is not doing what it used to. With the old library FindFirstChildElement("robot") returns a non-zero result and in this case it returns 0. Here is some gdb output from breaking inside the if statement (on the debug print):
(gdb) print xml
$9 = (tinyxml2::XMLDocument *) 0x1ffeffe230
(gdb) print robot_xml
$10 = (tinyxml2::XMLElement *) 0x0
(gdb) print xml->FirstChildElement("robot")
Couldn't find method tinyxml2::XMLDocument::FirstChildElement
For context here is some output from the same block of code when you build with the melodic-devel branch (using the old tinyxml library):
(gdb) print *xml
$4 = <incomplete type>
(gdb) print xml
$5 = (TiXmlDocument *) 0x1ffeffe490
(gdb) print robot_xml
$6 = (TiXmlElement *) 0xb31f6c0
(gdb) print xml->FirstChildElement("robot")
Couldn't find method TiXmlDocument::FirstChildElement
In both cases gdb can't get the type info from the tinyxml library, I'm not sure why. But as you can see that method is returning a valid pointer in this case (and it didn't in the other.
_I am frustrated by the fact that I can't seem to get any symbol data or info on objects inside the tinyxml library (I am building in debug mode)._
@rhaschke do you have any thoughts or advice on this? I'm frustrated by gdb's lack of symbols for the tinyxml library but I think I figured out the exact place where the two seem to differ. I'm not sure how to ask why they differ at this point. Not being able to look inside the tiny xml object is making this difficult. I've gone around looking at the variables I can see in the model.cpp and for example the xmlstring in both cases is the same (I posted it above) which means that the same data is being passed in to tinyxml in the method "Parse" on line 664 in the old one and 670 in the new one in model.cpp. Both of those pass the next check (they don't error in Parse) and they return the initXml call where we find this line.
Thanks for your detailed analysis. I will have a look into this right now.
The culprit was the SRDFWriter, which failed to populate the XML document with the root
I fixed this issue locally. I am adding a unittest to srdfdom now and will re-relase subsequently.
srdfdom release request opened: https://github.com/ros/rosdistro/pull/26470
Sweet, thank you for fixing this. I didn't really know what I was looking for (other than it not working the way it used to).
@rhaschke If it's helpful at all, I'm encountering a similar issue using moveit_setup_assistant. I'm using the UR5 urdf file to create a new configuration package, but just after adding a planning group (tested with Add Joints, Add Links, & Add Kin. Chain) and hitting Save, the window crashes and I get
[ERROR] [1599544434.976813810]: Could not find the 'robot' element in the xml file
terminate called after throwing an instance of 'std::runtime_error'
what(): Unable to update the SRDF Model
The same problem occurs with my own custom robot as well, but I doubt that posting the code for that will provide much insight.
(I used the noetic_devel branch, installed from source a couple hours ago.)
@VictoriaBentell, please try to update to the latest release of srdfdom (which is only available via ros-testing right now, because it's not yet synced.). Alternatively, you can build this package from source.
Fixed after reinstalling MoveIt! from ros-testing.
Most helpful comment
The culprit was the SRDFWriter, which failed to populate the XML document with the root tag .
I fixed this issue locally. I am adding a unittest to srdfdom now and will re-relase subsequently.