You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Parsing floats in URDF yields wrong value depending on locale #41
urdfdom_headers uses std::stod to parse floating point values like position (xyz) and rotation (rpy) from URDF files. The result of std::stod is locale dependant. So with e.g. a German locale (de_DE.UTF-8) "1.57079632679" is parsed to 1.
This is the case in urdfdom_headers/urdf_model/include/urdf_model/pose.h Line 70 (not necessarily exclusive)
In my opinion the issue described here can be linked to this error, as can be the issue described here.
This link states that "[...] using a stringstream to convert it worked perfectly fine."
If desired I can fix this issue using stringstream and create a pull request, but I have to admit I have no background knowledge in ros package building and testing procedures.
So I ended up looking into this a bit. @traversaro did some good investigating of the issue in gbionics/idyntree#288 (comment), and digging down into the URDF schema, this is represented as an xs:double. Looking at the XSD document here, it says that the mantissa for a double is represented as a "decimal" number. And looking at the XSD document here, a decimal number is a "finite-length sequence of decimal digits (#x30-#x39) separated by a period as a decimal indicator". Thus, the locale should have no effect on how the document is parsed, and using str::stod is incorrect. I've prepared a patch for urdfdom_headers which switches to using the stream operator; I'll open that presently.
Activity
traversaro commentedon Nov 20, 2017
Related urdfdom issue: ros/urdfdom#98 .
clalancette commentedon Nov 20, 2017
So I ended up looking into this a bit. @traversaro did some good investigating of the issue in gbionics/idyntree#288 (comment), and digging down into the URDF schema, this is represented as an xs:double. Looking at the XSD document here, it says that the mantissa for a double is represented as a "decimal" number. And looking at the XSD document here, a decimal number is a "finite-length sequence of decimal digits (#x30-#x39) separated by a period as a decimal indicator". Thus, the locale should have no effect on how the document is parsed, and using
str::stodis incorrect. I've prepared a patch for urdfdom_headers which switches to using the stream operator; I'll open that presently.greimela-si commentedon Feb 15, 2018
We also ran into this issue over at ros2/rviz when migrating the RobotModel display.