Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "mrpt_localization_node.h"
00030 #include "mrpt_localization_node_defaults.h"
00031
00032 PFLocalizationNode::Parameters::Parameters(mrpt::slam::CActionRobotMovement2D::TMotionModelOptions *p)
00033 : PFLocalization::Parameters(p), node("~") {
00034 node.param<double>("rate", rate, MRPT_LOCALIZATION_NODE_DEFAULT_RATE);
00035 ROS_INFO("rate: %f", rate);
00036 node.getParam("gui_mrpt", gui_mrpt);
00037 ROS_INFO("gui_mrpt: %s", (gui_mrpt ? "true" : "false"));
00038 node.param<int>("parameter_update_skip", parameter_update_skip, MRPT_LOCALIZATION_NODE_DEFAULT_PARAMETER_UPDATE_SKIP);
00039 ROS_INFO("parameter_update_skip: %i", parameter_update_skip);
00040 node.getParam("ini_file", iniFile);
00041 ROS_INFO("ini_file: %s", iniFile.c_str());
00042 node.getParam("map_file", mapFile);
00043 ROS_INFO("map_file: %s", mapFile.c_str());
00044 node.param<std::string>("tf_prefix", tf_prefix, "");
00045 ROS_INFO("tf_prefix: %s", tf_prefix.c_str());
00046 node.param<std::string>("global_frame_id", global_frame_id, "map");
00047 ROS_INFO("global_frame_id: %s", global_frame_id.c_str());
00048 node.param<std::string>("odom_frame_id", odom_frame_id, "odom");
00049 ROS_INFO("odom_frame_id: %s", odom_frame_id.c_str());
00050 node.param<std::string>("base_frame_id", base_frame_id, "base_link");
00051 ROS_INFO("base_frame_id: %s", base_frame_id.c_str());
00052
00053 reconfigureFnc_ = boost::bind(&PFLocalizationNode::Parameters::callbackParameters, this , _1, _2);
00054 reconfigureServer_.setCallback(reconfigureFnc_);
00055 }
00056
00057 void PFLocalizationNode::Parameters::update(const unsigned long &loop_count) {
00058 if(loop_count % parameter_update_skip) return;
00059 node.getParam("debug", debug);
00060 if(loop_count == 0) ROS_INFO("debug: %s", (debug ? "true" : "false"));
00061 {
00062 int v = particlecloud_update_skip;
00063 node.param<int>("particlecloud_update_skip", particlecloud_update_skip, MRPT_LOCALIZATION_NODE_DEFAULT_PARTICLECLOUD_UPDATE_SKIP);
00064 if(v != particlecloud_update_skip) ROS_INFO("particlecloud_update_skip: %i", particlecloud_update_skip);
00065 }
00066 {
00067 int v = map_update_skip;
00068 node.param<int>("map_update_skip", map_update_skip, MRPT_LOCALIZATION_NODE_DEFAULT_MAP_UPDATE_SKIP);
00069 if(v != map_update_skip) ROS_INFO("map_update_skip: %i", map_update_skip);
00070 }
00071 }
00072
00073 void PFLocalizationNode::Parameters::callbackParameters (mrpt_localization::MotionConfig &config, uint32_t level ) {
00074 if(config.motion_noise_type == MOTION_MODEL_GAUSSIAN) {
00075 motionModelOptions->modelSelection = mrpt::slam::CActionRobotMovement2D::mmGaussian;
00076 motionModelOptions->gausianModel.a1 = config.gaussian_alpha_1;
00077 motionModelOptions->gausianModel.a2 = config.gaussian_alpha_2;
00078 motionModelOptions->gausianModel.a3 = config.gaussian_alpha_3;
00079 motionModelOptions->gausianModel.a4 = config.gaussian_alpha_4;
00080 motionModelOptions->gausianModel.minStdXY = config.gaussian_alpha_xy;
00081 motionModelOptions->gausianModel.minStdPHI = config.gaussian_alpha_phi;
00082 ROS_INFO("gausianModel.type: gaussian");
00083 ROS_INFO("gausianModel.a1: %f", motionModelOptions->gausianModel.a1);
00084 ROS_INFO("gausianModel.a2: %f", motionModelOptions->gausianModel.a2);
00085 ROS_INFO("gausianModel.a3: %f", motionModelOptions->gausianModel.a3);
00086 ROS_INFO("gausianModel.a4: %f", motionModelOptions->gausianModel.a4);
00087 ROS_INFO("gausianModel.minStdXY: %f", motionModelOptions->gausianModel.minStdXY);
00088 ROS_INFO("gausianModel.minStdPHI: %f", motionModelOptions->gausianModel.minStdPHI);
00089 }
00090 }