mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
changed all std::atof() to uStr2Float() to fix locale comma float conversion problem
This commit is contained in:
@@ -75,7 +75,7 @@ void BayesFilter::setPredictionLC(const std::string & prediction)
|
||||
bool valid = true;
|
||||
for(std::list<std::string>::iterator iter = strValues.begin(); iter!=strValues.end(); ++iter)
|
||||
{
|
||||
tmpValues[i] = std::atof((*iter).c_str());
|
||||
tmpValues[i] = uStr2Float((*iter).c_str());
|
||||
//UINFO("%d=%e", i, tmpValues[i]);
|
||||
if(tmpValues[i] < 0.0 || tmpValues[i]>1.0)
|
||||
{
|
||||
|
||||
@@ -251,7 +251,7 @@ cv::Rect Feature2D::computeRoi(const cv::Mat & image, const std::string & roiRat
|
||||
unsigned int i=0;
|
||||
for(std::list<std::string>::iterator iter = strValues.begin(); iter!=strValues.end(); ++iter)
|
||||
{
|
||||
values[i] = std::atof((*iter).c_str());
|
||||
values[i] = uStr2Float(*iter);
|
||||
++i;
|
||||
}
|
||||
|
||||
|
||||
@@ -439,12 +439,12 @@ bool loadTOROGraph(const std::string & fileName,
|
||||
{
|
||||
//VERTEX3
|
||||
int id = atoi(strList[1].c_str());
|
||||
float x = atof(strList[2].c_str());
|
||||
float y = atof(strList[3].c_str());
|
||||
float z = atof(strList[4].c_str());
|
||||
float roll = atof(strList[5].c_str());
|
||||
float pitch = atof(strList[6].c_str());
|
||||
float yaw = atof(strList[7].c_str());
|
||||
float x = uStr2Float(strList[2]);
|
||||
float y = uStr2Float(strList[3]);
|
||||
float z = uStr2Float(strList[4]);
|
||||
float roll = uStr2Float(strList[5]);
|
||||
float pitch = uStr2Float(strList[6]);
|
||||
float yaw = uStr2Float(strList[7]);
|
||||
Transform pose = Transform::fromEigen3f(pcl::getTransformation(x, y, z, roll, pitch, yaw));
|
||||
std::map<int, Transform>::iterator iter = poses.find(id);
|
||||
if(iter != poses.end())
|
||||
@@ -461,12 +461,12 @@ bool loadTOROGraph(const std::string & fileName,
|
||||
//EDGE3
|
||||
int idFrom = atoi(strList[1].c_str());
|
||||
int idTo = atoi(strList[2].c_str());
|
||||
float x = atof(strList[3].c_str());
|
||||
float y = atof(strList[4].c_str());
|
||||
float z = atof(strList[5].c_str());
|
||||
float roll = atof(strList[6].c_str());
|
||||
float pitch = atof(strList[7].c_str());
|
||||
float yaw = atof(strList[8].c_str());
|
||||
float x = uStr2Float(strList[3]);
|
||||
float y = uStr2Float(strList[4]);
|
||||
float z = uStr2Float(strList[5]);
|
||||
float roll = uStr2Float(strList[6]);
|
||||
float pitch = uStr2Float(strList[7]);
|
||||
float yaw = uStr2Float(strList[8]);
|
||||
Transform transform = Transform::fromEigen3f(pcl::getTransformation(x, y, z, roll, pitch, yaw));
|
||||
if(poses.find(idFrom) != poses.end() && poses.find(idTo) != poses.end())
|
||||
{
|
||||
|
||||
@@ -611,7 +611,7 @@ void Memory::setRoi(const std::string & roi)
|
||||
unsigned int i=0;
|
||||
for(std::list<std::string>::iterator iter = strValues.begin(); iter!=strValues.end(); ++iter)
|
||||
{
|
||||
tmpValues[i] = std::atof((*iter).c_str());
|
||||
tmpValues[i] = uStr2Float(*iter);
|
||||
++i;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <rtabmap/utilite/UConversion.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <sstream>
|
||||
|
||||
namespace rtabmap
|
||||
{
|
||||
@@ -112,7 +113,7 @@ void Parameters::parse(const ParametersMap & parameters, const std::string & key
|
||||
ParametersMap::const_iterator iter = parameters.find(key);
|
||||
if(iter != parameters.end())
|
||||
{
|
||||
value = atof(iter->second.c_str());
|
||||
value = uStr2Float(iter->second);
|
||||
}
|
||||
}
|
||||
void Parameters::parse(const ParametersMap & parameters, const std::string & key, double & value)
|
||||
@@ -120,7 +121,7 @@ void Parameters::parse(const ParametersMap & parameters, const std::string & key
|
||||
ParametersMap::const_iterator iter = parameters.find(key);
|
||||
if(iter != parameters.end())
|
||||
{
|
||||
value = atof(iter->second.c_str());
|
||||
value = uStr2Double(iter->second);
|
||||
}
|
||||
}
|
||||
void Parameters::parse(const ParametersMap & parameters, const std::string & key, std::string & value)
|
||||
|
||||
@@ -71,7 +71,7 @@ void VWDictionary::parseParameters(const ParametersMap & parameters)
|
||||
Parameters::parse(parameters, Parameters::kKpNndrRatio(), _nndrRatio);
|
||||
Parameters::parse(parameters, Parameters::kKpNewWordsComparedTogether(), _newWordsComparedTogether);
|
||||
|
||||
UASSERT(_nndrRatio > 0.0f);
|
||||
UASSERT_MSG(_nndrRatio > 0.0f, uFormat("String=%s value=%f", uContains(parameters, Parameters::kKpNndrRatio())?parameters.at(Parameters::kKpNndrRatio()).c_str():"", _nndrRatio).c_str());
|
||||
|
||||
std::string dictionaryPath = _dictionaryPath;
|
||||
bool incrementalDictionary = _incrementalDictionary;
|
||||
@@ -167,7 +167,7 @@ void VWDictionary::setFixedDictionary(const std::string & dictionaryPath)
|
||||
//get descriptor
|
||||
for(;i<dimension && iter != strList.end(); ++i, ++iter)
|
||||
{
|
||||
descriptor.at<float>(i) = std::atof(iter->c_str());
|
||||
descriptor.at<float>(i) = uStr2Float(*iter);
|
||||
}
|
||||
if(i != dimension)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user