parameter_server.cpp
Go to the documentation of this file.
00001 /*
00002  * parameter_server.cpp
00003  *
00004  */
00005 #include "rgbd_registration/parameter_server.h"
00006 
00007 using namespace std;
00008 
00009 ParameterServer* ParameterServer::_instance = NULL;
00010 
00011 ParameterServer::ParameterServer() {
00012   std::stringstream node_pre;
00013   node_pre << "/" << ros::this_node::getName() << "/config/";
00014   pre = node_pre.str();
00015 
00016     defaultConfig();
00017     getValues();
00018 }
00019 
00020 ParameterServer* ParameterServer::instance() {
00021     if (_instance == NULL) {
00022         _instance = new ParameterServer();
00023     }
00024     //_instance->getValues();
00025     return _instance;
00026 }
00027 
00028 //        Default config for Frame Alignment
00029 // #####Please see launch/rgbd_registration.launch for a description of these parameters ######
00030 // it is recommended to change the parameters in the launchfile rather than the source!
00031 void ParameterServer::defaultConfig() {
00032 
00033     config["source_cloud_filename"]           = std::string("../pcds/node_0.pcd");
00034     config["target_cloud_filename"]           = std::string("../pcds/node_4.pcd");
00035 
00036     // ----------RGB feature extraction------------
00037     config["feature_extractor"]               = std::string("SIFT");
00038     config["feature_descriptor"]              = std::string("SIFT");
00039     config["descriptor_matcher"]              = std::string("FLANN");
00040           config["minimum_inliers"]                 = static_cast<int> (30);
00041     config["max_dist_for_inliers"]            = static_cast<double> (0.03);
00042     config["ransac_iterations"]               = static_cast<int> (1000);
00043     config["save_features_image"]             = static_cast<bool> (true);
00044     config["show_feature_matching"]           = static_cast<bool> (true);
00045     config["save_all_pointclouds"]            = static_cast<bool> (true);
00046 
00047     // --------------ICP settings------------------
00048     config["use_openmp_normal_calculation"]   = static_cast<bool> (true);
00049     config["alpha"]                           = static_cast<double> (0.5);
00050     config["max_correspondence_dist"]         = static_cast<double> (0.05);
00051     config["max_iterations"]                  = static_cast<int> (75);
00052     config["transformation_epsilon"]          = static_cast<double> (1e-8);
00053     config["euclidean_fitness_epsilon"]       = static_cast<double> (0);
00054     config["use_ransac_to_initialize_icp"]    = static_cast<bool> (false);
00055     config["enable_pcl_debug_verbosity"]      = static_cast<bool> (true);
00056 }
00057 
00058 void ParameterServer::getValues() {
00059     map<string, boost::any>::const_iterator itr;
00060     for (itr = config.begin(); itr != config.end(); ++itr) {
00061         string name = itr->first;
00062         if (itr->second.type() == typeid(string)) {
00063             config[name] = getFromParameterServer<string> (pre + name,
00064                     boost::any_cast<string>(itr->second));
00065             ROS_DEBUG_STREAM("Value for " << name << ":             " << boost::any_cast<string>(itr->second));
00066         } else if (itr->second.type() == typeid(int)) {
00067             config[name] = getFromParameterServer<int> (pre + name,
00068                     boost::any_cast<int>(itr->second));
00069             ROS_DEBUG_STREAM("Value for " << name << ":             " << boost::any_cast<int>(itr->second));
00070         } else if (itr->second.type() == typeid(double)) {
00071             config[name] = getFromParameterServer<double> (pre + name,
00072                     boost::any_cast<double>(itr->second));
00073             ROS_DEBUG_STREAM("Value for " << name << ":             " << boost::any_cast<double>(itr->second));
00074         } else if (itr->second.type() == typeid(bool)) {
00075             config[name] = getFromParameterServer<bool> (pre + name,
00076                     boost::any_cast<bool>(itr->second));
00077             ROS_DEBUG_STREAM("Value for " << name << ":             " << boost::any_cast<bool>(itr->second));
00078         }
00079     }
00080 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


rgbd_registration
Author(s): Ross Kidson
autogenerated on Sun Oct 6 2013 12:00:40