Skip to content

Commit

Permalink
Fix assumption on global locale in URDF parser
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro authored and gergondet committed Aug 30, 2019
1 parent e12c9fe commit c8b5cbb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/urdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <ciso646>
#include <cmath>
#include <iostream>
#include <locale>
#include <tinyxml2.h>

namespace mc_rbdyn_urdf
Expand All @@ -25,6 +26,12 @@ std::vector<double> attrToList(const tinyxml2::XMLElement & dom,
if(attrTxt)
{
std::stringstream ss;
// Every real number in a URDF file needs to be parsed assuming that the
// decimal point separator is the period, as specified in XML Schema
// definition of xs:double. The call to imbue ensures that a suitable
// locale is used, instead of using the current C++ global locale.
// Related PR: https://github.com/ros/urdfdom_headers/pull/42 .
ss.imbue(std::locale::classic());
ss << attrTxt;
double tmp;
while(ss.good())
Expand Down

0 comments on commit c8b5cbb

Please sign in to comment.