Added parameters backward compatibility approach from 0.11.0

This commit is contained in:
matlabbe
2015-11-26 13:35:21 -05:00
parent 542437c135
commit 82e9e9c806
3 changed files with 46 additions and 121 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ find_package(octomap_ros)
## System dependencies are found with CMake's conventions ## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system) # find_package(Boost REQUIRED COMPONENTS system)
find_package(RTABMap 0.10.12 REQUIRED) find_package(RTABMap 0.11.0 REQUIRED)
find_package(OpenCV REQUIRED) find_package(OpenCV REQUIRED)
+17 -68
View File
@@ -258,83 +258,32 @@ CoreWrapper::CoreWrapper(bool deleteDbOnStart) :
} }
// Backward compatibility // Backward compatibility
std::list<std::string> oldParameterNames; for(std::map<std::string, std::pair<bool, std::string> >::const_iterator iter=Parameters::getRemovedParameters().begin();
oldParameterNames.push_back("LccReextract/LoopClosureFeatures"); iter!=Parameters::getRemovedParameters().end();
oldParameterNames.push_back("Rtabmap/DetectorStrategy"); ++iter)
oldParameterNames.push_back("RGBD/ScanMatchingSize");
oldParameterNames.push_back("RGBD/LocalLoopDetectionRadius");
oldParameterNames.push_back("RGBD/ToroIterations");
oldParameterNames.push_back("Mem/RehearsedNodesKept");
oldParameterNames.push_back("Odom/PnPEstimation");
oldParameterNames.push_back("LccBow/MaxDepth");
oldParameterNames.push_back("GFTT/MaxCorners");
for(std::list<std::string>::iterator iter=oldParameterNames.begin(); iter!=oldParameterNames.end(); ++iter)
{ {
std::string vStr; std::string vStr;
if(pnh.getParam(*iter, vStr)) if(pnh.getParam(iter->first, vStr))
{ {
if(iter->compare("GFTT/MaxCorners") == 0) if(iter->second.first)
{ {
ROS_WARN("Parameter name changed: GFTT/MaxCorners -> %s. Please update your launch file accordingly.", // can be migrated
Parameters::kKpWordsPerImage().c_str()); parameters_.at(iter->second.second)= vStr;
ROS_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());
} }
else if(iter->compare("LccBow/MaxDepth") == 0) else
{ {
ROS_WARN("Parameter name changed: LccBow/MaxDepth -> %s. Please update your launch file accordingly.", if(iter->second.second.empty())
Parameters::kLccReextractMaxDepth().c_str()); {
parameters_.at(Parameters::kLccReextractMaxDepth())= vStr; ROS_WARN("Rtabmap: Parameter \"%s\" doesn't exist anymore!",
iter->first.c_str());
} }
else if(iter->compare("LccReextract/LoopClosureFeatures") == 0) else
{ {
ROS_WARN("Parameter name changed: LccReextract/LoopClosureFeatures -> %s. Please update your launch file accordingly.", ROS_WARN("Rtabmap: Parameter \"%s\" doesn't exist anymore! You may look at this similar parameter: \"%s\"",
Parameters::kLccReextractActivated().c_str()); iter->first.c_str(), iter->second.second.c_str());
parameters_.at(Parameters::kLccReextractActivated())= vStr;
} }
else if(iter->compare("Rtabmap/DetectorStrategy") == 0)
{
ROS_WARN("Parameter name changed: Rtabmap/DetectorStrategy -> %s. Please update your launch file accordingly.",
Parameters::kKpDetectorStrategy().c_str());
parameters_.at(Parameters::kKpDetectorStrategy())= vStr;
}
else if(iter->compare("RGBD/ScanMatchingSize") == 0)
{
ROS_WARN("Parameter name changed: RGBD/ScanMatchingSize -> %s. Please update your launch file accordingly.",
Parameters::kRGBDPoseScanMatching().c_str());
parameters_.at(Parameters::kRGBDPoseScanMatching())= std::atoi(vStr.c_str()) > 0?"true":"false";
}
else if(iter->compare("RGBD/LocalLoopDetectionRadius") == 0)
{
ROS_WARN("Parameter name changed: RGBD/LocalLoopDetectionRadius -> %s. Please update your launch file accordingly.",
Parameters::kRGBDLocalRadius().c_str());
parameters_.at(Parameters::kRGBDLocalRadius())= vStr;
}
else if(iter->compare("RGBD/ToroIterations") == 0)
{
ROS_WARN("Parameter name changed: RGBD/ToroIterations -> %s. Please update your launch file accordingly.",
Parameters::kRGBDOptimizeIterations().c_str());
parameters_.at(Parameters::kRGBDOptimizeIterations())= vStr;
}
else if(iter->compare("Mem/RehearsedNodesKept") == 0)
{
ROS_WARN("Parameter name changed: Mem/RehearsedNodesKept -> %s. Please update your launch file accordingly.",
Parameters::kMemNotLinkedNodesKept().c_str());
parameters_.at(Parameters::kMemNotLinkedNodesKept())= vStr;
}
else if(iter->compare("RGBD/LocalLoopDetectionMaxDiffID") == 0)
{
ROS_WARN("Parameter name changed: RGBD/LocalLoopDetectionMaxDiffID -> %s. Please update your launch file accordingly.",
Parameters::kRGBDLocalLoopDetectionMaxGraphDepth().c_str());
parameters_.at(Parameters::kRGBDLocalLoopDetectionMaxGraphDepth())= vStr;
}
else if(iter->compare("RGBD/PlanVirtualLinksMaxDiffID") == 0)
{
ROS_WARN("Parameter \"RGBD/PlanVirtualLinksMaxDiffID\" doesn't exist anymore.");
}
else if(iter->compare("RGBD/LocalLoopDetectionMaxDiffID") == 0)
{
ROS_WARN("Parameter name changed: Odom/PnPEstimation -> %s. Please update your launch file accordingly.",
Parameters::kOdomEstimationType().c_str());
parameters_.at(Parameters::kOdomEstimationType())= uNumber2Str(1);
} }
} }
} }
+22 -46
View File
@@ -174,7 +174,7 @@ OdometryROS::OdometryROS(int argc, char * argv[], bool stereo) :
iter->second = uNumber2Str(vInt); iter->second = uNumber2Str(vInt);
} }
if(iter->first.compare(Parameters::kOdomMinInliers()) == 0 && atoi(iter->second.c_str()) < 8) if(iter->first.compare(Parameters::kVisMinInliers()) == 0 && atoi(iter->second.c_str()) < 8)
{ {
ROS_WARN("Parameter min_inliers must be >= 8, setting to 8..."); ROS_WARN("Parameter min_inliers must be >= 8, setting to 8...");
iter->second = uNumber2Str(8); iter->second = uNumber2Str(8);
@@ -182,54 +182,32 @@ OdometryROS::OdometryROS(int argc, char * argv[], bool stereo) :
} }
// Backward compatibility // Backward compatibility
std::list<std::string> oldParameterNames; for(std::map<std::string, std::pair<bool, std::string> >::const_iterator iter=Parameters::getRemovedParameters().begin();
oldParameterNames.push_back("Odom/Type"); iter!=Parameters::getRemovedParameters().end();
oldParameterNames.push_back("Odom/MaxWords"); ++iter)
oldParameterNames.push_back("Odom/WordsRatio");
oldParameterNames.push_back("Odom/LocalHistory");
oldParameterNames.push_back("Odom/NearestNeighbor");
oldParameterNames.push_back("Odom/NNDR");
oldParameterNames.push_back("GFTT/MaxCorners");
for(std::list<std::string>::iterator iter=oldParameterNames.begin(); iter!=oldParameterNames.end(); ++iter)
{ {
std::string vStr; std::string vStr;
if(pnh.getParam(*iter, vStr)) if(pnh.getParam(iter->first, vStr))
{ {
if(iter->compare("Odom/Type") == 0) if(iter->second.first)
{ {
ROS_WARN("Parameter name changed: Odom/Type -> %s. Please update your launch file accordingly.", // can be migrated
Parameters::kOdomFeatureType().c_str()); parameters_.at(iter->second.second)= vStr;
parameters_.at(Parameters::kOdomFeatureType())= vStr; ROS_WARN("Odometry: 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());
} }
else if(iter->compare("Odom/MaxWords") == 0) else
{ {
ROS_WARN("Parameter name changed: Odom/MaxWords -> %s. Please update your launch file accordingly.", if(iter->second.second.empty())
Parameters::kOdomMaxFeatures().c_str()); {
parameters_.at(Parameters::kOdomMaxFeatures())= vStr; ROS_WARN("Odometry: Parameter \"%s\" doesn't exist anymore!",
iter->first.c_str());
} }
else if(iter->compare("Odom/LocalHistory") == 0) else
{ {
ROS_WARN("Parameter name changed: Odom/LocalHistory -> %s. Please update your launch file accordingly.", ROS_WARN("Odometry: Parameter \"%s\" doesn't exist anymore! You may look at this similar parameter: \"%s\"",
Parameters::kOdomBowLocalHistorySize().c_str()); iter->first.c_str(), iter->second.second.c_str());
parameters_.at(Parameters::kOdomBowLocalHistorySize())= vStr;
} }
else if(iter->compare("Odom/NearestNeighbor") == 0)
{
ROS_WARN("Parameter name changed: Odom/NearestNeighbor -> %s. Please update your launch file accordingly.",
Parameters::kOdomBowNNType().c_str());
parameters_.at(Parameters::kOdomBowNNType())= vStr;
}
else if(iter->compare("Odom/NNDR") == 0)
{
ROS_WARN("Parameter name changed: Odom/NNDR -> %s. Please update your launch file accordingly.",
Parameters::kOdomBowNNDR().c_str());
parameters_.at(Parameters::kOdomBowNNDR())= vStr;
}
else if(iter->compare("GFTT/MaxCorners") == 0)
{
ROS_WARN("Parameter GFTT/MaxCorners doesn't exist anymore, use %s. Please update your launch file accordingly.",
Parameters::kOdomMaxFeatures().c_str());
parameters_.at(Parameters::kOdomMaxFeatures())= vStr;
} }
} }
} }
@@ -289,15 +267,13 @@ rtabmap::ParametersMap OdometryROS::getDefaultOdometryParameters(bool stereo)
group.compare("FREAK") == 0 || group.compare("FREAK") == 0 ||
group.compare("BRIEF") == 0 || group.compare("BRIEF") == 0 ||
group.compare("GFTT") == 0 || group.compare("GFTT") == 0 ||
group.compare("BRISK") == 0) group.compare("BRISK") == 0 ||
group.compare("Reg") == 0 ||
group.compare("Vis") == 0)
{ {
if(stereo) if(stereo)
{ {
if(iter->first.compare(Parameters::kOdomMaxDepth()) == 0) if(iter->first.compare(Parameters::kVisEstimationType()) == 0)
{
iter->second = "0"; // infinity
}
else if(iter->first.compare(Parameters::kOdomEstimationType()) == 0)
{ {
iter->second = "1"; // 3D->2D (PNP) iter->second = "1"; // 3D->2D (PNP)
} }