Skip to content

Commit

Permalink
minor refactor of BelowGroundRemoval filter (does anyone even use this?)
Browse files Browse the repository at this point in the history
  • Loading branch information
matemat13 committed Oct 15, 2023
1 parent 7a69534 commit 157c8e4
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions src/remove_below_ground_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,31 @@
namespace mrs_pcl_tools
{

void RemoveBelowGroundFilter::initialize(ros::NodeHandle& nh, const std::shared_ptr<CommonHandlers_t> common_handlers) {
common_handlers->param_loader->loadParamReusable<bool>("keep_organized", keep_organized, false);
common_handlers->param_loader->loadParam("ground_removal/plane_offset", plane_offset, 1.0);
const auto pfx = common_handlers->param_loader->getPrefix();
void RemoveBelowGroundFilter::initialize(ros::NodeHandle& nh, const std::shared_ptr<CommonHandlers_t> common_handlers)
{
common_handlers->param_loader->loadParamReusable<bool>("keep_organized", keep_organized, false);
common_handlers->param_loader->loadParam("ground_removal/plane_offset", plane_offset, 1.0);
const auto pfx = common_handlers->param_loader->getPrefix();

if (common_handlers->transformer == nullptr) {
common_handlers->param_loader->setPrefix("");
std::string uav_name;
common_handlers->param_loader->loadParamReusable<std::string>("uav_name", uav_name);
common_handlers->param_loader->setPrefix(pfx);
this->transformer = std::make_shared<mrs_lib::Transformer>("RemoveBelowGroundFilter");
this->transformer->setDefaultPrefix(uav_name);
this->transformer->setLookupTimeout(ros::Duration(0.3));
this->transformer->retryLookupNewest(true);
} else {
this->transformer = common_handlers->transformer;
}
if (common_handlers->transformer == nullptr)
{
common_handlers->param_loader->setPrefix("");
const auto uav_name = common_handlers->param_loader->loadParamReusable2<std::string>("uav_name");
common_handlers->param_loader->setPrefix(pfx);
this->transformer = std::make_shared<mrs_lib::Transformer>("RemoveBelowGroundFilter");
this->transformer->setDefaultPrefix(uav_name);
this->transformer->setLookupTimeout(ros::Duration(0.3));
this->transformer->retryLookupNewest(true);
} else
{
this->transformer = common_handlers->transformer;
}

m_ground_detector.initialize(nh, this->transformer,
GroundplaneDetector::groundplane_detection_config_t(*common_handlers->param_loader, pfx + "ground_removal/"));
m_ground_detector.initialize(nh,
this->transformer, GroundplaneDetector::groundplane_detection_config_t(*common_handlers->param_loader, pfx + "ground_removal/"));

initialized = true;
}
initialized = true;
}

} // namespace mrs_pcl_tools

0 comments on commit 157c8e4

Please sign in to comment.