rawlog_record_node_parameters.cpp
Go to the documentation of this file.
00001 /***********************************************************************************
00002  * Revised BSD License *
00003  * Copyright (c) 2014, Markus Bader <markus.bader@tuwien.ac.at> *
00004  * All rights reserved. *
00005  *                                                                                 *
00006  * Redistribution and use in source and binary forms, with or without *
00007  * modification, are permitted provided that the following conditions are met: *
00008  *     * Redistributions of source code must retain the above copyright *
00009  *       notice, this list of conditions and the following disclaimer. *
00010  *     * Redistributions in binary form must reproduce the above copyright *
00011  *       notice, this list of conditions and the following disclaimer in the *
00012  *       documentation and/or other materials provided with the distribution. *
00013  *     * Neither the name of the Vienna University of Technology nor the *
00014  *       names of its contributors may be used to endorse or promote products *
00015  *       derived from this software without specific prior written permission. *
00016  *                                                                                 *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  *AND *
00019  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00020  **
00021  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
00022  * DISCLAIMED. IN NO EVENT SHALL Markus Bader BE LIABLE FOR ANY *
00023  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
00024  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00025  **
00026  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
00027  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
00028  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00029  **
00030  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  **                       *
00032  ***********************************************************************************/
00033 
00034 #include "rawlog_record_node.h"
00035 #include "rawlog_record_node_defaults.h"
00036 
00037 #include <mrpt/version.h>
00038 #include <mrpt/system/filesystem.h>
00039 
00040 RawlogRecordNode::ParametersNode::ParametersNode(
00041     RawlogRecord::Parameters& base_params)
00042     : node("~"), base_param_(base_params)
00043 {
00044         node.param<double>("rate", rate, RAWLOG_RECORD_NODE_DEFAULT_RATE);
00045         ROS_INFO("rate: %f", rate);
00046         node.param<int>(
00047                 "parameter_update_skip", parameter_update_skip,
00048                 RAWLOG_RECORD_NODE_DEFAULT_PARAMETER_UPDATE_SKIP);
00049         ROS_INFO("parameter_update_skip: %i", parameter_update_skip);
00050         node.param<std::string>("tf_prefix", tf_prefix, "");
00051         ROS_INFO("tf_prefix: %s", tf_prefix.c_str());
00052         node.param<std::string>("odom_frame_id", odom_frame_id, "odom");
00053         ROS_INFO("odom_frame_id: %s", odom_frame_id.c_str());
00054         node.param<std::string>("base_frame_id", base_frame_id, "base_link");
00055         ROS_INFO("base_frame_id: %s", base_frame_id.c_str());
00056         node.getParam("raw_log_folder", base_param_.raw_log_folder);
00057         base_param_.raw_log_folder =
00058             mrpt::system::fileNameStripInvalidChars(base_param_.raw_log_folder);
00059         ROS_INFO("raw_log_folder: %s", base_param_.raw_log_folder.c_str());
00060         reconfigureFnc_ = boost::bind(
00061                 &RawlogRecordNode::ParametersNode::callbackParameters, this, _1, _2);
00062         reconfigureServer_.setCallback(reconfigureFnc_);
00063 
00064         node.param<bool>("record_range_scan", base_param_.record_range_scan, true);
00065         ROS_INFO(
00066             "record_range_scan: %s",
00067             (base_param_.record_range_scan ? "true" : "false"));
00068         node.param<bool>(
00069             "record_bearing_range", base_param_.record_bearing_range, false);
00070         ROS_INFO(
00071             "record_bearing_range: %s",
00072             (base_param_.record_bearing_range ? "true" : "false"));
00073         node.param<bool>(
00074             "record_beacon_range", base_param_.record_beacon_range, false);
00075         ROS_INFO(
00076             "record_beacon_range: %s",
00077             (base_param_.record_beacon_range ? "true" : "false"));
00078 }
00079 
00080 void RawlogRecordNode::ParametersNode::update(const unsigned long& loop_count)
00081 {
00082         if (loop_count % parameter_update_skip) return;
00083         node.getParam("debug", base_param_.debug);
00084         if (loop_count == 0)
00085                 ROS_INFO("debug:  %s", (base_param_.debug ? "true" : "false"));
00086 }
00087 
00088 void RawlogRecordNode::ParametersNode::callbackParameters(
00089         mrpt_rawlog::RawLogRecordConfig& config, uint32_t level)
00090 {
00091         using namespace mrpt::maps;
00092         using namespace mrpt::obs;
00093 
00094         if (config.motion_noise_type == MOTION_MODEL_GAUSSIAN)
00095         {
00096                 auto& motionModelOptions = base_param_.motionModelOptions;
00097 
00098                 motionModelOptions.modelSelection = CActionRobotMovement2D::mmGaussian;
00099                 motionModelOptions.gaussianModel.a1 = config.motion_gaussian_alpha_1;
00100                 motionModelOptions.gaussianModel.a2 = config.motion_gaussian_alpha_2;
00101                 motionModelOptions.gaussianModel.a3 = config.motion_gaussian_alpha_3;
00102                 motionModelOptions.gaussianModel.a4 = config.motion_gaussian_alpha_4;
00103                 motionModelOptions.gaussianModel.minStdXY =
00104                     config.motion_gaussian_alpha_xy;
00105                 motionModelOptions.gaussianModel.minStdPHI =
00106                     config.motion_gaussian_alpha_phi;
00107                 ROS_INFO("gaussianModel.a1: %f", motionModelOptions.gaussianModel.a1);
00108                 ROS_INFO("gaussianModel.a2: %f", motionModelOptions.gaussianModel.a2);
00109                 ROS_INFO("gaussianModel.a3: %f", motionModelOptions.gaussianModel.a3);
00110                 ROS_INFO("gaussianModel.a4: %f", motionModelOptions.gaussianModel.a4);
00111                 ROS_INFO(
00112                         "gaussianModel.minStdXY: %f",
00113                         motionModelOptions.gaussianModel.minStdXY);
00114                 ROS_INFO(
00115                         "gaussianModel.minStdPHI: %f",
00116                         motionModelOptions.gaussianModel.minStdPHI);
00117 
00118                 base_param_.bearing_range_std_range = config.bearing_range_std_range;
00119                 base_param_.bearing_range_std_yaw = config.bearing_range_std_yaw;
00120                 base_param_.bearing_range_std_pitch = config.bearing_range_std_pitch;
00121                 ROS_INFO(
00122                     "bearing_range_std_range: %f",
00123                     base_param_.bearing_range_std_range);
00124                 ROS_INFO(
00125                     "bearing_range_std_yaw: %f", base_param_.bearing_range_std_yaw);
00126                 ROS_INFO(
00127                     "bearing_range_std_pitch: %f",
00128                     base_param_.bearing_range_std_pitch);
00129 
00130                 sensor_frame_sync_threshold = config.sensor_frame_sync_threshold;
00131                 ROS_INFO(
00132                     "sensor_frame_sync_threshold: %f", sensor_frame_sync_threshold);
00133         }
00134 }


mrpt_rawlog
Author(s):
autogenerated on Thu Jun 6 2019 21:53:23