mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 00:37:46 +08:00
Parameters backward compatibility: check for typed parameters (not only string)
This commit is contained in:
+22
-2
@@ -305,14 +305,34 @@ void CoreWrapper::onInit()
|
||||
++iter)
|
||||
{
|
||||
std::string vStr;
|
||||
bool vBool;
|
||||
int vInt;
|
||||
double vDouble;
|
||||
std::string paramValue;
|
||||
if(pnh.getParam(iter->first, vStr))
|
||||
{
|
||||
paramValue = vStr;
|
||||
}
|
||||
else if(pnh.getParam(iter->first, vBool))
|
||||
{
|
||||
paramValue = uBool2Str(vBool);
|
||||
}
|
||||
else if(pnh.getParam(iter->first, vDouble))
|
||||
{
|
||||
paramValue = uNumber2Str(vDouble);
|
||||
}
|
||||
else if(pnh.getParam(iter->first, vInt))
|
||||
{
|
||||
paramValue = uNumber2Str(vInt);
|
||||
}
|
||||
if(!paramValue.empty())
|
||||
{
|
||||
if(iter->second.first)
|
||||
{
|
||||
// can be migrated
|
||||
uInsert(parameters_, ParametersPair(iter->second.second, vStr));
|
||||
uInsert(parameters_, ParametersPair(iter->second.second, paramValue));
|
||||
NODELET_WARN("Rtabmap: Parameter name changed: \"%s\" -> \"%s\". Please update your launch file accordingly. Value \"%s\" is still set to the new parameter name.",
|
||||
iter->first.c_str(), iter->second.second.c_str(), vStr.c_str());
|
||||
iter->first.c_str(), iter->second.second.c_str(), paramValue.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -129,14 +129,34 @@ private:
|
||||
++iter)
|
||||
{
|
||||
std::string vStr;
|
||||
bool vBool;
|
||||
int vInt;
|
||||
double vDouble;
|
||||
std::string paramValue;
|
||||
if(pnh.getParam(iter->first, vStr))
|
||||
{
|
||||
paramValue = vStr;
|
||||
}
|
||||
else if(pnh.getParam(iter->first, vBool))
|
||||
{
|
||||
paramValue = uBool2Str(vBool);
|
||||
}
|
||||
else if(pnh.getParam(iter->first, vDouble))
|
||||
{
|
||||
paramValue = uNumber2Str(vDouble);
|
||||
}
|
||||
else if(pnh.getParam(iter->first, vInt))
|
||||
{
|
||||
paramValue = uNumber2Str(vInt);
|
||||
}
|
||||
if(!paramValue.empty())
|
||||
{
|
||||
if(iter->second.first)
|
||||
{
|
||||
// can be migrated
|
||||
uInsert(parameters, rtabmap::ParametersPair(iter->second.second, vStr));
|
||||
uInsert(parameters, rtabmap::ParametersPair(iter->second.second, paramValue));
|
||||
NODELET_ERROR("obstacles_detection: Parameter name changed: \"%s\" -> \"%s\". Please update your launch file accordingly. Value \"%s\" is still set to the new parameter name.",
|
||||
iter->first.c_str(), iter->second.second.c_str(), vStr.c_str());
|
||||
iter->first.c_str(), iter->second.second.c_str(), paramValue.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user