49 dyn_server_.reset(
new dynamic_reconfigure::Server<laser_filters::ScanShadowsFilterConfig>(
own_mutex_, private_nh));
50 dynamic_reconfigure::Server<laser_filters::ScanShadowsFilterConfig>::CallbackType
f;
51 f = [
this](
auto& config,
auto level){
reconfigureCB(config, level); };
56 ROS_ERROR(
"Error: ShadowsFilter was not given min_angle.\n");
61 ROS_ERROR(
"Error: ShadowsFilter was not given min_angle.\n");
66 ROS_ERROR(
"Error: ShadowsFilter was not given window.\n");
72 ROS_INFO(
"Error: ShadowsFilter was not given neighbors.\n");
80 ROS_ERROR(
"min_angle must be 0 <= min_angle. Forcing min_angle = 0.\n");
85 ROS_ERROR(
"min_angle must be min_angle <= 90. Forcing min_angle = 90.\n");
90 ROS_ERROR(
"max_angle must be 90 <= max_angle. Forcing max_angle = 90.\n");
95 ROS_ERROR(
"max_angle must be max_angle <= 180. Forcing max_angle = 180.\n");
116 boost::recursive_mutex::scoped_lock lock(
own_mutex_);
131 boost::recursive_mutex::scoped_lock lock(
own_mutex_);
136 int size = scan_in.ranges.size();
141 for (
int i = 0; i < size; i++)
143 max_y = std::min<int>(size - i,
window_ + 1);
144 for (
int y = std::max<int>(-i, -
window_); y < max_y; y++)
154 max_neighbors = std::min<int>(i +
neighbors_, size - 1);
155 for (
int index = std::max<int>(i -
neighbors_, 0); index <= max_neighbors; index++)
157 if (scan_in.ranges[i] < scan_in.ranges[index])
159 scan_out.ranges[index] = std::numeric_limits<float>::quiet_NaN();
164 scan_out.ranges[i] = std::numeric_limits<float>::quiet_NaN();
176 ROS_DEBUG (
"[ScanShadowsFilter] No precomputed map given. Computing one.");
181 float included_angle = -
window_ * angle_increment;
183 sin_map_.push_back(fabs(sinf(included_angle)));
184 cos_map_.push_back(cosf(included_angle));
185 included_angle += angle_increment;