parameters.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2020, the mcl_3dl authors
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
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 copyright holder nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #include <algorithm>
31 #include <limits>
32 #include <memory>
33 #include <string>
34 
35 #include <ros/ros.h>
36 
37 #include <mcl_3dl/parameters.h>
38 
40 
41 namespace mcl_3dl
42 {
44 {
45  pnh.param("fake_imu", fake_imu_, false);
46  pnh.param("fake_odom", fake_odom_, false);
47  if (fake_imu_ && fake_odom_)
48  {
49  ROS_ERROR("One of IMU and Odometry must be enabled");
50  return false;
51  }
52 
53  pnh.param("map_frame", frame_ids_["map"], std::string("map"));
54  pnh.param("robot_frame", frame_ids_["base_link"], std::string("base_link"));
55  pnh.param("odom_frame", frame_ids_["odom"], std::string("odom"));
56  pnh.param("floor_frame", frame_ids_["floor"], std::string("floor"));
57 
58  mcl_3dl_compat::paramRename<double>(pnh, "likelihood/clip_near", "clip_near");
59  mcl_3dl_compat::paramRename<double>(pnh, "likelihood/clip_far", "clip_far");
60  mcl_3dl_compat::paramRename<double>(pnh, "likelihood/clip_z_min", "clip_z_min");
61  mcl_3dl_compat::paramRename<double>(pnh, "likelihood/clip_z_max", "clip_z_max");
62  mcl_3dl_compat::paramRename<double>(pnh, "likelihood/match_dist_min", "match_dist_min");
63  mcl_3dl_compat::paramRename<double>(pnh, "likelihood/match_dist_flat", "match_dist_flat");
64  mcl_3dl_compat::paramRename<double>(pnh, "likelihood/match_weight", "match_weight");
65  mcl_3dl_compat::paramRename<double>(pnh, "likelihood/num_points", "num_points");
66  mcl_3dl_compat::paramRename<double>(pnh, "likelihood/num_points_global", "num_points_global");
67 
68  mcl_3dl_compat::paramRename<double>(pnh, "beam/clip_near", "clip_beam_near");
69  mcl_3dl_compat::paramRename<double>(pnh, "beam/clip_far", "clip_beam_far");
70  mcl_3dl_compat::paramRename<double>(pnh, "beam/clip_z_min", "clip_beam_z_min");
71  mcl_3dl_compat::paramRename<double>(pnh, "beam/clip_z_max", "clip_beam_z_max");
72  mcl_3dl_compat::paramRename<double>(pnh, "beam/num_points", "num_points_beam");
73  mcl_3dl_compat::paramRename<double>(pnh, "beam/beam_likelihood", "beam_likelihood");
74  mcl_3dl_compat::paramRename<double>(pnh, "beam/ang_total_ref", "ang_total_ref");
75 
76  pnh.param("map_downsample_x", map_downsample_x_, 0.1);
77  pnh.param("map_downsample_y", map_downsample_y_, 0.1);
78  pnh.param("map_downsample_z", map_downsample_z_, 0.1);
79  pnh.param("downsample_x", downsample_x_, 0.1);
80  pnh.param("downsample_y", downsample_y_, 0.1);
81  pnh.param("downsample_z", downsample_z_, 0.05);
83  std::min(
87  std::max(
90 
91  pnh.param("update_downsample_x", update_downsample_x_, 0.3);
92  pnh.param("update_downsample_y", update_downsample_y_, 0.3);
93  pnh.param("update_downsample_z", update_downsample_z_, 0.3);
94 
95  double map_update_interval_t;
96  pnh.param("map_update_interval_interval", map_update_interval_t, 2.0);
97  map_update_interval_.reset(new ros::Duration(map_update_interval_t));
98 
99  pnh.param("dist_weight_x", dist_weight_[0], 1.0f);
100  pnh.param("dist_weight_y", dist_weight_[1], 1.0f);
101  pnh.param("dist_weight_z", dist_weight_[2], 5.0f);
102  dist_weight_[3] = 0.0;
103 
104  pnh.param("global_localization_grid_lin", global_localization_grid_, 0.3);
105  double grid_ang;
106  pnh.param("global_localization_grid_ang", grid_ang, 0.524);
107  global_localization_div_yaw_ = std::lround(2 * M_PI / grid_ang);
108 
109  pnh.param("num_particles", num_particles_, 64);
110 
111  pnh.param("resample_var_x", resample_var_x_, 0.05);
112  pnh.param("resample_var_y", resample_var_y_, 0.05);
113  pnh.param("resample_var_z", resample_var_z_, 0.05);
114  pnh.param("resample_var_roll", resample_var_roll_, 0.05);
115  pnh.param("resample_var_pitch", resample_var_pitch_, 0.05);
116  pnh.param("resample_var_yaw", resample_var_yaw_, 0.05);
117  pnh.param("expansion_var_x", expansion_var_x_, 0.2);
118  pnh.param("expansion_var_y", expansion_var_y_, 0.2);
119  pnh.param("expansion_var_z", expansion_var_z_, 0.2);
120  pnh.param("expansion_var_roll", expansion_var_roll_, 0.05);
121  pnh.param("expansion_var_pitch", expansion_var_pitch_, 0.05);
122  pnh.param("expansion_var_yaw", expansion_var_yaw_, 0.05);
123  pnh.param("match_ratio_thresh", match_ratio_thresh_, 0.0);
124 
125  pnh.param("odom_err_lin_lin", odom_err_lin_lin_, 0.10);
126  pnh.param("odom_err_lin_ang", odom_err_lin_ang_, 0.05);
127  pnh.param("odom_err_ang_lin", odom_err_ang_lin_, 0.05);
128  pnh.param("odom_err_ang_ang", odom_err_ang_ang_, 0.05);
129 
130  pnh.param("odom_err_integ_lin_tc", odom_err_integ_lin_tc_, 10.0);
131  pnh.param("odom_err_integ_lin_sigma", odom_err_integ_lin_sigma_, 100.0);
132  pnh.param("odom_err_integ_ang_tc", odom_err_integ_ang_tc_, 10.0);
133  pnh.param("odom_err_integ_ang_sigma", odom_err_integ_ang_sigma_, 100.0);
134 
135  pnh.param("lpf_step", lpf_step_, 16.0);
136  pnh.param("acc_lpf_step", acc_lpf_step_, 128.0);
137 
138  pnh.param("acc_var", acc_var_, M_PI / 4.0); // 45 deg
139 
140  pnh.param("jump_dist", jump_dist_, 1.0);
141  pnh.param("jump_ang", jump_ang_, 1.57);
142  pnh.param("fix_dist", fix_dist_, 0.2);
143  pnh.param("fix_ang", fix_ang_, 0.1);
144  pnh.param("bias_var_dist", bias_var_dist_, 2.0);
145  pnh.param("bias_var_ang", bias_var_ang_, 1.57);
146 
147  pnh.param("skip_measure", skip_measure_, 1);
148  pnh.param("accum_cloud", accum_cloud_, 1);
149  pnh.param("total_accum_cloud_max", total_accum_cloud_max_, accum_cloud_ * 10);
150 
151  double match_output_interval_t;
152  pnh.param("match_output_interval_interval", match_output_interval_t, 0.2);
153  match_output_interval_.reset(new ros::Duration(match_output_interval_t));
154 
155  double tf_tolerance_t;
156  pnh.param("tf_tolerance", tf_tolerance_t, 0.05);
157  tf_tolerance_.reset(new ros::Duration(tf_tolerance_t));
158 
159  pnh.param("match_output_dist", match_output_dist_, 0.1);
160  pnh.param("unmatch_output_dist", unmatch_output_dist_, 0.5);
161 
162  pnh.param("publish_tf", publish_tf_, true);
163  pnh.param("output_pcd", output_pcd_, false);
164 
165  const float float_max = std::numeric_limits<float>::max();
166  pnh.param("std_warn_thresh_xy", std_warn_thresh_[0], float_max);
167  pnh.param("std_warn_thresh_z", std_warn_thresh_[1], float_max);
168  pnh.param("std_warn_thresh_yaw", std_warn_thresh_[2], float_max);
169 
170  pnh.param("map_chunk", map_chunk_, 20.0);
171 
172  double x, y, z;
173  double roll, pitch, yaw;
174  double v_x, v_y, v_z;
175  double v_roll, v_pitch, v_yaw;
176  pnh.param("init_x", x, 0.0);
177  pnh.param("init_y", y, 0.0);
178  pnh.param("init_z", z, 0.0);
179  pnh.param("init_roll", roll, 0.0);
180  pnh.param("init_pitch", pitch, 0.0);
181  pnh.param("init_yaw", yaw, 0.0);
182  pnh.param("init_var_x", v_x, 2.0);
183  pnh.param("init_var_y", v_y, 2.0);
184  pnh.param("init_var_z", v_z, 0.5);
185  pnh.param("init_var_roll", v_roll, 0.1);
186  pnh.param("init_var_pitch", v_pitch, 0.1);
187  pnh.param("init_var_yaw", v_yaw, 0.5);
189  Vec3(x, y, z),
190  Quat(Vec3(roll, pitch, yaw)));
192  Vec3(v_x, v_y, v_z),
193  Vec3(v_roll, v_pitch, v_yaw));
194 
195  pnh.param("use_random_sampler_with_normal", use_random_sampler_with_normal_, false);
196 
197  return true;
198 }
199 } // namespace mcl_3dl
bool load(ros::NodeHandle &nh)
Definition: parameters.cpp:43
double update_downsample_x_
Definition: parameters.h:53
double expansion_var_z_
Definition: parameters.h:71
double resample_var_roll_
Definition: parameters.h:66
f
double odom_err_lin_ang_
Definition: parameters.h:81
double unmatch_output_dist_
Definition: parameters.h:90
double match_output_dist_
Definition: parameters.h:89
double update_downsample_z_
Definition: parameters.h:55
double expansion_var_roll_
Definition: parameters.h:72
TFSIMD_FORCE_INLINE const tfScalar & y() const
double map_downsample_x_
Definition: parameters.h:50
std::shared_ptr< ros::Duration > map_update_interval_
Definition: parameters.h:84
double global_localization_grid_
Definition: parameters.h:58
double odom_err_ang_ang_
Definition: parameters.h:83
double expansion_var_y_
Definition: parameters.h:70
State6DOF initial_pose_std_
Definition: parameters.h:109
double map_downsample_y_
Definition: parameters.h:51
bool param(const std::string &param_name, T &param_val, const T &default_val) const
std::array< float, 3 > std_warn_thresh_
Definition: parameters.h:107
TFSIMD_FORCE_INLINE const tfScalar & x() const
double odom_err_integ_lin_tc_
Definition: parameters.h:94
double resample_var_yaw_
Definition: parameters.h:68
double odom_err_lin_lin_
Definition: parameters.h:80
double expansion_var_yaw_
Definition: parameters.h:74
TFSIMD_FORCE_INLINE const tfScalar & z() const
double map_downsample_z_
Definition: parameters.h:52
double resample_var_z_
Definition: parameters.h:65
double odom_err_ang_lin_
Definition: parameters.h:82
std::map< std::string, std::string > frame_ids_
Definition: parameters.h:106
double resample_var_y_
Definition: parameters.h:64
double expansion_var_x_
Definition: parameters.h:69
double expansion_var_pitch_
Definition: parameters.h:73
double odom_err_integ_ang_tc_
Definition: parameters.h:96
double match_ratio_thresh_
Definition: parameters.h:75
bool use_random_sampler_with_normal_
Definition: parameters.h:110
std::shared_ptr< ros::Duration > match_output_interval_
Definition: parameters.h:98
#define ROS_ERROR(...)
std::shared_ptr< ros::Duration > tf_tolerance_
Definition: parameters.h:99
double odom_err_integ_lin_sigma_
Definition: parameters.h:95
State6DOF initial_pose_
Definition: parameters.h:108
double update_downsample_y_
Definition: parameters.h:54
int global_localization_div_yaw_
Definition: parameters.h:59
double odom_err_integ_ang_sigma_
Definition: parameters.h:97
double resample_var_x_
Definition: parameters.h:63
double resample_var_pitch_
Definition: parameters.h:67
std::array< float, 4 > dist_weight_
Definition: parameters.h:102


mcl_3dl
Author(s): Atsushi Watanabe
autogenerated on Wed May 12 2021 02:16:29