rawlog_record_node_parameters.cpp
Go to the documentation of this file.
1 /***********************************************************************************
2  * Revised BSD License *
3  * Copyright (c) 2014, Markus Bader <markus.bader@tuwien.ac.at> *
4  * All rights reserved. *
5  * *
6  * Redistribution and use in source and binary forms, with or without *
7  * modification, are permitted provided that the following conditions are met: *
8  * * Redistributions of source code must retain the above copyright *
9  * notice, this list of conditions and the following disclaimer. *
10  * * Redistributions in binary form must reproduce the above copyright *
11  * notice, this list of conditions and the following disclaimer in the *
12  * documentation and/or other materials provided with the distribution. *
13  * * Neither the name of the Vienna University of Technology nor the *
14  * names of its contributors may be used to endorse or promote products *
15  * derived from this software without specific prior written permission. *
16  * *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  *AND *
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  **
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
22  * DISCLAIMED. IN NO EVENT SHALL Markus Bader BE LIABLE FOR ANY *
23  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  **
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
27  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29  **
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  ** *
32  ***********************************************************************************/
33 
34 #include "rawlog_record_node.h"
36 
37 #include <mrpt/version.h>
38 #include <mrpt/system/filesystem.h>
39 
41  RawlogRecord::Parameters& base_params)
42  : node("~"), base_param_(base_params)
43 {
45  ROS_INFO("rate: %f", rate);
46  node.param<int>(
47  "parameter_update_skip", parameter_update_skip,
49  ROS_INFO("parameter_update_skip: %i", parameter_update_skip);
50  node.param<std::string>("tf_prefix", tf_prefix, "");
51  ROS_INFO("tf_prefix: %s", tf_prefix.c_str());
52  node.param<std::string>("odom_frame_id", odom_frame_id, "odom");
53  ROS_INFO("odom_frame_id: %s", odom_frame_id.c_str());
54  node.param<std::string>("base_frame_id", base_frame_id, "base_link");
55  ROS_INFO("base_frame_id: %s", base_frame_id.c_str());
56  node.getParam("raw_log_folder", base_param_.raw_log_folder);
58  mrpt::system::fileNameStripInvalidChars(base_param_.raw_log_folder);
59  ROS_INFO("raw_log_folder: %s", base_param_.raw_log_folder.c_str());
60  reconfigureFnc_ = boost::bind(
62  reconfigureServer_.setCallback(reconfigureFnc_);
63 
64  node.param<bool>("record_range_scan", base_param_.record_range_scan, true);
65  ROS_INFO(
66  "record_range_scan: %s",
67  (base_param_.record_range_scan ? "true" : "false"));
68  node.param<bool>(
69  "record_bearing_range", base_param_.record_bearing_range, false);
70  ROS_INFO(
71  "record_bearing_range: %s",
72  (base_param_.record_bearing_range ? "true" : "false"));
73  node.param<bool>(
74  "record_beacon_range", base_param_.record_beacon_range, false);
75  ROS_INFO(
76  "record_beacon_range: %s",
77  (base_param_.record_beacon_range ? "true" : "false"));
78 }
79 
80 void RawlogRecordNode::ParametersNode::update(const unsigned long& loop_count)
81 {
82  if (loop_count % parameter_update_skip) return;
83  node.getParam("debug", base_param_.debug);
84  if (loop_count == 0)
85  ROS_INFO("debug: %s", (base_param_.debug ? "true" : "false"));
86 }
87 
89  mrpt_rawlog::RawLogRecordConfig& config, uint32_t level)
90 {
91  using namespace mrpt::maps;
92  using namespace mrpt::obs;
93 
94  if (config.motion_noise_type == MOTION_MODEL_GAUSSIAN)
95  {
96  auto& motionModelOptions = base_param_.motionModelOptions;
97 
98  motionModelOptions.modelSelection = CActionRobotMovement2D::mmGaussian;
99  motionModelOptions.gaussianModel.a1 = config.motion_gaussian_alpha_1;
100  motionModelOptions.gaussianModel.a2 = config.motion_gaussian_alpha_2;
101  motionModelOptions.gaussianModel.a3 = config.motion_gaussian_alpha_3;
102  motionModelOptions.gaussianModel.a4 = config.motion_gaussian_alpha_4;
103  motionModelOptions.gaussianModel.minStdXY =
104  config.motion_gaussian_alpha_xy;
105  motionModelOptions.gaussianModel.minStdPHI =
106  config.motion_gaussian_alpha_phi;
107  ROS_INFO("gaussianModel.a1: %f", motionModelOptions.gaussianModel.a1);
108  ROS_INFO("gaussianModel.a2: %f", motionModelOptions.gaussianModel.a2);
109  ROS_INFO("gaussianModel.a3: %f", motionModelOptions.gaussianModel.a3);
110  ROS_INFO("gaussianModel.a4: %f", motionModelOptions.gaussianModel.a4);
111  ROS_INFO(
112  "gaussianModel.minStdXY: %f",
113  motionModelOptions.gaussianModel.minStdXY);
114  ROS_INFO(
115  "gaussianModel.minStdPHI: %f",
116  motionModelOptions.gaussianModel.minStdPHI);
117 
118  base_param_.bearing_range_std_range = config.bearing_range_std_range;
119  base_param_.bearing_range_std_yaw = config.bearing_range_std_yaw;
120  base_param_.bearing_range_std_pitch = config.bearing_range_std_pitch;
121  ROS_INFO(
122  "bearing_range_std_range: %f",
124  ROS_INFO(
125  "bearing_range_std_yaw: %f", base_param_.bearing_range_std_yaw);
126  ROS_INFO(
127  "bearing_range_std_pitch: %f",
129 
130  sensor_frame_sync_threshold = config.sensor_frame_sync_threshold;
131  ROS_INFO(
132  "sensor_frame_sync_threshold: %f", sensor_frame_sync_threshold);
133  }
134 }
ParametersNode(RawlogRecord::Parameters &base_params)
dynamic_reconfigure::Server< mrpt_rawlog::RawLogRecordConfig >::CallbackType reconfigureFnc_
RawlogRecord::Parameters & base_param_
CActionRobotMovement2D::TMotionModelOptions motionModelOptions
Definition: rawlog_record.h:76
#define RAWLOG_RECORD_NODE_DEFAULT_RATE
#define ROS_INFO(...)
bool param(const std::string &param_name, T &param_val, const T &default_val) const
#define RAWLOG_RECORD_NODE_DEFAULT_PARAMETER_UPDATE_SKIP
dynamic_reconfigure::Server< mrpt_rawlog::RawLogRecordConfig > reconfigureServer_
bool getParam(const std::string &key, std::string &s) const
void update(const unsigned long &loop_count)
void callbackParameters(mrpt_rawlog::RawLogRecordConfig &config, uint32_t level)


mrpt_rawlog
Author(s):
autogenerated on Thu Jun 6 2019 19:44:53