robotology / idyntree

Multibody Dynamics Library designed for Free Floating Robots
BSD 3-Clause "New" or "Revised" License
177 stars 67 forks source link

Parser crashing on malformed URDF #242

Open traversaro opened 8 years ago

traversaro commented 8 years ago

@MartaLorenzini Can you attach the offending URDF to this discussion, so we can fix the bug and add it in the tests? Thanks!

MartaLorenzini commented 8 years ago

XSensURDF_subj1.txt

traversaro commented 8 years ago

Thanks @MartaLorenzini !

The file is this one:

<!-- Sensor  1-->
<sensor name="Pelvis_gyro" type="gyroscope">
<parent link="Pelvis"/>
<origin xyz="-0.055797 -6.8455e-05     0.09382" rpy="0.10277     0.99391     -3.0189"/>
</sensor>
<sensor name="Pelvis_accelerometer" type="accelerometer">
<parent link="Pelvis"/>
<origin xyz="-0.055797 -6.8455e-05     0.09382" rpy="0.10277     0.99391     -3.0189"/>
</sensor>
<!-- Sensor  2-->
<sensor name="T8_gyro" type="gyroscope">
<parent link="T8"/>
<origin xyz="0.12904 -5.7446e-05    0.071049" rpy="-0.055985      1.1227   -0.023817"/>
</sensor>
<sensor name="T8_accelerometer" type="accelerometer">
<parent link="T8"/>
<origin xyz="0.12904 -5.7446e-05    0.071049" rpy="-0.055985      1.1227   -0.023817"/>
</sensor>
<!-- Sensor  3-->
<sensor name="Head_gyro" type="gyroscope">
<parent link="Head"/>
<origin xyz="-0.064602  6.0394e-05    0.071069" rpy="2.5761   -0.051806     -1.5359"/>
</sensor>
<sensor name="Head_accelerometer" type="accelerometer">
<parent link="Head"/>
<origin xyz="-0.064602  6.0394e-05    0.071069" rpy="2.5761   -0.051806     -1.5359"/>
</sensor>
<!-- Sensor  4-->
<sensor name="RightShoulder_gyro" type="gyroscope">
<parent link="RightShoulder"/>
<origin xyz="-0.018351   -0.045761   -0.054872" rpy="0.86963   -0.063373    -0.87994"/>
</sensor>
<sensor name="RightShoulder_accelerometer" type="accelerometer">
<parent link="RightShoulder"/>
<origin xyz="-0.018351   -0.045761   -0.054872" rpy="0.86963   -0.063373    -0.87994"/>
</sensor>
<!-- Sensor  5-->
<sensor name="RightUpperArm_gyro" type="gyroscope">
<parent link="RightUpperArm"/>
<origin xyz="-0.018745   -0.093784    0.018795" rpy="-0.43727    0.012838     -1.5425"/>
</sensor>
<sensor name="RightUpperArm_accelerometer" type="accelerometer">
<parent link="RightUpperArm"/>
<origin xyz="-0.018745   -0.093784    0.018795" rpy="-0.43727    0.012838     -1.5425"/>
</sensor>
<!-- Sensor  6-->
<sensor name="RightForeArm_gyro" type="gyroscope">
<parent link="RightForeArm"/>
<origin xyz="0.0017342    -0.18854    0.018831" rpy="-1.1409   0.0066822     -1.4625"/>
</sensor>
<sensor name="RightForeArm_accelerometer" type="accelerometer">
<parent link="RightForeArm"/>
<origin xyz="0.0017342    -0.18854    0.018831" rpy="-1.1409   0.0066822     -1.4625"/>
</sensor>
<!-- Sensor  7-->
<sensor name="RightHand_gyro" type="gyroscope">
<parent link="RightHand"/>
<origin xyz="0.00013779   -0.051904    0.018768" rpy="-1.0793    -0.23419     -1.7229"/>
</sensor>
<sensor name="RightHand_accelerometer" type="accelerometer">
<parent link="RightHand"/>
<origin xyz="0.00013779   -0.051904    0.018768" rpy="-1.0793    -0.23419     -1.7229"/>
</sensor>
<!-- Sensor  8-->
<sensor name="LeftShoulder_gyro" type="gyroscope">
<parent link="LeftShoulder"/>
<origin xyz="-0.018309    0.045693   -0.054839" rpy="-0.72557    -0.12512      1.2756"/>
</sensor>
<sensor name="LeftShoulder_accelerometer" type="accelerometer">
<parent link="LeftShoulder"/>
<origin xyz="-0.018309    0.045693   -0.054839" rpy="-0.72557    -0.12512      1.2756"/>
</sensor>
<!-- Sensor  9-->
<sensor name="LeftUpperArm_gyro" type="gyroscope">
<parent link="LeftUpperArm"/>
<origin xyz="-0.018793    0.093784    0.018796" rpy="0.27772   -0.067458      1.5708"/>
</sensor>
<sensor name="LeftUpperArm_accelerometer" type="accelerometer">
<parent link="LeftUpperArm"/>
<origin xyz="-0.018793    0.093784    0.018796" rpy="0.27772   -0.067458      1.5708"/>
</sensor>
<!-- Sensor  10-->
<sensor name="LeftForeArm_gyro" type="gyroscope">
<parent link="LeftForeArm"/>
<origin xyz="0.0017481     0.18853    0.018825" rpy="0.3157   -0.059283      1.2551"/>
</sensor>
<sensor name="LeftForeArm_accelerometer" type="accelerometer">
<parent link="LeftForeArm"/>
<origin xyz="0.0017481     0.18853    0.018825" rpy="0.3157   -0.059283      1.2551"/>
</sensor>
<!-- Sensor  11-->
<sensor name="LeftHand_gyro" type="gyroscope">
<parent link="LeftHand"/>
<origin xyz="4.8483e-05    0.051882     0.01895" rpy="0.24188     0.13739      1.2676"/>
</sensor>
<sensor name="LeftHand_accelerometer" type="accelerometer">
<parent link="LeftHand"/>
<origin xyz="4.8483e-05    0.051882     0.01895" rpy="0.24188     0.13739      1.2676"/>
</sensor>
<!-- Sensor  12-->
<sensor name="RightUpperLeg_gyro" type="gyroscope">
<parent link="RightUpperLeg"/>
<origin xyz="0.012656   -0.040891    -0.24646" rpy="-3.074      1.3088      1.8917"/>
</sensor>
<sensor name="RightUpperLeg_accelerometer" type="accelerometer">
<parent link="RightUpperLeg"/>
<origin xyz="0.012656   -0.040891    -0.24646" rpy="-3.074      1.3088      1.8917"/>
</sensor>
<!-- Sensor  13-->
<sensor name="RightLowerLeg_gyro" type="gyroscope">
<parent link="RightLowerLeg"/>
<origin xyz="0.032448   0.0070933    -0.13924" rpy="-0.78327      1.5437     -0.4955"/>
</sensor>
<sensor name="RightLowerLeg_accelerometer" type="accelerometer">
<parent link="RightLowerLeg"/>
<origin xyz="0.032448   0.0070933    -0.13924" rpy="-0.78327      1.5437     -0.4955"/>
</sensor>
<!-- Sensor  14-->
<sensor name="RightFoot_gyro" type="gyroscope">
<parent link="RightFoot"/>
<origin xyz="0.076672  0.00083228   -0.010661" rpy="0.37286     0.70285     0.34581"/>
</sensor>
<sensor name="RightFoot_accelerometer" type="accelerometer">
<parent link="RightFoot"/>
<origin xyz="0.076672  0.00083228   -0.010661" rpy="0.37286     0.70285     0.34581"/>
</sensor>
<!-- Sensor  15-->
<sensor name="LeftUpperLeg_gyro" type="gyroscope">
<parent link="LeftUpperLeg"/>
<origin xyz="0.0086013    0.041128    -0.24659" rpy="3.1146      1.3446     -1.6294"/>
</sensor>
<sensor name="LeftUpperLeg_accelerometer" type="accelerometer">
<parent link="LeftUpperLeg"/>
<origin xyz="0.0086013    0.041128    -0.24659" rpy="3.1146      1.3446     -1.6294"/>
</sensor>
<!-- Sensor  16-->
<sensor name="LeftLowerLeg_gyro" type="gyroscope">
<parent link="LeftLowerLeg"/>
<origin xyz="0.032062  -0.0086346    -0.13926" rpy="0.66209      1.4637     0.44871"/>
</sensor>
<sensor name="LeftLowerLeg_accelerometer" type="accelerometer">
<parent link="LeftLowerLeg"/>
<origin xyz="0.032062  -0.0086346    -0.13926" rpy="0.66209      1.4637     0.44871"/>
</sensor>
<!-- Sensor  17-->
<sensor name="LeftFoot_gyro" type="gyroscope">
<parent link="LeftFoot"/>
<origin xyz="0.076661  -0.0013708   -0.010771" rpy="-0.3193     0.63334     0.29874"/>
</sensor>
<sensor name="LeftFoot_accelerometer" type="accelerometer">
<parent link="LeftFoot"/>
<origin xyz="0.076661  -0.0013708   -0.010771" rpy="-0.3193     0.63334     0.29874"/>
</sensor>

It is highly malformed, because there is no <robot> root tag. However the parser should not crash.